Allow "Browse" to be translated.

wxWidgets fails to translate some internal strings due to locale issues.

It is not clear how the current locale is detected, but it fails for
cases when the system is different from the set by the user. Eg: the
system is using `en_US`, but the user sets `LANG=pt_BR.utf8` for an
application. Some internal strings are translated because of `LANG`,
while others remain the same because `en_US`.
This commit is contained in:
Edênis Freindorfer Azevedo 2019-09-06 19:39:52 -03:00 committed by Rafael Kitover
parent d8c981fb42
commit 528c37f9e0
1 changed files with 13 additions and 0 deletions

View File

@ -2716,6 +2716,12 @@ void MainFrame::BindAppIcon() {
SetIcon(icon);
}
static void setCustomLabelForFilePicker(wxDirPickerCtrl* dp)
{
wxButton *pButt = static_cast<wxButton*>(dp->GetPickerCtrl());
if (pButt) pButt->SetLabel(_("Browse"));
}
// If there is a menubar, store all special menuitems
#define XRCITEM_I(id) menubar->FindItem(id, NULL)
#define XRCITEM_D(s) XRCITEM_I(XRCID_D(s))
@ -3731,12 +3737,19 @@ bool MainFrame::BindControls()
d = LoadXRCDialog("DirectoriesConfig");
{
getdp("GBARoms", gopts.gba_rom_dir);
setCustomLabelForFilePicker(dp);
getdp("GBRoms", gopts.gb_rom_dir);
setCustomLabelForFilePicker(dp);
getdp("GBCRoms", gopts.gbc_rom_dir);
setCustomLabelForFilePicker(dp);
getdp("BatSaves", gopts.battery_dir);
setCustomLabelForFilePicker(dp);
getdp("StateSaves", gopts.state_dir);
setCustomLabelForFilePicker(dp);
getdp("Screenshots", gopts.scrshot_dir);
setCustomLabelForFilePicker(dp);
getdp("Recordings", gopts.recording_dir);
setCustomLabelForFilePicker(dp);
d->Fit();
}
wxDialog* joyDialog = LoadXRCropertySheetDialog("JoypadConfig");