Audacity 3.2.0
Classes | Public Types | Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
TranslatableString Class Reference

Holds a msgid for the translation catalog; may also bind format arguments. More...

#include <TranslatableString.h>

Collaboration diagram for TranslatableString:
[legend]

Classes

struct  PluralTemp
 

Public Types

enum  StripOptions : unsigned { MenuCodes = 0x1 , Ellipses = 0x2 }
 
using Formatter = std::function< wxString(const wxString &, Request) >
 A multi-purpose function, depending on the enum argument. More...
 

Public Member Functions

 TranslatableString ()
 
 TranslatableString (wxString str, Formatter formatter)
 
 TranslatableString (const TranslatableString &)=default
 
TranslatableStringoperator= (const TranslatableString &)=default
 
 TranslatableString (TranslatableString &&str)
 
TranslatableStringoperator= (TranslatableString &&str)
 
bool empty () const
 
Identifier MSGID () const
 MSGID is the English lookup key in the catalog, not necessarily for user's eyes if locale is some other. More...
 
wxString Translation () const
 
wxString Debug () const
 Format as an English string for debugging logs and developers' eyes, not for end users. More...
 
bool IsVerbatim () const
 Returns true if context is NullContextFormatter. More...
 
template<typename... Args>
TranslatableStringFormat (Args &&...args) &
 Capture variadic format arguments (by copy) when there is no plural. More...
 
template<typename... Args>
TranslatableString && Format (Args &&...args) &&
 
TranslatableStringContext (const wxString &context) &
 Choose a non-default and non-null disambiguating context for lookups. More...
 
TranslatableString && Context (const wxString &context) &&
 
TranslatableStringJoin (TranslatableString arg, const wxString &separator={}) &
 Append another translatable string. More...
 
TranslatableString && Join (TranslatableString arg, const wxString &separator={}) &&
 
TranslatableStringoperator+= (TranslatableString arg)
 
template<size_t N>
PluralTemp< N > Plural (const wxString &pluralStr) &&
 Implements the XP macro. More...
 
TranslatableStringStrip (unsigned options=MenuCodes) &
 
TranslatableString && Strip (unsigned options=MenuCodes) &&
 
TranslatableString Stripped (unsigned options=MenuCodes) const
 non-mutating, constructs another TranslatableString object More...
 
wxString StrippedTranslation () const
 

Static Public Attributes

static const TranslatableString Inaudible { wxT("\a") }
 A special string value that will have no screen reader pronunciation. More...
 

Private Types

enum class  Request { Context , Format , DebugFormat }
 

Private Member Functions

 TranslatableString (wxString str)
 Construct a TranslatableString that does no translation but passes str verbatim. More...
 
wxString DoFormat (bool debug) const
 

Static Private Member Functions

static wxString DoGetContext (const Formatter &formatter)
 
static wxString DoSubstitute (const Formatter &formatter, const wxString &format, const wxString &context, bool debug)
 
static wxString DoChooseFormat (const Formatter &formatter, const wxString &singular, const wxString &plural, unsigned nn, bool debug)
 
template<typename T >
static const T & TranslateArgument (const T &arg, bool)
 
template<typename T >
static auto TranslateArgument (const std::reference_wrapper< T > &arg, bool debug) -> decltype(TranslatableString::TranslateArgument(arg.get(), debug))
 This allows you to wrap arguments of Format in std::cref. More...
 
static wxString TranslateArgument (const TranslatableString &arg, bool debug)
 

Private Attributes

wxString mMsgid
 
Formatter mFormatter
 

Static Private Attributes

static const Formatter NullContextFormatter
 
static const wxChar *const NullContextName = wxT("*")
 

Friends

bool operator== (const TranslatableString &x, const TranslatableString &y)
 Warning: comparison of msgids only, which is not all of the information! More...
 
bool operator!= (const TranslatableString &x, const TranslatableString &y)
 
TranslatableString Verbatim (wxString str)
 Require calls to the one-argument constructor to go through this distinct global function name. More...
 

