1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Merge branch 'count_loc' into 'master'

Improve duration tooltip

See merge request OpenMW/openmw!2644
This commit is contained in:
psi29a 2023-01-22 13:20:23 +00:00
commit e0f7884635
5 changed files with 55 additions and 26 deletions

View File

@ -8,6 +8,7 @@
#include <MyGUI_RenderManager.h> #include <MyGUI_RenderManager.h>
#include <components/esm/records.hpp> #include <components/esm/records.hpp>
#include <components/l10n/manager.hpp>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include <components/widgets/box.hpp> #include <components/widgets/box.hpp>
@ -731,12 +732,14 @@ namespace MWGui
std::string ToolTips::getDurationString(float duration, const std::string& prefix) std::string ToolTips::getDurationString(float duration, const std::string& prefix)
{ {
auto l10n = MWBase::Environment::get().getL10nManager()->getContext("Interface");
std::string ret; std::string ret;
ret = prefix + ": "; ret = prefix + ": ";
if (duration < 1.f) if (duration < 1.f)
{ {
ret += "0 s"; ret += l10n->formatMessage("DurationSecond", { "seconds" }, { 0 });
return ret; return ret;
} }
@ -757,29 +760,29 @@ namespace MWGui
if (years) if (years)
{ {
units++; units++;
ret += toString(years) + " #{Interface:DurationYear} "; ret += l10n->formatMessage("DurationYear", { "years" }, { years });
} }
if (months) if (months)
{ {
units++; units++;
ret += toString(months) + " #{Interface:DurationMonth} "; ret += l10n->formatMessage("DurationMonth", { "months" }, { months });
} }
if (units < 2 && days) if (units < 2 && days)
{ {
units++; units++;
ret += toString(days) + " #{Interface:DurationDay} "; ret += l10n->formatMessage("DurationDay", { "days" }, { days });
} }
if (units < 2 && hours) if (units < 2 && hours)
{ {
units++; units++;
ret += toString(hours) + " #{Interface:DurationHour} "; ret += l10n->formatMessage("DurationHour", { "hours" }, { hours });
} }
if (units >= 2) if (units >= 2)
return ret; return ret;
if (minutes) if (minutes)
ret += toString(minutes) + " #{Interface:DurationMinute} "; ret += l10n->formatMessage("DurationMinute", { "minutes" }, { minutes });
if (seconds) if (seconds)
ret += toString(seconds) + " #{Interface:DurationSecond} "; ret += l10n->formatMessage("DurationSecond", { "seconds" }, { seconds });
return ret; return ret;
} }

View File

@ -1,9 +1,17 @@
DurationDay: "d" DurationDay: "{days} d "
DurationHour: "h" DurationHour: "{hours} h "
DurationMinute: "min" DurationMinute: "{minutes} min "
DurationMonth: "mo" DurationMonth: |-
DurationSecond: "s" {months, plural,
DurationYear: "y" one{{months} mo }
other{{months} mos }
}
DurationSecond: "{seconds} s "
DurationYear: |-
{years, plural,
one{{years} yr }
other{{years} yrs }
}
No: "No" No: "No"
NotAvailableShort: "N/A" NotAvailableShort: "N/A"
Reset: "Reset" Reset: "Reset"

View File

@ -1,5 +1,18 @@
DurationDay: |-
{days, plural,
one{{days} jour }
other{{days} jours }
}
DurationHour: "{hours} h "
DurationMinute: "{minutes} min "
DurationMonth: "{months} mois "
DurationSecond: "{seconds} sec "
DurationYear: |-
{years, plural,
one{{years} an }
other{{years} ans }
}
No: "Non" No: "Non"
NotAvailableShort: "N/A" NotAvailableShort: "N/A"
Reset: "Réinitialiser" Reset: "Réinitialiser"
Yes: "Oui" Yes: "Oui"

View File

@ -1,9 +1,14 @@
DurationDay: "д" DurationDay: "{days} д "
DurationHour: "ч" DurationHour: "{hours} ч "
DurationMinute: "мин" DurationMinute: "{minutes} мин "
DurationMonth: "мес" DurationMonth: "{months} мес "
DurationSecond: "с" DurationSecond: "{seconds} с "
DurationYear: "л" DurationYear: |-
{years, plural,
one{{years} г }
few{{years} г }
other{{years} л }
}
No: "Нет" No: "Нет"
NotAvailableShort: "Н/Д" NotAvailableShort: "Н/Д"
Reset: "Обнулить" Reset: "Обнулить"

View File

@ -1,9 +1,9 @@
DurationDay: "d" DurationDay: "{days} d "
DurationHour: "tim" DurationHour: "{hours} tim "
DurationMinute: "min" DurationMinute: "{minutes} min "
DurationMonth: "må" DurationMonth: "{months} "
DurationSecond: "sek" DurationSecond: "{seconds} sek "
DurationYear: "år" DurationYear: "{years} år "
No: "Nej" No: "Nej"
NotAvailableShort: "N/A" NotAvailableShort: "N/A"
Reset: "Återställ" Reset: "Återställ"