mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-18 17:10:55 +02: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:
parent
5b77d19324
commit
9e70fa71ba
@ -373,7 +373,10 @@ public:
|
|||||||
default: {
|
default: {
|
||||||
bool debug = request == Request::DebugFormat;
|
bool debug = request == Request::DebugFormat;
|
||||||
return wxString::Format(
|
return wxString::Format(
|
||||||
TranslatableString::DoSubstitute( prevFormatter, str, debug ),
|
TranslatableString::DoSubstitute(
|
||||||
|
prevFormatter,
|
||||||
|
str, TranslatableString::DoGetContext( prevFormatter ),
|
||||||
|
debug ),
|
||||||
TranslatableString::TranslateArgument( args, debug )...
|
TranslatableString::TranslateArgument( args, debug )...
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -399,8 +402,11 @@ public:
|
|||||||
switch ( request ) {
|
switch ( request ) {
|
||||||
case Request::Context:
|
case Request::Context:
|
||||||
return context;
|
return context;
|
||||||
|
case Request::DebugFormat:
|
||||||
|
return DoSubstitute( {}, str, context, true );
|
||||||
|
case Request::Format:
|
||||||
default:
|
default:
|
||||||
return str;
|
return DoSubstitute( {}, str, context, false );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return *this;
|
return *this;
|
||||||
@ -477,9 +483,11 @@ private:
|
|||||||
|
|
||||||
static wxString DoGetContext( const Formatter &formatter );
|
static wxString DoGetContext( const Formatter &formatter );
|
||||||
static wxString DoSubstitute(
|
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
|
wxString DoFormat( bool debug ) const
|
||||||
{ return DoSubstitute( mFormatter, mMsgid, debug ); }
|
{ return DoSubstitute(
|
||||||
|
mFormatter, mMsgid, DoGetContext(mFormatter), debug ); }
|
||||||
|
|
||||||
static wxString DoChooseFormat(
|
static wxString DoChooseFormat(
|
||||||
const Formatter &formatter,
|
const Formatter &formatter,
|
||||||
|
@ -334,7 +334,10 @@ TranslatableString &TranslatableString::Strip( unsigned codes ) &
|
|||||||
default: {
|
default: {
|
||||||
bool debug = request == Request::DebugFormat;
|
bool debug = request == Request::DebugFormat;
|
||||||
auto result =
|
auto result =
|
||||||
TranslatableString::DoSubstitute( prevFormatter, str, debug );
|
TranslatableString::DoSubstitute(
|
||||||
|
prevFormatter,
|
||||||
|
str, TranslatableString::DoGetContext( prevFormatter ),
|
||||||
|
debug );
|
||||||
if ( codes & MenuCodes )
|
if ( codes & MenuCodes )
|
||||||
result = wxStripMenuCodes( result );
|
result = wxStripMenuCodes( result );
|
||||||
if ( codes & Ellipses ) {
|
if ( codes & Ellipses ) {
|
||||||
@ -357,13 +360,13 @@ wxString TranslatableString::DoGetContext( const Formatter &formatter )
|
|||||||
return formatter ? formatter( {}, Request::Context ) : wxString{};
|
return formatter ? formatter( {}, Request::Context ) : wxString{};
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString TranslatableString::DoSubstitute(
|
wxString TranslatableString::DoSubstitute( const Formatter &formatter,
|
||||||
const Formatter &formatter, const wxString &format, bool debug )
|
const wxString &format, const wxString &context, bool debug )
|
||||||
{
|
{
|
||||||
return formatter
|
return formatter
|
||||||
? formatter( format, debug ? Request::DebugFormat : Request::Format )
|
? formatter( format, debug ? Request::DebugFormat : Request::Format )
|
||||||
: // come here for most translatable strings, which have no formatting
|
: // come here for most translatable strings, which have no formatting
|
||||||
( debug ? format : wxGetTranslation( format ) );
|
( debug ? format : wxGetTranslation( format, wxString{}, context ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString TranslatableString::DoChooseFormat(
|
wxString TranslatableString::DoChooseFormat(
|
||||||
@ -404,7 +407,9 @@ TranslatableString &TranslatableString::Join(
|
|||||||
default: {
|
default: {
|
||||||
bool debug = request == Request::DebugFormat;
|
bool debug = request == Request::DebugFormat;
|
||||||
return
|
return
|
||||||
TranslatableString::DoSubstitute( prevFormatter, str, debug )
|
TranslatableString::DoSubstitute( prevFormatter,
|
||||||
|
str, TranslatableString::DoGetContext( prevFormatter ),
|
||||||
|
debug )
|
||||||
+ separator
|
+ separator
|
||||||
+ arg.DoFormat( debug );
|
+ arg.DoFormat( debug );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user