1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-02 06:40:12 +01:00

Issue 887: Some strings didn't translate, though in catalogs...

... What they had in common was the use of the XC macro to specify a
disambiguating context string.  Example: "Interface" page of preferences.

TranslatableString had not implemented this
correctly except in the less usual case of plurals.
This commit is contained in:
Paul Licameli
2021-05-12 23:50:49 -04:00
committed by James Crook
parent 5b77d19324
commit 9e70fa71ba
2 changed files with 22 additions and 9 deletions

View File

@@ -373,7 +373,10 @@ public:
default: {
bool debug = request == Request::DebugFormat;
return wxString::Format(
TranslatableString::DoSubstitute( prevFormatter, str, debug ),
TranslatableString::DoSubstitute(
prevFormatter,
str, TranslatableString::DoGetContext( prevFormatter ),
debug ),
TranslatableString::TranslateArgument( args, debug )...
);
}
@@ -399,8 +402,11 @@ public:
switch ( request ) {
case Request::Context:
return context;
case Request::DebugFormat:
return DoSubstitute( {}, str, context, true );
case Request::Format:
default:
return str;
return DoSubstitute( {}, str, context, false );
}
};
return *this;
@@ -477,9 +483,11 @@ private:
static wxString DoGetContext( const Formatter &formatter );
static wxString DoSubstitute(
const Formatter &formatter, const wxString &format, bool debug );
const Formatter &formatter,
const wxString &format, const wxString &context, bool debug );
wxString DoFormat( bool debug ) const
{ return DoSubstitute( mFormatter, mMsgid, debug ); }
{ return DoSubstitute(
mFormatter, mMsgid, DoGetContext(mFormatter), debug ); }
static wxString DoChooseFormat(
const Formatter &formatter,