Detailed Description

Holds a msgid for the translation catalog; may also bind format arguments.

Different string-valued accessors for the msgid itself, and for the user-visible translation with substitution of captured format arguments. Also an accessor for format substitution into the English msgid, for debug- only outputs. The msgid should be used only in unusual cases and the translation more often

Implicit conversions to and from wxString are intentionally disabled

Definition at line 32 of file TranslatableString.h.

Member Typedef Documentation

◆ Formatter

using TranslatableString::Formatter = std::function< wxString(const wxString &, Request) >

A multi-purpose function, depending on the enum argument.

the string argument is unused in some cases If there is no function, defaults are empty context string, no plurals, and no substitutions

Definition at line 45 of file TranslatableString.h.

Member Enumeration Documentation

◆ Request

enum class TranslatableString::Request
strongprivate
Enumerator
Context 

return a disambiguating context string

Format 

Given the msgid, format the string for end users.

DebugFormat 

Given the msgid, format the string for developers.

Definition at line 215 of file TranslatableString.h.

215 {
216 Context,
217 Format,
218 DebugFormat,
219 };
TranslatableString & Context(const wxString &context) &
Choose a non-default and non-null disambiguating context for lookups.
TranslatableString & Format(Args &&...args) &
Capture variadic format arguments (by copy) when there is no plural.

◆ StripOptions

Translated strings may still contain menu hot-key codes (indicated by &) that wxWidgets interprets, and also trailing ellipses, that should be removed for other uses.

Enumerator
MenuCodes 
Ellipses 

Definition at line 188 of file TranslatableString.h.

188 : unsigned {
189 // Values to be combined with bitwise OR
190 MenuCodes = 0x1,
191 Ellipses = 0x2,
192 };

Constructor & Destructor Documentation

◆ TranslatableString() [1/5]

TranslatableString::TranslatableString ( )
inline

Definition at line 47 of file TranslatableString.h.

47{}

◆ TranslatableString() [2/5]

TranslatableString::TranslatableString ( wxString  str,
Formatter  formatter 
)
inlineexplicit

Supply {} for the second argument to cause lookup of the msgid with empty context string (default context) rather than the null context

Definition at line 51 of file TranslatableString.h.

52 : mFormatter{ std::move(formatter) }
53 {
54 mMsgid.swap( str );
55 }
#define str(a)

References str.

◆ TranslatableString() [3/5]

TranslatableString::TranslatableString ( const TranslatableString )
default

◆ TranslatableString() [4/5]

TranslatableString::TranslatableString ( TranslatableString &&  str)
inline

Definition at line 60 of file TranslatableString.h.

61 : mFormatter( std::move( str.mFormatter ) )
62 {
63 mMsgid.swap( str.mMsgid );
64 }

References str.

◆ TranslatableString() [5/5]

TranslatableString::TranslatableString ( wxString  str)
inlineexplicitprivate

Construct a TranslatableString that does no translation but passes str verbatim.

Definition at line 207 of file TranslatableString.h.

209 {
210 mMsgid.swap( str );
211 }
static const Formatter NullContextFormatter

References str.

Member Function Documentation

◆ Context() [1/2]

TranslatableString & TranslatableString::Context ( const wxString &  context) &
inline

Choose a non-default and non-null disambiguating context for lookups.

This is meant to be the first of chain-call modifications of the TranslatableString object; it will destroy any previously captured information

Definition at line 137 of file TranslatableString.h.

138 {
139 this->mFormatter = [context]
140 (const wxString &str, Request request) -> wxString {
141 switch ( request ) {
142 case Request::Context:
143 return context;
145 return DoSubstitute( {}, str, context, true );
146 case Request::Format:
147 default:
148 return DoSubstitute( {}, str, context, false );
149 }
150 };
151 return *this;
152 }
Class to construct the HTTP request.
@ Format
Given the msgid, format the string for end users.
@ DebugFormat
Given the msgid, format the string for developers.
@ Context
return a disambiguating context string
static wxString DoSubstitute(const Formatter &formatter, const wxString &format, const wxString &context, bool debug)

