Localization improvements and fixes (#956)

This commit is contained in:
Francesco Saltori 2023-09-08 02:09:03 +02:00 committed by GitHub
parent 4d1864c8a1
commit c16e258c93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 229 additions and 356 deletions

View file

@ -303,29 +303,29 @@ void wxTitleManagerList::OnConvertToCompressedFormat(uint64 titleId, uint64 righ
}
}
std::string msg = wxHelper::MakeUTF8(_("The following content will be converted to a compressed Wii U archive file (.wua):"));
wxString msg = _("The following content will be converted to a compressed Wii U archive file (.wua):");
msg.append("\n \n");
if (titleInfo_base.IsValid())
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game:\n{}"))), titleInfo_base.GetPrintPath()));
msg.append(formatWxString(_("Base game:\n{}"), titleInfo_base.GetPrintPath()));
else
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game:\nNot installed")))));
msg.append(_("Base game:\nNot installed"));
msg.append("\n\n");
if (titleInfo_update.IsValid())
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Update:\n{}"))), titleInfo_update.GetPrintPath()));
msg.append(formatWxString(_("Update:\n{}"), titleInfo_update.GetPrintPath()));
else
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Update:\nNot installed")))));
msg.append(_("Update:\nNot installed"));
msg.append("\n\n");
if (titleInfo_aoc.IsValid())
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("DLC:\n{}"))), titleInfo_aoc.GetPrintPath()));
msg.append(formatWxString(_("DLC:\n{}"), titleInfo_aoc.GetPrintPath()));
else
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("DLC:\nNot installed")))));
msg.append(_("DLC:\nNot installed"));
const int answer = wxMessageBox(wxString::FromUTF8(msg), _("Confirmation"), wxOK | wxCANCEL | wxCENTRE | wxICON_QUESTION, this);
const int answer = wxMessageBox(msg, _("Confirmation"), wxOK | wxCANCEL | wxCENTRE | wxICON_QUESTION, this);
if (answer != wxOK)
return;
std::vector<TitleInfo*> titlesToConvert;
@ -732,7 +732,7 @@ void wxTitleManagerList::OnItemSelected(wxListEvent& event)
// return;;
//}
//m_tooltip_text->SetLabel(wxStringFormat2("{}\n{}", msg, _("You can use the context menu to fix it.")));
//m_tooltip_text->SetLabel(formatWxString("{}\n{}", msg, _("You can use the context menu to fix it.")));
//m_tooltip_window->Fit();
//m_tooltip_timer->StartOnce(250);
}
@ -792,9 +792,9 @@ bool wxTitleManagerList::DeleteEntry(long index, const TitleEntry& entry)
wxString msg;
const bool is_directory = fs::is_directory(entry.path);
if(is_directory)
msg = wxStringFormat2(_("Are you really sure that you want to delete the following folder:\n{}"), wxHelper::FromUtf8(_pathToUtf8(entry.path)));
msg = formatWxString(_("Are you really sure that you want to delete the following folder:\n{}"), _pathToUtf8(entry.path));
else
msg = wxStringFormat2(_("Are you really sure that you want to delete the following file:\n{}"), wxHelper::FromUtf8(_pathToUtf8(entry.path)));
msg = formatWxString(_("Are you really sure that you want to delete the following file:\n{}"), _pathToUtf8(entry.path));
const auto result = wxMessageBox(msg, _("Warning"), wxYES_NO | wxCENTRE | wxICON_EXCLAMATION, this);
if (result == wxNO)
@ -835,7 +835,7 @@ bool wxTitleManagerList::DeleteEntry(long index, const TitleEntry& entry)
if(ec)
{
const auto error_msg = wxStringFormat2(_("Error when trying to delete the entry:\n{}"), GetSystemErrorMessage(ec));
const auto error_msg = formatWxString(_("Error when trying to delete the entry:\n{}"), GetSystemErrorMessage(ec));
wxMessageBox(error_msg, _("Error"), wxOK|wxCENTRE, this);
return false;
}
@ -922,15 +922,15 @@ wxString wxTitleManagerList::GetTitleEntryText(const TitleEntry& entry, ItemColu
switch (column)
{
case ColumnTitleId:
return wxStringFormat2("{:08x}-{:08x}", (uint32)(entry.title_id >> 32), (uint32)(entry.title_id & 0xFFFFFFFF));
return formatWxString("{:08x}-{:08x}", (uint32) (entry.title_id >> 32), (uint32) (entry.title_id & 0xFFFFFFFF));
case ColumnName:
return entry.name;
case ColumnType:
return wxStringFormat2("{}", entry.type);
return GetTranslatedTitleEntryType(entry.type);
case ColumnVersion:
return wxStringFormat2("{}", entry.version);
return formatWxString("{}", entry.version);
case ColumnRegion:
return wxStringFormat2("{}", entry.region); // TODO its a flag so formatter is currently not correct
return wxGetTranslation(fmt::format("{}", entry.region));
case ColumnFormat:
{
if (entry.type == EntryType::Save)
@ -945,7 +945,6 @@ wxString wxTitleManagerList::GetTitleEntryText(const TitleEntry& entry, ItemColu
return _("WUA");
}
return "";
//return wxStringFormat2("{}", entry.format);
}
case ColumnLocation:
{
@ -964,6 +963,25 @@ wxString wxTitleManagerList::GetTitleEntryText(const TitleEntry& entry, ItemColu
return wxEmptyString;
}
std::string wxTitleManagerList::GetTranslatedTitleEntryType(EntryType type)
{
switch (type)
{
case EntryType::Base:
return _("base").utf8_string();
case EntryType::Update:
return _("update").utf8_string();
case EntryType::Dlc:
return _("DLC").utf8_string();
case EntryType::Save:
return _("save").utf8_string();
case EntryType::System:
return _("system").utf8_string();
default:
return std::to_string(static_cast<std::underlying_type_t<EntryType>>(type));
}
}
void wxTitleManagerList::HandleTitleListCallback(CafeTitleListCallbackEvent* evt)
{
if (evt->eventType != CafeTitleListCallbackEvent::TYPE::TITLE_DISCOVERED &&