mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 09:20:16 +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:
committed by
James Crook
parent
5b77d19324
commit
9e70fa71ba
@@ -334,7 +334,10 @@ TranslatableString &TranslatableString::Strip( unsigned codes ) &
|
||||
default: {
|
||||
bool debug = request == Request::DebugFormat;
|
||||
auto result =
|
||||
TranslatableString::DoSubstitute( prevFormatter, str, debug );
|
||||
TranslatableString::DoSubstitute(
|
||||
prevFormatter,
|
||||
str, TranslatableString::DoGetContext( prevFormatter ),
|
||||
debug );
|
||||
if ( codes & MenuCodes )
|
||||
result = wxStripMenuCodes( result );
|
||||
if ( codes & Ellipses ) {
|
||||
@@ -357,13 +360,13 @@ wxString TranslatableString::DoGetContext( const Formatter &formatter )
|
||||
return formatter ? formatter( {}, Request::Context ) : wxString{};
|
||||
}
|
||||
|
||||
wxString TranslatableString::DoSubstitute(
|
||||
const Formatter &formatter, const wxString &format, bool debug )
|
||||
wxString TranslatableString::DoSubstitute( const Formatter &formatter,
|
||||
const wxString &format, const wxString &context, bool debug )
|
||||
{
|
||||
return formatter
|
||||
? formatter( format, debug ? Request::DebugFormat : Request::Format )
|
||||
: // come here for most translatable strings, which have no formatting
|
||||
( debug ? format : wxGetTranslation( format ) );
|
||||
( debug ? format : wxGetTranslation( format, wxString{}, context ) );
|
||||
}
|
||||
|
||||
wxString TranslatableString::DoChooseFormat(
|
||||
@@ -404,7 +407,9 @@ TranslatableString &TranslatableString::Join(
|
||||
default: {
|
||||
bool debug = request == Request::DebugFormat;
|
||||
return
|
||||
TranslatableString::DoSubstitute( prevFormatter, str, debug )
|
||||
TranslatableString::DoSubstitute( prevFormatter,
|
||||
str, TranslatableString::DoGetContext( prevFormatter ),
|
||||
debug )
|
||||
+ separator
|
||||
+ arg.DoFormat( debug );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user