References str.

◆ Context() [2/2]

TranslatableString && TranslatableString::Context ( const wxString &  context) &&
inline

Definition at line 153 of file TranslatableString.h.

154 {
155 return std::move( Context( context ) );
156 }

◆ Debug()

wxString TranslatableString::Debug ( ) const
inline

Format as an English string for debugging logs and developers' eyes, not for end users.

Definition at line 82 of file TranslatableString.h.

82{ return DoFormat( true ); }
wxString DoFormat(bool debug) const

Referenced by CommandManager::Populator::NewIdentifier(), XMLFileReader::ParseBuffer(), Sequence::Paste(), AUPImportFileHandle::SetError(), and AUPImportFileHandle::SetWarning().

Here is the caller graph for this function:

◆ DoChooseFormat()

wxString TranslatableString::DoChooseFormat ( const Formatter formatter,
const wxString &  singular,
const wxString &  plural,
unsigned  nn,
bool  debug 
)
staticprivate

Definition at line 103 of file TranslatableString.cpp.

106{
107 // come here for translatable strings that choose among forms by number;
108 // if not debugging, then two keys are passed to an overload of
109 // wxGetTranslation, and also a number.
110 // Some languages might choose among more or fewer than two forms
111 // (e.g. Arabic has duals and Russian has complicated declension rules)
112 wxString context;
113 return ( debug || NullContextName == (context = DoGetContext(formatter)) )
114 ? ( nn == 1 ? singular : plural )
115 : wxGetTranslation(
116 singular, plural, nn
118 , wxString{} // domain
119 , context
120#endif
121 );
122}
#define HAS_I18N_CONTEXTS
Definition: Internat.h:163
static const wxChar *const NullContextName
static wxString DoGetContext(const Formatter &formatter)

References DoGetContext(), HAS_I18N_CONTEXTS, and NullContextName.

Referenced by TranslatableString::PluralTemp< N >::operator()().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoFormat()

wxString TranslatableString::DoFormat ( bool  debug) const
inlineprivate

Definition at line 228 of file TranslatableString.h.

