diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index 7f084590f..1c265bfa8 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -1908,7 +1908,9 @@ wxChoice * ShuttleGuiBase::TieChoice( // Put to prefs does 2 and 3. if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef ); // Get Index from Prefs. if( DoStep(1) ) TempIndex = TranslateToIndex( TempStr, InternalChoices ); // To an index - if( DoStep(2) ) pChoice = TieChoice( Prompt, TempIndex, Choices ); // Get/Put index from GUI. + if( DoStep(2) ) + pChoice = TieChoice( Prompt, TempIndex, + transform_container(Choices, GetCustomTranslation) ); if( DoStep(3) ) TempStr = TranslateFromIndex( TempIndex, InternalChoices ); // To a string if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef ); // Put into Prefs. return pChoice; diff --git a/src/export/Export.cpp b/src/export/Export.cpp index 4465426e0..ac29957c0 100644 --- a/src/export/Export.cpp +++ b/src/export/Export.cpp @@ -153,11 +153,16 @@ wxString ExportPlugin::GetFormat(int index) return mFormatInfos[index].mFormat; } -wxString ExportPlugin::GetDescription(int index) +wxString ExportPlugin::GetUntranslatedDescription(int index) { return mFormatInfos[index].mDescription; } +wxString ExportPlugin::GetTranslatedDescription(int index) +{ + return GetCustomTranslation( GetUntranslatedDescription( index ) ); +} + FileExtension ExportPlugin::GetExtension(int index) { return mFormatInfos[index].mExtensions[0]; @@ -174,7 +179,7 @@ wxString ExportPlugin::GetMask(int index) return mFormatInfos[index].mMask; } - wxString mask = GetDescription(index) + wxT("|"); + wxString mask = GetTranslatedDescription(index) + wxT("|"); // Build the mask // const auto &ext = GetExtension(index); diff --git a/src/export/Export.h b/src/export/Export.h index 3692cbbc4..e735dd916 100644 --- a/src/export/Export.h +++ b/src/export/Export.h @@ -45,7 +45,7 @@ class AUDACITY_DLL_API FormatInfo ~FormatInfo() {} wxString mFormat; - wxString mDescription; + wxString mDescription; // untranslated // wxString mExtension; FileExtensions mExtensions; wxString mMask; @@ -65,7 +65,7 @@ public: int AddFormat(); void SetFormat(const wxString & format, int index); - void SetDescription(const wxString & description, int index); + void SetDescription(const wxString & description /* untranslated */, int index); void AddExtension(const wxString &extension,int index); void SetExtensions(FileExtensions extensions, int index); void SetMask(const wxString & mask, int index); @@ -74,7 +74,8 @@ public: virtual int GetFormatCount(); virtual wxString GetFormat(int index); - virtual wxString GetDescription(int index); + wxString GetUntranslatedDescription(int index); + wxString GetTranslatedDescription(int index); /** @brief Return the (first) file name extension for the sub-format. * @param index The sub-format for which the extension is wanted */ virtual FileExtension GetExtension(int index = 0); diff --git a/src/export/ExportCL.cpp b/src/export/ExportCL.cpp index deacf9158..0b68fb7fb 100644 --- a/src/export/ExportCL.cpp +++ b/src/export/ExportCL.cpp @@ -312,7 +312,7 @@ ExportCL::ExportCL() AddExtension(wxT(""),0); SetMaxChannels(255,0); SetCanMetaData(false,0); - SetDescription(_("(external program)"),0); + SetDescription(XO("(external program)"),0); } ProgressResult ExportCL::Export(AudacityProject *project, diff --git a/src/export/ExportFFmpeg.cpp b/src/export/ExportFFmpeg.cpp index aa7cdebef..3e13610fc 100644 --- a/src/export/ExportFFmpeg.cpp +++ b/src/export/ExportFFmpeg.cpp @@ -225,7 +225,7 @@ ExportFFmpeg::ExportFFmpeg() } SetMaxChannels(ExportFFmpegOptions::fmts[newfmt].maxchannels,fmtindex); - SetDescription(ExportFFmpegOptions::fmts[newfmt].Description(), fmtindex); + SetDescription(ExportFFmpegOptions::fmts[newfmt].description_, fmtindex); int canmeta = ExportFFmpegOptions::fmts[newfmt].canmetadata; if (canmeta && (canmeta == AV_CANMETA || canmeta <= avfver)) diff --git a/src/export/ExportFLAC.cpp b/src/export/ExportFLAC.cpp index f5bfb1b46..a3956a0dd 100644 --- a/src/export/ExportFLAC.cpp +++ b/src/export/ExportFLAC.cpp @@ -93,15 +93,15 @@ void ExportFLACOptions::PopulateOrExchange(ShuttleGui & S) }; wxArrayStringEx flacLevelNames{ - _("0 (fastest)") , - _("1") , - _("2") , - _("3") , - _("4") , - _("5") , - _("6") , - _("7") , - _("8 (best)") , + XO("0 (fastest)") , + XO("1") , + XO("2") , + XO("3") , + XO("4") , + XO("5") , + XO("6") , + XO("7") , + XO("8 (best)") , }; wxArrayStringEx flacBitDepthLabels{ @@ -110,8 +110,8 @@ void ExportFLACOptions::PopulateOrExchange(ShuttleGui & S) }; wxArrayStringEx flacBitDepthNames{ - _("16 bit") , - _("24 bit") , + XO("16 bit") , + XO("24 bit") , }; S.StartVerticalLay(); @@ -239,7 +239,7 @@ ExportFLAC::ExportFLAC() AddExtension(wxT("flac"),0); SetMaxChannels(FLAC__MAX_CHANNELS,0); SetCanMetaData(true,0); - SetDescription(_("FLAC Files"),0); + SetDescription(XO("FLAC Files"),0); } ProgressResult ExportFLAC::Export(AudacityProject *project, diff --git a/src/export/ExportMP2.cpp b/src/export/ExportMP2.cpp index 3586f9a22..934cb0f7a 100644 --- a/src/export/ExportMP2.cpp +++ b/src/export/ExportMP2.cpp @@ -236,7 +236,7 @@ ExportMP2::ExportMP2() AddExtension(wxT("mp2"),0); SetMaxChannels(2,0); SetCanMetaData(true,0); - SetDescription(_("MP2 Files"),0); + SetDescription(XO("MP2 Files"),0); } ProgressResult ExportMP2::Export(AudacityProject *project, diff --git a/src/export/ExportMP3.cpp b/src/export/ExportMP3.cpp index 17b58d745..af84b4f55 100644 --- a/src/export/ExportMP3.cpp +++ b/src/export/ExportMP3.cpp @@ -1684,7 +1684,7 @@ ExportMP3::ExportMP3() AddExtension(wxT("mp3"),0); SetMaxChannels(2,0); SetCanMetaData(true,0); - SetDescription(_("MP3 Files"),0); + SetDescription(XO("MP3 Files"),0); } bool ExportMP3::CheckFileName(wxFileName & WXUNUSED(filename), int WXUNUSED(format)) diff --git a/src/export/ExportMultiple.cpp b/src/export/ExportMultiple.cpp index 101a27c3d..3280eea36 100644 --- a/src/export/ExportMultiple.cpp +++ b/src/export/ExportMultiple.cpp @@ -234,7 +234,7 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S) ++i; for (int j = 0; j < pPlugin->GetFormatCount(); j++) { - formats.push_back(mPlugins[i]->GetDescription(j)); + formats.push_back(mPlugins[i]->GetUntranslatedDescription(j)); if (mPlugins[i]->GetFormat(j) == defaultFormat) { mPluginIndex = i; mSubFormatIndex = j; diff --git a/src/export/ExportOGG.cpp b/src/export/ExportOGG.cpp index c1247d82a..7b9dbd34b 100644 --- a/src/export/ExportOGG.cpp +++ b/src/export/ExportOGG.cpp @@ -157,7 +157,7 @@ ExportOGG::ExportOGG() AddExtension(wxT("ogg"),0); SetMaxChannels(255,0); SetCanMetaData(true,0); - SetDescription(_("Ogg Vorbis Files"),0); + SetDescription(XO("Ogg Vorbis Files"),0); } ProgressResult ExportOGG::Export(AudacityProject *project, diff --git a/src/export/ExportPCM.cpp b/src/export/ExportPCM.cpp index 8e2c8049b..dab78edd3 100644 --- a/src/export/ExportPCM.cpp +++ b/src/export/ExportPCM.cpp @@ -53,7 +53,7 @@ struct { int format; const wxChar *name; - const wxChar *desc; + const wxChar *desc; // untranslated } static const kFormats[] = { @@ -374,7 +374,7 @@ ExportPCM::ExportPCM() SetFormat(kFormats[i].name, format); SetCanMetaData(true, format); - SetDescription(wxGetTranslation(kFormats[i].desc), format); + SetDescription(kFormats[i].desc, format); AddExtension(ext, format); SetMaxChannels(si.channels - 1, format); } @@ -383,7 +383,7 @@ ExportPCM::ExportPCM() format = AddFormat() - 1; // store the index = 1 less than the count SetFormat(wxT("LIBSNDFILE"), format); SetCanMetaData(true, format); - SetDescription(_("Other uncompressed files"), format); + SetDescription(XO("Other uncompressed files"), format); auto allext = sf_get_all_extensions(); wxString wavext = sf_header_extension(SF_FORMAT_WAV); // get WAV ext. #if defined(wxMSW) diff --git a/src/prefs/EffectsPrefs.cpp b/src/prefs/EffectsPrefs.cpp index 2a3d319c7..68dfff210 100644 --- a/src/prefs/EffectsPrefs.cpp +++ b/src/prefs/EffectsPrefs.cpp @@ -178,11 +178,11 @@ void EffectsPrefs::PopulateOrExchange(ShuttleGui & S) S.StartMultiColumn(2); { wxArrayStringEx visualgroups{ - _("Sorted by Effect Name") , - _("Sorted by Publisher and Effect Name") , - _("Sorted by Type and Effect Name") , - _("Grouped by Publisher") , - _("Grouped by Type") , + XO("Sorted by Effect Name") , + XO("Sorted by Publisher and Effect Name") , + XO("Sorted by Type and Effect Name") , + XO("Grouped by Publisher") , + XO("Grouped by Type") , }; wxArrayStringEx prefsgroups{ diff --git a/src/prefs/GUIPrefs.cpp b/src/prefs/GUIPrefs.cpp index b329a6fc8..fb7c8c159 100644 --- a/src/prefs/GUIPrefs.cpp +++ b/src/prefs/GUIPrefs.cpp @@ -67,37 +67,41 @@ wxString GUIPrefs::HelpPageName() } void GUIPrefs::GetRangeChoices( - wxArrayStringEx *pChoices, wxArrayStringEx *pCodes) + wxArrayStringEx *pChoicesUntranslated, + wxArrayStringEx *pChoicesTranslated, + wxArrayStringEx *pCodes +) { - if (pCodes) { - auto &codes = *pCodes; - codes.clear(); - codes.insert( codes.end(), { - wxT("36") , - wxT("48") , - wxT("60") , - wxT("72") , - wxT("84") , - wxT("96") , - wxT("120") , - wxT("145") , - } ); - } + static const auto sCodes = { + wxT("36") , + wxT("48") , + wxT("60") , + wxT("72") , + wxT("84") , + wxT("96") , + wxT("120") , + wxT("145") , + }; + if (pCodes) + *pCodes = sCodes; - if (pChoices) { - auto &choices = *pChoices; - choices.clear(); - choices.insert( choices.end(), { - _("-36 dB (shallow range for high-amplitude editing)") , - _("-48 dB (PCM range of 8 bit samples)") , - _("-60 dB (PCM range of 10 bit samples)") , - _("-72 dB (PCM range of 12 bit samples)") , - _("-84 dB (PCM range of 14 bit samples)") , - _("-96 dB (PCM range of 16 bit samples)") , - _("-120 dB (approximate limit of human hearing)") , - _("-145 dB (PCM range of 24 bit samples)") , - } ); - } + static const auto sChoices = { + XO("-36 dB (shallow range for high-amplitude editing)") , + XO("-48 dB (PCM range of 8 bit samples)") , + XO("-60 dB (PCM range of 10 bit samples)") , + XO("-72 dB (PCM range of 12 bit samples)") , + XO("-84 dB (PCM range of 14 bit samples)") , + XO("-96 dB (PCM range of 16 bit samples)") , + XO("-120 dB (approximate limit of human hearing)") , + XO("-145 dB (PCM range of 24 bit samples)") , + }; + + if (pChoicesUntranslated) + *pChoicesUntranslated = sChoices; + + if (pChoicesTranslated) + *pChoicesTranslated = + transform_container( sChoices, GetCustomTranslation ); } void GUIPrefs::Populate() @@ -114,8 +118,8 @@ void GUIPrefs::Populate() mHtmlHelpChoices.clear(); auto values2 = { - _("Local") , - _("From Internet") , + XO("Local") , + XO("From Internet") , }; mHtmlHelpChoices.insert( mHtmlHelpChoices.end(), values2 ); @@ -131,17 +135,17 @@ void GUIPrefs::Populate() mThemeChoices.clear(); mThemeChoices.insert( mThemeChoices.end(), { /* i18n-hint: describing the "classic" or traditional appearance of older versions of Audacity */ - _("Classic") , + XO("Classic") , /* i18n-hint: Light meaning opposite of dark */ - _("Light") , - _("Dark") , + XO("Light") , + XO("Dark") , /* i18n-hint: greater difference between foreground and background colors */ - _("High Contrast") , + XO("High Contrast") , /* i18n-hint: user defined */ - _("Custom") , + XO("Custom") , } ); - GetRangeChoices(&mRangeChoices, &mRangeCodes); + GetRangeChoices(&mRangeChoices, nullptr, &mRangeCodes); #if 0 mLangCodes.insert( mLangCodes.end(), { diff --git a/src/prefs/GUIPrefs.h b/src/prefs/GUIPrefs.h index c97f25ada..4157b225e 100644 --- a/src/prefs/GUIPrefs.h +++ b/src/prefs/GUIPrefs.h @@ -35,7 +35,9 @@ class GUIPrefs final : public PrefsPanel void PopulateOrExchange(ShuttleGui & S) override; static void GetRangeChoices( - wxArrayStringEx *pChoices, wxArrayStringEx *pCodes); + wxArrayStringEx *pChoicesUntranslated, + wxArrayStringEx *pChoicesTranslated, + wxArrayStringEx *pCodes); // If no input language given, defaults first to choice in preferences, then // to system language. diff --git a/src/prefs/QualityPrefs.cpp b/src/prefs/QualityPrefs.cpp index 21c40190d..8d507c3b9 100644 --- a/src/prefs/QualityPrefs.cpp +++ b/src/prefs/QualityPrefs.cpp @@ -127,7 +127,7 @@ void QualityPrefs::GetNamesAndLabels() mSampleRateNames.push_back(wxString::Format(wxT("%i Hz"), iRate)); } - mSampleRateNames.push_back(_("Other...")); + mSampleRateNames.push_back(XO("Other...")); // The label for the 'Other...' case can be any value at all. mSampleRateLabels.push_back(44100); // If chosen, this value will be overwritten diff --git a/src/prefs/TracksBehaviorsPrefs.cpp b/src/prefs/TracksBehaviorsPrefs.cpp index 17992b477..eadad7463 100644 --- a/src/prefs/TracksBehaviorsPrefs.cpp +++ b/src/prefs/TracksBehaviorsPrefs.cpp @@ -60,9 +60,9 @@ void TracksBehaviorsPrefs::Populate() mSoloCodes.push_back(wxT("Multi")); mSoloCodes.push_back(wxT("None")); - mSoloChoices.push_back(_("Simple")); - mSoloChoices.push_back(_("Multi-track")); - mSoloChoices.push_back(_("None")); + mSoloChoices.push_back(XO("Simple")); + mSoloChoices.push_back(XO("Multi-track")); + mSoloChoices.push_back(XO("None")); //------------------------- Main section -------------------- // Now construct the GUI itself. diff --git a/src/prefs/WaveformPrefs.cpp b/src/prefs/WaveformPrefs.cpp index 56b295b1c..e70df6c19 100644 --- a/src/prefs/WaveformPrefs.cpp +++ b/src/prefs/WaveformPrefs.cpp @@ -79,7 +79,7 @@ enum { void WaveformPrefs::Populate() { // Reuse the same choices and codes as for Interface prefs - GUIPrefs::GetRangeChoices(&mRangeChoices, &mRangeCodes); + GUIPrefs::GetRangeChoices(nullptr, &mRangeChoices, &mRangeCodes); //------------------------- Main section -------------------- // Now construct the GUI itself. diff --git a/src/prefs/WaveformSettings.cpp b/src/prefs/WaveformSettings.cpp index f5ed8ebfe..217c440fa 100644 --- a/src/prefs/WaveformSettings.cpp +++ b/src/prefs/WaveformSettings.cpp @@ -111,7 +111,7 @@ void WaveformSettings::ConvertToEnumeratedDBRange() { // Assumes the codes are in ascending sequence. wxArrayStringEx codes; - GUIPrefs::GetRangeChoices(NULL, &codes); + GUIPrefs::GetRangeChoices(nullptr, nullptr, &codes); int ii = 0; for (int nn = codes.size(); ii < nn; ++ii) { long value = 0; @@ -125,7 +125,7 @@ void WaveformSettings::ConvertToEnumeratedDBRange() void WaveformSettings::ConvertToActualDBRange() { wxArrayStringEx codes; - GUIPrefs::GetRangeChoices(NULL, &codes); + GUIPrefs::GetRangeChoices(nullptr, nullptr, &codes); long value = 0; codes[std::max(0, std::min((int)(codes.size()) - 1, dBRange))] .ToLong(&value);