Skip to content

Commit

Permalink
Allow "Browse" to be translated.
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
denisfa authored and rkitover committed Sep 10, 2019
1 parent d8c981f commit 528c37f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/wx/guiinit.cpp
Expand Up @@ -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))
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 528c37f

Please sign in to comment.