229 { return DoSubstitute(

Referenced by TranslateArgument().

Here is the caller graph for this function:

◆ DoGetContext()

wxString TranslatableString::DoGetContext ( const Formatter formatter)
staticprivate

Definition at line 89 of file TranslatableString.cpp.

90{
91 return formatter ? formatter( {}, Request::Context ) : wxString{};
92}

References Context.

Referenced by DoChooseFormat(), Format(), IsVerbatim(), Join(), TranslatableString::PluralTemp< N >::operator()(), and Strip().

Here is the caller graph for this function:

◆ DoSubstitute()

wxString TranslatableString::DoSubstitute ( const Formatter formatter,
const wxString &  format,
const wxString &  context,
bool  debug 
)
staticprivate

Definition at line 94 of file TranslatableString.cpp.

96{
97 return formatter
98 ? formatter( format, debug ? Request::DebugFormat : Request::Format )
99 : // come here for most translatable strings, which have no formatting
100 ( debug ? format : wxGetTranslation( format, wxString{}, context ) );
101}

References DebugFormat, Format, and anonymous_namespace{ExportPCM.cpp}::format.

Referenced by Format(), Join(), and Strip().

Here is the caller graph for this function:

◆ empty()

bool TranslatableString::empty ( ) const
inline

Definition at line 72 of file TranslatableString.h.

72{ return mMsgid.empty(); }

Referenced by CommandMessageTarget::AddBool(), LispyCommandMessageTarget::AddBool(), AddedAnalysisTrack::AddedAnalysisTrack(), anonymous_namespace{MenuHelper.cpp}::AddGroupedEffectMenuItems(), CommandMessageTarget::AddItem(), LispyCommandMessageTarget::AddItem(), ShuttleGuiBase::AddPrompt(), anonymous_namespace{MenuHelper.cpp}::AddSortedEffectMenuItems(), ShuttleGuiBase::AddTitle(), ShuttleGuiBase::AddUnits(), BatchEvalCommand::Apply(), ShuttleGuiBase::ApplyItem(), MacroCommands::ApplyMacro(), ApplyMacroDialog::ApplyMacroToProject(), ProgressDialog::Beep(), anonymous_namespace{ClipMenus.cpp}::ClipBoundaryMessage(), MessageBoxException::DelayedHandlerAction(), CommandManager::DescribeCommandsAndShortcuts(), EffectUIServices::DoMessageBox(), EQUtils::DoMessageBox(), anonymous_namespace{ClipMenus.cpp}::DoSelectClip(), anonymous_namespace{Registry.cpp}::CollectedItems::Find(), anonymous_namespace{ProjectFileManager.cpp}::FindHelpUrl(), VSTWrapper::ForEachParameter(), WaveTrack::GetDefaultAudioTrackNamePreference(), MenuRegistry::MenuItems::GetOrdering(), PopupSubMenu::GetProperties(), EffectDefinitionInterface::GetSquashedName(), LWSlider::GetTip(), LWSlider::GetWidestTips(), CellularPanel::HandleMotion(), Importer::Import(), ProjectFileManager::Import(), AUPImportFileHandle::Import(), MP3Exporter::LoadLibrary(), AudacityCommand::MessageBox(), MessageBoxException::MessageBoxException(), ModifiedAnalysisTrack::ModifiedAnalysisTrack(), EffectUIHost::OnMenu(), PluginRegistrationDialog::OnOK(), EqualizationCurvesDialog::OnRename(), EffectUIHost::OnSaveAs(), AudacityApp::OnTimer(), AudioUnitWrapper::ParameterInfo::ParameterInfo(), anonymous_namespace{PopupMenuTable.cpp}::PopupMenuBuilder::PopupMenuBuilder(), SelectHandle::Preview(), NyquistEffect::ProcessOne(), ExportFFmpegOptions::SavePreset(), DBConnection::SetDBError(), AUPImportFileHandle::SetError(), DBConnection::SetError(), ProgressDialog::SetMessage(), anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::SetPrefix(), ProjectFileIO::SetProjectTitle(), Tags::SetTag(), AUPImportFileHandle::SetWarning(), MixerBoardFrame::SetWindowTitle(), CommandMessageTarget::StartField(), ShuttleGuiBase::StartStatic(), NumericConverter::UpdateFormatter(), ExportAudioDialog::UpdateLabelExportSettings(), RealtimeEffectStateUI::UpdateTitle(), anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::UpdateUI(), UserPresetsGroup(), VerifyFilename(), and anonymous_namespace{Registry.cpp}::VisitItems().

◆ Format() [1/2]

template<typename... Args>
TranslatableString & TranslatableString::Format ( Args &&...  args) &
inline

Capture variadic format arguments (by copy) when there is no plural.

The substitution is computed later in a call to Translate() after msgid is looked up in the translation catalog. Any format arguments that are also of type TranslatableString will be translated too at substitution time, for non-debug formatting

Definition at line 103 of file TranslatableString.h.

104 {
105 auto prevFormatter = mFormatter;
106 this->mFormatter = [prevFormatter, args...]
107 (const wxString &str, Request request) -> wxString {
108 switch ( request ) {
109 case Request::Context:
110 return TranslatableString::DoGetContext( prevFormatter );
111 case Request::Format:
113 default: {
114 bool debug = request == Request::DebugFormat;
115 return wxString::Format(
117 prevFormatter,
118 str, TranslatableString::DoGetContext( prevFormatter ),
119 debug ),
121 );
122 }
123 }
124 };
125 return *this;
126 }
static const T & TranslateArgument(const T &arg, bool)

References DoGetContext(), DoSubstitute(), str, and TranslateArgument().

Referenced by EqualizationBandSliders::AddBandSliders(), CommandManager::DescribeCommandsAndShortcuts(), TrackUtilities::DoMoveTrack(), anonymous_namespace{Contrast.cpp}::FormatRMSMessage(), CommandManager::GetPrefixedLabelFromName(), LWSlider::GetTip(), ThemeBase::LoadOneThemeComponents(), KeyConfigPrefs::OnSet(), PitchName_Absolute(), AboutDialog::PopulateInformationPage(), EffectScienFilter::PopulateOrExchange(), NyquistEffect::Process(), ControlToolBar::StateForStatusBar(), and anonymous_namespace{WaveTrackControls.cpp}::Status1DrawFunction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Format() [2/2]

template<typename... Args>
TranslatableString && TranslatableString::Format ( Args &&...  args) &&
inline

Definition at line 128 of file TranslatableString.h.

129 {
130 return std::move( Format( std::forward<Args>(args)... ) );
131 }

◆ IsVerbatim()

bool TranslatableString::IsVerbatim ( ) const

Returns true if context is NullContextFormatter.

Definition at line 36 of file TranslatableString.cpp.

37{
39}

References DoGetContext(), mFormatter, and NullContextName.

Here is the call graph for this function:

◆ Join() [1/2]

TranslatableString & TranslatableString::Join ( TranslatableString  arg,
const wxString &  separator = {} 
) &

Append another translatable string.

lookup of msgids for this and for the argument are both delayed until Translate() is invoked on this, and then the formatter concatenates the translations

Definition at line 124 of file TranslatableString.cpp.

126{
127 auto prevFormatter = mFormatter;
128 mFormatter =
129 [prevFormatter,
130 arg /* = std::move( arg ) */,
131 separator](const wxString &str, Request request)
132 -> wxString {
133 switch ( request ) {
134 case Request::Context:
135 return TranslatableString::DoGetContext( prevFormatter );
136 case Request::Format:
138 default: {
139 bool debug = request == Request::DebugFormat;
140 return
142 str, TranslatableString::DoGetContext( prevFormatter ),
143 debug )
144 + separator
145 + arg.DoFormat( debug );
146 }
147 }
148 };
149 return *this;
150}

