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

@ -70,7 +70,7 @@ wxPanel* TitleManager::CreateTitleManagerPage()
row->Add(m_refresh_button, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
auto* help_button = new wxStaticBitmap(panel, wxID_ANY, wxBITMAP_PNG_FROM_DATA(PNG_HELP));
help_button->SetToolTip(wxStringFormat2(_("The following prefixes are supported:\n{0}\n{1}\n{2}\n{3}\n{4}"),
help_button->SetToolTip(formatWxString(_("The following prefixes are supported:\n{0}\n{1}\n{2}\n{3}\n{4}"),
"titleid:", "name:", "type:", "version:", "region:"));
row->Add(help_button, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
@ -328,7 +328,7 @@ void TitleManager::OnTitleSearchComplete(wxCommandEvent& event)
}
// update status bar text
m_title_list->SortEntries(-1);
m_status_bar->SetStatusText(wxStringFormat2(_("Found {0} games, {1} updates, {2} DLCs and {3} save entries"),
m_status_bar->SetStatusText(formatWxString(_("Found {0} games, {1} updates, {2} DLCs and {3} save entries"),
m_title_list->GetCountByType(wxTitleManagerList::EntryType::Base) + m_title_list->GetCountByType(wxTitleManagerList::EntryType::System),
m_title_list->GetCountByType(wxTitleManagerList::EntryType::Update),
m_title_list->GetCountByType(wxTitleManagerList::EntryType::Dlc),
@ -494,7 +494,7 @@ void TitleManager::OnSaveDelete(wxCommandEvent& event)
if (selection.IsEmpty())
return;
const auto msg = wxStringFormat2(_("Are you really sure that you want to delete the save entry for {}"), selection);
const auto msg = formatWxString(_("Are you really sure that you want to delete the save entry for {}"), selection);
const auto result = wxMessageBox(msg, _("Warning"), wxYES_NO | wxCENTRE | wxICON_EXCLAMATION, this);
if (result == wxNO)
return;
@ -545,7 +545,7 @@ void TitleManager::OnSaveDelete(wxCommandEvent& event)
fs::remove_all(target, ec);
if (ec)
{
const auto error_msg = wxStringFormat2(_("Error when trying to delete the save directory:\n{}"), GetSystemErrorMessage(ec));
const auto error_msg = formatWxString(_("Error when trying to delete the save directory:\n{}"), GetSystemErrorMessage(ec));
wxMessageBox(error_msg, _("Error"), wxOK | wxCENTRE, this);
return;
}
@ -622,7 +622,8 @@ void TitleManager::OnSaveExport(wxCommandEvent& event)
const auto persistent_id = (uint32)(uintptr_t)m_save_account_list->GetClientData(selection_index);
wxFileDialog path_dialog(this, _("Select a target file to export the save entry"), entry->path.string(), wxEmptyString, "Exported save entry (*.zip)|*.zip", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
wxFileDialog path_dialog(this, _("Select a target file to export the save entry"), entry->path.string(), wxEmptyString,
fmt::format("{}|*.zip", _("Exported save entry (*.zip)")), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (path_dialog.ShowModal() != wxID_OK || path_dialog.GetPath().IsEmpty())
return;
@ -633,7 +634,7 @@ void TitleManager::OnSaveExport(wxCommandEvent& event)
{
zip_error_t ziperror;
zip_error_init_with_code(&ziperror, ze);
const auto error_msg = wxStringFormat2(_("Error when creating the zip for the save entry:\n{}"), zip_error_strerror(&ziperror));
const auto error_msg = formatWxString(_("Error when creating the zip for the save entry:\n{}"), zip_error_strerror(&ziperror));
wxMessageBox(error_msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
return;
}
@ -651,7 +652,7 @@ void TitleManager::OnSaveExport(wxCommandEvent& event)
{
if(zip_dir_add(zip, (const char*)entryname.substr(savedir_str.size() + 1).c_str(), ZIP_FL_ENC_UTF_8) < 0 )
{
const auto error_msg = wxStringFormat2(_("Error when trying to add a directory to the zip:\n{}"), zip_strerror(zip));
const auto error_msg = formatWxString(_("Error when trying to add a directory to the zip:\n{}"), zip_strerror(zip));
wxMessageBox(error_msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
}
}
@ -660,13 +661,13 @@ void TitleManager::OnSaveExport(wxCommandEvent& event)
auto* source = zip_source_file(zip, (const char*)entryname.c_str(), 0, 0);
if(!source)
{
const auto error_msg = wxStringFormat2(_("Error when trying to add a file to the zip:\n{}"), zip_strerror(zip));
const auto error_msg = formatWxString(_("Error when trying to add a file to the zip:\n{}"), zip_strerror(zip));
wxMessageBox(error_msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
}
if (zip_file_add(zip, (const char*)entryname.substr(savedir_str.size() + 1).c_str(), source, ZIP_FL_ENC_UTF_8) < 0)
{
const auto error_msg = wxStringFormat2(_("Error when trying to add a file to the zip:\n{}"), zip_strerror(zip));
const auto error_msg = formatWxString(_("Error when trying to add a file to the zip:\n{}"), zip_strerror(zip));
wxMessageBox(error_msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
zip_source_free(source);
@ -679,7 +680,7 @@ void TitleManager::OnSaveExport(wxCommandEvent& event)
auto* metabuff = zip_source_buffer(zip, metacontent.data(), metacontent.size(), 0);
if(zip_file_add(zip, "cemu_meta", metabuff, ZIP_FL_ENC_UTF_8) < 0)
{
const auto error_msg = wxStringFormat2(_("Error when trying to add cemu_meta file to the zip:\n{}"), zip_strerror(zip));
const auto error_msg = formatWxString(_("Error when trying to add cemu_meta file to the zip:\n{}"), zip_strerror(zip));
wxMessageBox(error_msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
zip_source_free(metabuff);
@ -730,11 +731,11 @@ void TitleManager::InitiateConnect()
if (!NCrypto::SEEPROM_IsPresent())
{
SetDownloadStatusText("Dumped online files not found");
SetDownloadStatusText(_("Dumped online files not found"));
return;
}
SetDownloadStatusText("Connecting...");
SetDownloadStatusText(_("Connecting..."));
// begin async connect
dlMgr->setUserData(this);
dlMgr->registerCallbacks(