From a2a0f9a177aa807eb191248e27ba276d1f56b345 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 24 May 2020 10:29:55 -0400 Subject: [PATCH 1/2] Don't put markup in translatable strings... ... Note that par1str and par2str aren't even shown, but comment out. Yet, I did the work on them to serve as examples for the future. Note the use of contexts too. Be aware of case distinctions that some languages make. --- src/AboutDialog.cpp | 49 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/src/AboutDialog.cpp b/src/AboutDialog.cpp index 20dca1132..076f5417d 100644 --- a/src/AboutDialog.cpp +++ b/src/AboutDialog.cpp @@ -319,18 +319,39 @@ void AboutDialog::PopulateAudacityPage( ShuttleGui & S ) "Audacity, which this is a customised version of, is a free program written by a worldwide team of [[https://www.audacityteam.org/about/credits|volunteers]]. \ Audacity is [[https://www.audacityteam.org/download|available]] for Windows, Mac, and GNU/Linux (and other Unix-like systems).") #else +/* Do the i18n of a string with markup carefully with hints. + (Remember languages with cases.) */ XO( -"Audacity is a free program written by a worldwide team of [[https://www.audacityteam.org/about/credits|volunteers]]. \ -Audacity is [[https://www.audacityteam.org/download|available]] for Windows, Mac, and GNU/Linux (and other Unix-like systems).") +/* i18n-hint: First %s will be "volunteers", second "available" */ +"Audacity is a free program written by a worldwide team of %s. \ +Audacity is %s for Windows, Mac, and GNU/Linux (and other Unix-like systems).") + .Format( + Verbatim("[[https://www.audacityteam.org/about/credits|%s]]") + /* i18n-hint: substitutes into "a worldwide team of %s" */ + .Format( XO("volunteers") ), + Verbatim("[[https://www.audacityteam.org/download|%s]]") + /* i18n-hint: substitutes into "Audacity is %s" */ + .Format( XO("available") ) ) #endif ; // This trick here means that the English language version won't mention using // English, whereas all translated versions will. auto par2Str = XO( -"If you find a bug or have a suggestion for us, please write, in English, to our [[https://forum.audacityteam.org/|forum]]. \ -For help, view the tips and tricks on our [[https://wiki.audacityteam.org/|wiki]] or \ -visit our [[https://forum.audacityteam.org/|forum]]."); +/* i18n-hint first and third %s will be "forum", second "wiki" */ +"If you find a bug or have a suggestion for us, please write, in English, to our %s. \ +For help, view the tips and tricks on our %s or \ +visit our %s.") + .Format( + Verbatim("[[https://forum.audacityteam.org/|%s]]") + /* i18n-hint substitutes into "write to our %s" */ + .Format( XC("forum", "dative") ), + Verbatim("[[https://wiki.audacityteam.org/|%s]]") + /* i18n-hint substitutes into "view the tips and tricks on our %s" */ + .Format( XO("wiki") ), + Verbatim("[[https://forum.audacityteam.org/|%s]]") + /* i18n-hint substitutes into "visit our %s" */ + .Format( XC("forum", "accusative") ) ); auto par2StrTranslated = par2Str.Translation(); if( par2StrTranslated == par2Str.MSGID().GET() ) @@ -366,7 +387,9 @@ visit our [[https://forum.audacityteam.org/|forum]]."); << wxT("    The name Audacity is a registered trademark of Dominic Mazzoni.

") #else - << XO("

Audacity ") + << XO("

") + << XO("Audacity") + << wxT(" ") << wxString(AUDACITY_VERSION_STRING) << wxT("