References DoGetContext(), DoSubstitute(), and str.

Referenced by MacroCommandsCatalog::MacroCommandsCatalog(), PluginRegistrationDialog::OnOK(), SelectHandle::Preview(), PrefsDialog::ShowModal(), EffectDistortion::Editor::UpdateControl(), and TrackPanel::UpdateStatusMessage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Join() [2/2]

TranslatableString && TranslatableString::Join ( TranslatableString  arg,
const wxString &  separator = {} 
) &&
inline

Definition at line 164 of file TranslatableString.h.

165 {} ) &&
166 { return std::move( Join( std::move(arg), separator ) ); }
TranslatableString & Join(TranslatableString arg, const wxString &separator={}) &
Append another translatable string.

◆ MSGID()

Identifier TranslatableString::MSGID ( ) const

MSGID is the English lookup key in the catalog, not necessarily for user's eyes if locale is some other.

The MSGID might not be all the information TranslatableString holds. This is a deliberately ugly-looking function name. Use with caution.

Definition at line 17 of file TranslatableString.cpp.

18{
19 return Identifier{ mMsgid };
20}
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22

References mMsgid.

Referenced by anonymous_namespace{ProjectFileManager.cpp}::FindHelpUrl(), CommandManager::Populator::NewIdentifier(), and AudioUnitEffectOptionsDialog::OnOk().

Here is the caller graph for this function:

◆ operator+=()

TranslatableString & TranslatableString::operator+= ( TranslatableString  arg)
inline

Definition at line 168 of file TranslatableString.h.

169 {
170 Join( std::move( arg ) );
171 return *this;
172 }

◆ operator=() [1/2]

TranslatableString & TranslatableString::operator= ( const TranslatableString )
default

◆ operator=() [2/2]

