Additional localization fixes (#966)

This commit is contained in:
Francesco Saltori 2023-09-14 12:47:59 +02:00 committed by GitHub
parent c66ab0c51a
commit 96800c6f97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 68 additions and 123 deletions

View file

@ -501,16 +501,16 @@ wxString wxDownloadManagerList::GetTitleEntryText(const TitleEntry& entry, ItemC
return wxEmptyString;
}
std::string wxDownloadManagerList::GetTranslatedTitleEntryType(EntryType type)
wxString wxDownloadManagerList::GetTranslatedTitleEntryType(EntryType type)
{
switch (type)
{
case EntryType::Base:
return _("base").utf8_string();
return _("base");
case EntryType::Update:
return _("update").utf8_string();
return _("update");
case EntryType::DLC:
return _("DLC").utf8_string();
return _("DLC");
default:
return std::to_string(static_cast<std::underlying_type_t<EntryType>>(type));
}

View file

@ -150,6 +150,6 @@ private:
bool SortFunc(std::span<int> sortColumnOrder, const Type_t& v1, const Type_t& v2);
static wxString GetTitleEntryText(const TitleEntry& entry, ItemColumn column);
static std::string GetTranslatedTitleEntryType(EntryType entryType);
static wxString GetTranslatedTitleEntryType(EntryType entryType);
std::future<bool> m_context_worker;
};

View file

@ -1009,15 +1009,20 @@ void wxGameList::OnGameEntryUpdatedByTitleId(wxTitleIdEvent& event)
if (iosu::pdm::GetStatForGamelist(baseTitleId, playTimeStat))
{
// time played
uint32 timePlayed = playTimeStat.numMinutesPlayed * 60;
if (timePlayed == 0)
uint32 minutesPlayed = playTimeStat.numMinutesPlayed;
if (minutesPlayed == 0)
SetItem(index, ColumnGameTime, wxEmptyString);
else if (timePlayed < 60)
SetItem(index, ColumnGameTime, fmt::format("{} seconds", timePlayed));
else if (timePlayed < 60 * 60)
SetItem(index, ColumnGameTime, fmt::format("{} minutes", timePlayed / 60));
else if (minutesPlayed < 60)
SetItem(index, ColumnGameTime, formatWxString(wxPLURAL("{} minute", "{} minutes", minutesPlayed), minutesPlayed));
else
SetItem(index, ColumnGameTime, fmt::format("{} hours {} minutes", timePlayed / 3600, (timePlayed / 60) % 60));
{
uint32 hours = minutesPlayed / 60;
uint32 minutes = minutesPlayed % 60;
wxString hoursText = formatWxString(wxPLURAL("{} hour", "{} hours", hours), hours);
wxString minutesText = formatWxString(wxPLURAL("{} minute", "{} minutes", minutes), minutes);
SetItem(index, ColumnGameTime, hoursText + " " + minutesText);
}
// last played
if (playTimeStat.last_played.year != 0)
{

View file

@ -963,20 +963,20 @@ wxString wxTitleManagerList::GetTitleEntryText(const TitleEntry& entry, ItemColu
return wxEmptyString;
}
std::string wxTitleManagerList::GetTranslatedTitleEntryType(EntryType type)
wxString wxTitleManagerList::GetTranslatedTitleEntryType(EntryType type)
{
switch (type)
{
case EntryType::Base:
return _("base").utf8_string();
return _("base");
case EntryType::Update:
return _("update").utf8_string();
return _("update");
case EntryType::Dlc:
return _("DLC").utf8_string();
return _("DLC");
case EntryType::Save:
return _("save").utf8_string();
return _("save");
case EntryType::System:
return _("system").utf8_string();
return _("system");
default:
return std::to_string(static_cast<std::underlying_type_t<EntryType>>(type));
}

View file

@ -132,7 +132,7 @@ private:
bool SortFunc(int column, const Type_t& v1, const Type_t& v2);
static wxString GetTitleEntryText(const TitleEntry& entry, ItemColumn column);
static std::string GetTranslatedTitleEntryType(EntryType entryType);
static wxString GetTranslatedTitleEntryType(EntryType entryType);
std::future<bool> m_context_worker;
uint64 m_callbackIdTitleList;