diff --git a/include/audacity/Types.h b/include/audacity/Types.h index 4b95a94cb..6f6b44e30 100644 --- a/include/audacity/Types.h +++ b/include/audacity/Types.h @@ -441,7 +441,7 @@ public: return *this; } - // Implements the wxPLURAL macro, which specifies a second msgid, a list + // Implements the XP macro, which specifies a second msgid, a list // of format arguments, and which of those format arguments selects among // messages; the translated strings to select among, depending on language, // might actually be more or fewer than two. See Internat.h. diff --git a/locale/update_po_files.sh b/locale/update_po_files.sh index 28aa26776..143c548bf 100755 --- a/locale/update_po_files.sh +++ b/locale/update_po_files.sh @@ -5,7 +5,7 @@ sed -E 's/\.\.\///g' |\ xargs xgettext \ --default-domain=audacity \ --directory=.. \ ---keyword=_ --keyword=XO --keyword=XXO --keyword=wxPLURAL:1,2 \ +--keyword=_ --keyword=XO --keyword=XXO --keyword=XP:1,2 \ --add-comments=" i18n" \ --add-location=file \ --copyright-holder='Audacity Team' \ diff --git a/src/Internat.h b/src/Internat.h index 821e135b0..22b741be0 100644 --- a/src/Internat.h +++ b/src/Internat.h @@ -60,8 +60,8 @@ extern AUDACITY_DLL_API const wxString& GetCustomSubstitution(const wxString& st #define _(s) GetCustomTranslation((s)) #endif -#ifdef wxPLURAL - #undef wxPLURAL +#ifdef XP + #undef XP #endif @@ -73,7 +73,7 @@ extern AUDACITY_DLL_API const wxString& GetCustomSubstitution(const wxString& st // which (intentionally) will fail to compile. The macro inserts wxT). // // Note too: it seems an i18n-hint comment is not extracted if it precedes -// wxPLURAL directly. A workaround: after the comment, insert a line +// XP directly. A workaround: after the comment, insert a line // _("dummyStringXXXX"); // where for XXXX subsitute something making this dummy string unique in the // program. Then check in your generated audacity.pot that the dummy is @@ -85,7 +85,7 @@ extern AUDACITY_DLL_API const wxString& GetCustomSubstitution(const wxString& st // The macro call is then followed by a sequence of format arguments in // parentheses. The third argument of the macro call is the zero-based index // of the format argument that selects singular or plural -#define wxPLURAL(sing, plur, n) \ +#define XP(sing, plur, n) \ TranslatableString{ wxT(sing), {} }.Plural<(n)>( wxT(plur) ) #endif diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index e4cafe60a..d8232dbeb 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -1897,7 +1897,7 @@ bool PluginManager::DropFile(const wxString &fileName) // Ask whether to enable the plug-ins if (auto nIds = ids.size()) { - auto message = wxPLURAL( + auto message = XP( "Enable this plug-in?\n", "Enable these plug-ins?\n", 0 diff --git a/src/ProjectManager.cpp b/src/ProjectManager.cpp index d69098094..b30f7a154 100644 --- a/src/ProjectManager.cpp +++ b/src/ProjectManager.cpp @@ -1044,9 +1044,9 @@ TranslatableString ProjectManager::GetHoursMinsString(int iMinutes) int iHours = iMinutes / 60; int iMins = iMinutes % 60; - auto sHours = wxPLURAL( "%d hour", "%d hours", 0 )( iHours ); + auto sHours = XP( "%d hour", "%d hours", 0 )( iHours ); - auto sMins = wxPLURAL( "%d minute", "%d minutes", 0 )( iMins ); + auto sMins = XP( "%d minute", "%d minutes", 0 )( iMins ); /* i18n-hint: A time in hours and minutes. Only translate the "and". */ return XO("%s and %s.").Format( sHours, sMins ); diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 9d7bc54fd..31890841f 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -3371,6 +3371,7 @@ static void RegisterFunctions() // All function names must be UP-CASED static const FUNDEF functions[] = { { "_", SUBR, gettext }, + // to do: more i18n functions, for contexts and plurals { "NGETTEXT", SUBR, ngettext }, { "AUD-DO", SUBR, xlc_aud_do }, }; diff --git a/src/menus/ClipMenus.cpp b/src/menus/ClipMenus.cpp index 669065e55..a7108ef92 100644 --- a/src/menus/ClipMenus.cpp +++ b/src/menus/ClipMenus.cpp @@ -328,7 +328,7 @@ TranslatableString ClipBoundaryMessage( clips. */ XO("dummyStringClipBoundaryMessage"); - str = wxPLURAL( + str = XP( "%s %d of %d clip %s", "%s %d of %d clips %s", 2 @@ -350,7 +350,7 @@ TranslatableString ClipBoundaryMessage( clips. */ XO("dummyStringClipBoundaryMessageLong"); - str = wxPLURAL( + str = XP( "%s %d and %s %d of %d clip %s", "%s %d and %s %d of %d clips %s", 4 @@ -586,7 +586,7 @@ void DoSelectClip(AudacityProject &project, bool next) last number counts the clips, string names a track */ XO("dummyStringOnSelectClip"); - auto str = wxPLURAL( + auto str = XP( "%d of %d clip %s", "%d of %d clips %s", 1