diff --git a/locale/update_po_files.sh b/locale/update_po_files.sh index 143c548bf..a7b061064 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=XP:1,2 \ +--keyword=_ --keyword=XO --keyword=XC:1,2c --keyword=XXO --keyword=XP:1,2 --keyword=XPC:1,2,4c \ --add-comments=" i18n" \ --add-location=file \ --copyright-holder='Audacity Team' \ diff --git a/src/Internat.h b/src/Internat.h index e96bf8dff..31f529c81 100644 --- a/src/Internat.h +++ b/src/Internat.h @@ -32,7 +32,13 @@ extern AUDACITY_DLL_API const wxString& GetCustomSubstitution(const wxString& st // '&', preceding menu accelerators, should NOT occur in the argument. #define XO(s) (TranslatableString{ wxT(s), {} }) -// Marks strings for extraction only, where '&', preceding men accelerators, MAY +// Alternative taking a second context argument. A context is a string literal, +// which is not translated, but serves to disambiguate uses of the first string +// that might need differing translations, such as "Light" meaning not-heavy in +// one place but not-dark elsewhere. +#define XC(s, c) (TranslatableString{ wxT(s), {} }.Context(c)) + +// Marks strings for extraction only, where '&', preceding menu accelerators, MAY // occur. // For now, expands exactly as macro XO does, but in future there will be a // type distinction - for example XXO should be used for menu item names that @@ -86,6 +92,10 @@ extern AUDACITY_DLL_API const wxString& GetCustomSubstitution(const wxString& st #define XP(sing, plur, n) \ TranslatableString{ wxT(sing), {} }.Plural<(n)>( wxT(plur) ) +// Like XP but with an additional context argument, as for XC +#define XPC(sing, plur, n, c) \ + TranslatableString{ wxT(sing), {} }.Context(c).Plural<(n)>( wxT(plur) ) + #endif class Internat