TranslatableString & TranslatableString::operator= ( TranslatableString &&  str)
inline

Definition at line 65 of file TranslatableString.h.

66 {
67 mFormatter = std::move( str.mFormatter );
68 mMsgid.swap( str.mMsgid );
69 return *this;
70 }

References str.

◆ Plural()

template<size_t N>
PluralTemp< N > TranslatableString::Plural ( const wxString &  pluralStr) &&
inline

Implements the XP macro.

That macro specifies a second msgid, a list of format arguments, and which of those format arguments selects among messages; the translated strings to select among, depending on language, might actually be more or fewer than two. See Internat.h.

Definition at line 180 of file TranslatableString.h.

181 {
182 return PluralTemp< N >{ *this, pluralStr };
183 }

◆ Strip() [1/2]

TranslatableString & TranslatableString::Strip ( unsigned  options = MenuCodes) &

Definition at line 41 of file TranslatableString.cpp.

42{
43 auto prevFormatter = mFormatter;
44 mFormatter = [prevFormatter, codes]
45 ( const wxString & str, TranslatableString::Request request ) -> wxString {
46 switch ( request ) {
48 return TranslatableString::DoGetContext( prevFormatter );
49 case Request::Format:
51 default: {
52 bool debug = request == Request::DebugFormat;
53 auto result =
55 prevFormatter,
56 str, TranslatableString::DoGetContext( prevFormatter ),
57 debug );
58 if ( codes & MenuCodes ) {
59 // Don't use this, it's in wxCore
60 // result = wxStripMenuCodes( result );
61 decltype( result ) temp;
62 temp.swap(result);
63 for ( auto iter = temp.begin(), end = temp.end();
64 iter != end; ++iter ) {
65 // Stop at trailing hot key name
66 if ( *iter == '\t' )
67 break;
68 // Strip & (unless escaped by another preceding &)
69 if ( *iter == '&' && ++iter == end )
70 break;
71 result.append( 1, *iter );
72 }
73 }
74 if ( codes & Ellipses ) {
75 if (result.EndsWith(wxT("...")))
76 result = result.Left( result.length() - 3 );
77 // Also check for the single-character Unicode ellipsis
78 else if (result.EndsWith(wxT("\u2026")))
79 result = result.Left( result.length() - 1 );
80 }
81 return result;
82 }
83 }
84 };
85
86 return *this;
87}
wxT("CloseDown"))
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159

References DoGetContext(), DoSubstitute(), PackedArray::end(), str, and wxT().

Referenced by MacroCommandsCatalog::MacroCommandsCatalog(), KeyView::RefreshBindings(), and Stripped().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Strip() [2/2]

TranslatableString && TranslatableString::Strip ( unsigned  options = MenuCodes) &&
inline

Definition at line 194 of file TranslatableString.h.

195 { return std::move( Strip( options ) ); }
TranslatableString & Strip(unsigned options=MenuCodes) &

◆ Stripped()

TranslatableString TranslatableString::Stripped ( unsigned  options = MenuCodes) const
inline

non-mutating, constructs another TranslatableString object

Definition at line 198 of file TranslatableString.h.

199 { return TranslatableString{ *this }.Strip( options ); }
Holds a msgid for the translation catalog; may also bind format arguments.

References Strip().

Referenced by ShuttleGuiBase::AddCheckBoxOnRight(), ShuttleGuiBase::AddChoice(), BatchEvalCommand::Apply(), ShuttleGuiBase::ApplyItem(), MacroCommands::ApplyMacro(), CommandManager::GetPrefixedLabelFromName(), CommandManager::Populator::NewIdentifier(), ControlToolBar::Populate(), SnappingToolBar::Populate(), AButton::SetLabel(), wxPanelWrapper::SetToolTip(), AButton::SetToolTip(), Grabber::SetToolTip(), AdornedRulerPanel::ShowMenu(), and ComponentInterfaceSymbol::Stripped().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StrippedTranslation()

