1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-01 03:21:41 +00:00

Improve duration tooltip

This commit is contained in:
Andrei Kortunov 2023-01-22 14:22:06 +04:00
parent 7be20301af
commit a774a51699
5 changed files with 55 additions and 26 deletions

View File

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

View File

@ -1,9 +1,17 @@
DurationDay: "d"
DurationHour: "h"
DurationMinute: "min"
DurationMonth: "mo"
DurationSecond: "s"
DurationYear: "y"
DurationDay: "{days} d "
DurationHour: "{hours} h "
DurationMinute: "{minutes} min "
DurationMonth: |-
{months, plural,
one{{months} mo }
other{{months} mos }
}
DurationSecond: "{seconds} s "
DurationYear: |-
{years, plural,
one{{years} yr }
other{{years} yrs }
}
No: "No"
NotAvailableShort: "N/A"
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"
NotAvailableShort: "N/A"
Reset: "Réinitialiser"
Yes: "Oui"

View File

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

View File

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