1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

TranslatableString has + and +=, and translation of Format arguments

This commit is contained in:
Paul Licameli
2019-12-06 10:43:34 -05:00
parent d63b5b4bfa
commit 94fc1bb2a8
2 changed files with 36 additions and 3 deletions

View File

@@ -240,7 +240,7 @@ bool Internat::SanitiseFilename(wxString &name, const wxString &sub)
// Special Mac stuff
// '/' is permitted in file names as seen in dialogs, even though it is
// the path separator. The "real" filename as seen in the terminal has ':'.
// Do NOT return true if this is the only subsitution.
// Do NOT return true if this is the only substitution.
name.Replace(wxT("/"), wxT(":"));
#endif
@@ -325,3 +325,17 @@ wxString TranslatableString::Translation() const
return result;
}
TranslatableString &TranslatableString::operator +=(
const TranslatableString &arg )
{
auto prevFormatter = mFormatter;
mFormatter = [prevFormatter, arg](const wxString &str){
if (str.empty())
return prevFormatter ? prevFormatter({}) : wxString{};
else
return (prevFormatter ? prevFormatter(str) : str)
+ arg.Translation();
};
return *this;
}