wxString TranslatableString::StrippedTranslation ( ) const
inline

Definition at line 201 of file TranslatableString.h.

201{ return Stripped().Translation(); }
wxString Translation() const
TranslatableString Stripped(unsigned options=MenuCodes) const
non-mutating, constructs another TranslatableString object

Referenced by ShuttleGuiBase::AddChoice(), and ShuttleGui::SetMinSize().

Here is the caller graph for this function:

◆ TranslateArgument() [1/3]

template<typename T >
static auto TranslatableString::TranslateArgument ( const std::reference_wrapper< T > &  arg,
bool  debug 
) -> decltype( TranslatableString::TranslateArgument( arg.get(), debug ) )
inlinestaticprivate

This allows you to wrap arguments of Format in std::cref.

(So that they are captured (as if) by reference rather than by value)

Definition at line 240 of file TranslatableString.h.

244 { return TranslatableString::TranslateArgument( arg.get(), debug ); }

References TranslateArgument().

Here is the call graph for this function:

◆ TranslateArgument() [2/3]

template<typename T >
static const T & TranslatableString::TranslateArgument ( const T &  arg,
bool   
)
inlinestaticprivate

Definition at line 236 of file TranslatableString.h.

237 { return arg; }

Referenced by Format(), TranslatableString::PluralTemp< N >::operator()(), and TranslateArgument().

Here is the caller graph for this function:

◆ TranslateArgument() [3/3]

static wxString TranslatableString::TranslateArgument ( const TranslatableString arg,
bool  debug 
)
inlinestaticprivate

Definition at line 245 of file TranslatableString.h.

246 { return arg.DoFormat( debug ); }

References DoFormat().

Here is the call graph for this function:

◆ Translation()

wxString TranslatableString::Translation ( ) const
inline

Definition at line 79 of file TranslatableString.h.

79{ return DoFormat( false ); }