") << XO("Audacity the free, open source, cross-platform software for recording and editing sounds.") @@ -440,9 +463,19 @@ visit our [[https://forum.audacityteam.org/|forum]]."); #ifdef EXPERIMENTAL_DA << wxT("
DarkAudacity website: [[http://www.darkaudacity.com/|https://www.darkaudacity.com/]]") #else - << XO("


    Audacity® software is copyright © 1999-2018 Audacity Team.
") + << wxT("


    ") + /* i18n-hint Audacity's name substitutes for first %s */ + << XO("%s software is copyright %s 1999-2018 Audacity Team.") + .Format( + Verbatim("%s®").Format( XO("Audacity") ), + wxT("©") ) + << wxT("
") - << XO("    The name Audacity is a registered trademark of Dominic Mazzoni.

") + << wxT("    ") + /* i18n-hint Audacity's name substitutes for %s */ + << XO("The name %s is a registered trademark of Dominic Mazzoni.") + .Format( Verbatim("%s").Format( XO("Audacity") ) ) + << wxT("

") #endif << wxT("") From a54eaece033a69820dd1432b490ab7f3266c3c35 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 24 May 2020 10:56:01 -0400 Subject: [PATCH 2/2] Show the program name verbatim throughout AboutDialog.cpp --- src/AboutDialog.cpp | 50 ++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/src/AboutDialog.cpp b/src/AboutDialog.cpp index 076f5417d..7064d9965 100644 --- a/src/AboutDialog.cpp +++ b/src/AboutDialog.cpp @@ -74,6 +74,11 @@ hold information about one contributor to Audacity. #define REV_IDENT (XO("No revision identifier was provided").Translation()) #endif +// To substitute into many other translatable strings +static const auto ProgramName = + //XO("Audacity"); + Verbatim("Audacity"); + extern wxString FormatHtmlText( const wxString & Text ); void AboutDialog::CreateCreditsList() @@ -278,7 +283,8 @@ AboutDialog *AboutDialog::ActiveIntance() } AboutDialog::AboutDialog(wxWindow * parent) - : wxDialogWrapper(parent, -1, XO("About Audacity"), + /* i18n-hint: information about the program */ + : wxDialogWrapper(parent, -1, XO("About %s").Format( ProgramName ), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { @@ -322,13 +328,16 @@ Audacity is [[https://www.audacityteam.org/download|available]] for Windows, Mac /* Do the i18n of a string with markup carefully with hints. (Remember languages with cases.) */ XO( -/* i18n-hint: First %s will be "volunteers", second "available" */ -"Audacity is a free program written by a worldwide team of %s. \ -Audacity is %s for Windows, Mac, and GNU/Linux (and other Unix-like systems).") +/* i18n-hint: First and third %s will be the program's name, + second %s will be "volunteers", fourth "available" */ +"%s is a free program written by a worldwide team of %s. \ +%s is %s for Windows, Mac, and GNU/Linux (and other Unix-like systems).") .Format( + ProgramName, Verbatim("[[https://www.audacityteam.org/about/credits|%s]]") /* i18n-hint: substitutes into "a worldwide team of %s" */ .Format( XO("volunteers") ), + ProgramName, Verbatim("[[https://www.audacityteam.org/download|%s]]") /* i18n-hint: substitutes into "Audacity is %s" */ .Format( XO("available") ) ) @@ -388,11 +397,13 @@ visit our %s.") #else << XO("

") - << XO("Audacity") + << ProgramName << wxT(" ") << wxString(AUDACITY_VERSION_STRING) << wxT("

") - << XO("Audacity the free, open source, cross-platform software for recording and editing sounds.") + /* i18n-hint: The program's name substitutes for %s */ + << XO("%s the free, open source, cross-platform software for recording and editing sounds.") + .Format(ProgramName) #endif // << wxT("


") @@ -413,14 +424,17 @@ visit our %s.") #endif << wxT("

") - << XO("Audacity Team Members") + /* i18n-hint: The program's name substitutes for %s */ + << XO("%s Team Members").Format( ProgramName ) << wxT("
") << GetCreditsByRole(roleTeamMember) << wxT("

") << XO("Emeritus:") << wxT("
") - << XO("Distinguished Audacity Team members, not currently active") + /* i18n-hint: The program's name substitutes for %s */ + << XO("Distinguished %s Team members, not currently active") + .Format( ProgramName ) << wxT("

") << GetCreditsByRole(roleEmeritusTeam) @@ -446,7 +460,8 @@ visit our %s.") << wxT("

") << XO("Libraries") << wxT("
") - << XO("Audacity includes code from the following projects:") + /* i18n-hint: The program's name substitutes for %s */ + << XO("%s includes code from the following projects:").Format( ProgramName ) << wxT("

") << GetCreditsByRole(roleLibrary) @@ -456,7 +471,8 @@ visit our %s.") << GetCreditsByRole(roleThanks) << wxT("


") - << XO("Audacity website: ") + /* i18n-hint: The program's name substitutes for %s */ + << XO("%s website: ").Format( ProgramName ) << wxT("[[https://www.audacityteam.org/|https://www.audacityteam.org/]]") // DA: Link for DA url too @@ -464,24 +480,26 @@ visit our %s.") << wxT("
DarkAudacity website: [[http://www.darkaudacity.com/|https://www.darkaudacity.com/]]") #else << wxT("


    ") - /* i18n-hint Audacity's name substitutes for first %s */ - << XO("%s software is copyright %s 1999-2018 Audacity Team.") + /* i18n-hint Audacity's name substitutes for first and third %s, + and a "copyright" symbol for the second */ + << XO("%s software is copyright %s 1999-2018 %s Team.") .Format( - Verbatim("%s®").Format( XO("Audacity") ), - wxT("©") ) + Verbatim("%s®").Format( ProgramName ), + wxT("©"), + ProgramName ) << wxT("
") << wxT("    ") /* i18n-hint Audacity's name substitutes for %s */ << XO("The name %s is a registered trademark of Dominic Mazzoni.") - .Format( Verbatim("%s").Format( XO("Audacity") ) ) + .Format( Verbatim("%s").Format( ProgramName ) ) << wxT("

") #endif << wxT("") ; - auto pPage = S.StartNotebookPage( XO("Audacity") ); + auto pPage = S.StartNotebookPage( ProgramName ); S.StartVerticalLay(1); { //v For now, change to AudacityLogoWithName via old-fashioned way, not Theme.