Referenced by ShuttleGuiBase::AddButton(), ShuttleGuiBase::AddCheckBox(), ShuttleGuiBase::AddCheckBoxOnRight(), ShuttleGuiBase::AddChoice(), ShuttleGuiBase::AddCombo(), ShuttleGuiBase::AddConstTextBox(), anonymous_namespace{MenuHelper.cpp}::AddEffectMenuItemGroup(), ShuttleGuiBase::AddFixedText(), ShuttleGuiBase::AddNumericTextBox(), ShuttleGuiBase::AddPrompt(), ShuttleGuiBase::AddReadOnlyText(), ShuttleGuiBase::AddSlider(), ShuttleGuiBase::AddSpinCtrl(), ShuttleGuiBase::AddTextBox(), ShuttleGuiBase::AddTitle(), ShuttleGuiBase::AddUnits(), ShuttleGuiBase::AddVariableText(), MacroCommands::ApplyCommand(), ShuttleGuiBase::ApplyItem(), ASlider::ASlider(), AudacityMessageBox(), LV2Editor::BuildPlain(), ProgressDialog::Create(), FileDialogWrapper::Create(), wxDialogWrapper::Create(), wxPanelWrapper::Create(), ShuttleGuiBase::DoAddRadioButton(), HistoryDialog::DoUpdate(), CommandManager::CommandListEntry::FormatLabelForMenu(), EffectDistortion::GetFactoryPresets(), EffectEqualization::GetFactoryPresets(), EffectReverb::GetFactoryPresets(), anonymous_namespace{SnappingToolBar.cpp}::SnapModePopup::GetStringValue(), NyquistEffect::GetVersion(), CellularPanel::HandleMotion(), ImportStreamDialog::ImportStreamDialog(), MacroCommandsCatalog::MacroCommandsCatalog(), TrackPanelAx::MessageForScreenReader(), MultiDialog::MultiDialog(), TimerRecordDialog::NewPathControl(), DependencyDialog::OnCopyToClipboard(), LinkingHtmlWindow::OnLinkClicked(), TipWindow::OnPaint(), anonymous_namespace{SnappingToolBar.cpp}::SnapModePopup::OnPopup(), DirectoriesPrefs::OnTempText(), FrequencyPlotDialog::PlotPaint(), SnappingToolBar::Populate(), TranscriptionToolBar::Populate(), AccessibleLinksFormatter::Populate(), LabelDialog::PopulateLabels(), DependencyDialog::PopulateList(), TagsEditorDialog::PopulateOrExchange(), LV2Effect::PopulateUI(), anonymous_namespace{PopupMenuTable.cpp}::PopupMenuBuilder::PopupMenuBuilder(), NyquistEffect::Process(), NyquistEffect::ProcessOne(), UndoManager::PushState(), anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectsMenuVisitor::RealtimeEffectsMenuVisitor(), KeyView::RefreshBindings(), SelectFile(), ProjectStatus::Set(), Importer::SetDefaultOpenType(), wxPanelWrapper::SetLabel(), AButton::SetLabel(), wxDialogWrapper::SetLabel(), Importer::SetLastOpenType(), ProgressDialog::SetMessage(), wxPanelWrapper::SetName(), NumericTextCtrl::SetName(), wxDialogWrapper::SetName(), anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::SetPrefix(), ProjectManager::SetStatusText(), wxPanelWrapper::SetToolTip(), AButton::SetToolTip(), Grabber::SetToolTip(), ReadOnlyText::SetValue(), AdornedRulerPanel::ShowMenu(), anonymous_namespace{SnappingToolBar.cpp}::SnapModePopup::SnapModePopup(), ShuttleGuiBase::StartStatic(), anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieCheckBox(), anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieCheckBoxOnRight(), anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieChoice(), anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieIntegerTextBox(), anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieNumberAsChoice(), anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieNumericTextBox(), anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieSlider(), anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieSpinCtrl(), anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieTextBox(), TipWindow::TipWindow(), TagsEditorDialog::TransferDataToWindow(), TranslationLess(), NyquistEffect::UnQuote(), EffectDistortion::Editor::UpdateControl(), and EffectCompressor::UpdateUI().

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const TranslatableString x,
const TranslatableString y 
)
friend

Definition at line 90 of file TranslatableString.h.

92 { return !(x == y); }

◆ operator==

bool operator== ( const TranslatableString x,
const TranslatableString y 
)
friend

Warning: comparison of msgids only, which is not all of the information!

This operator makes it easier to define a std::unordered_map on TranslatableStrings

Definition at line 86 of file TranslatableString.h.

88 { return x.mMsgid == y.mMsgid; }

◆ Verbatim

TranslatableString Verbatim ( wxString  str)
friend

Require calls to the one-argument constructor to go through this distinct global function name.

This makes it easier to locate and review the uses of this function, separately from the uses of the type.

Definition at line 321 of file TranslatableString.h.

322{ return TranslatableString( std::move( str ) ); }

Member Data Documentation

◆ Inaudible

const TranslatableString TranslatableString::Inaudible { wxT("\a") }
static

A special string value that will have no screen reader pronunciation.

Definition at line 38 of file TranslatableString.h.

Referenced by EffectPanel::EffectPanel().

◆ mFormatter

Formatter TranslatableString::mFormatter
private

◆ mMsgid

wxString TranslatableString::mMsgid
private

Definition at line 285 of file TranslatableString.h.

Referenced by MSGID().

◆ NullContextFormatter

const TranslatableString::Formatter TranslatableString::NullContextFormatter
staticprivate
Initial value:
{
[](const wxString & str, TranslatableString::Request request) -> wxString {
switch ( request ) {
default:
return str;
}
}
}

Definition at line 204 of file TranslatableString.h.

◆ NullContextName

const wxChar *const TranslatableString::NullContextName = wxT("*")
staticprivate

Definition at line 221 of file TranslatableString.h.

Referenced by DoChooseFormat(), and IsVerbatim().


The documentation for this class was generated from the following files: