Audacity  3.0.3
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  Request { Request::Context, Request::Format, Request::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 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  };

◆ 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  }

◆ 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  }

◆ 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  }

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  }

◆ 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 ); }

Referenced by CommandManager::NewIdentifier(), XMLFileReader::ParseString(), 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 }

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 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(), Effect::AddedAnalysisTrack::AddedAnalysisTrack(), anonymous_namespace{PluginMenus.cpp}::AddEffectMenuItems(), CommandMessageTarget::AddItem(), LispyCommandMessageTarget::AddItem(), ShuttleGuiBase::AddPrompt(), ShuttleGuiBase::AddTitle(), ShuttleGuiBase::AddUnits(), BatchEvalCommand::Apply(), ShuttleGuiBase::ApplyItem(), MacroCommands::ApplyMacro(), ApplyMacroDialog::ApplyMacroToProject(), ProgressDialog::Beep(), anonymous_namespace{ClipMenus.cpp}::ClipBoundaryMessage(), MessageBoxException::DelayedHandlerAction(), CommandManager::DescribeCommandsAndShortcuts(), anonymous_namespace{ClipMenus.cpp}::DoSelectClip(), Ruler::Draw(), ExportMultipleDialog::ExportMultipleByLabel(), anonymous_namespace{Registry.cpp}::CollectedItems::Find(), anonymous_namespace{ProjectFileManager.cpp}::FindHelpUrl(), VSTEffect::GetAutomationParameters(), TracksPrefs::GetDefaultAudioTrackNamePreference(), CommandManager::GetPrefixedLabelFromName(), Effect::GetSquashedName(), LWSlider::GetTip(), Effect::GetUserPresetsGroup(), LWSlider::GetWidestTips(), CellularPanel::HandleMotion(), Importer::Import(), ProjectFileManager::Import(), AUPImportFileHandle::Import(), Ruler::TickSizes::LabelString(), AudacityCommand::MessageBox(), Effect::MessageBox(), Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack(), CommandManager::NewIdentifier(), EffectUIHost::OnMenu(), PluginRegistrationDialog::OnOK(), EditCurvesDialog::OnRename(), EffectUIHost::OnSaveAs(), AudacityApp::OnTimer(), SelectHandle::Preview(), NyquistEffect::ProcessOne(), ExportFFmpegOptions::SavePreset(), VSTEffect::SetAutomationParameters(), DBConnection::SetDBError(), AUPImportFileHandle::SetError(), DBConnection::SetError(), ProgressDialog::SetMessage(), anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::SetPrefix(), ProjectFileIO::SetProjectTitle(), AUPImportFileHandle::SetWarning(), LyricsWindow::SetWindowTitle(), MixerBoardFrame::SetWindowTitle(), SpinSliderHandlers(), CommandMessageTarget::StartField(), ShuttleGuiBase::StartStatic(), EffectReverb::Startup(), anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::UpdateUI(), 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 ),
120  TranslatableString::TranslateArgument( args, debug )...
121  );
122  }
123  }
124  };
125  return *this;
126  }

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

Referenced by CommandManager::DescribeCommandsAndShortcuts(), TrackUtilities::DoMoveTrack(), anonymous_namespace{Contrast.cpp}::FormatRMSMessage(), CommandManager::GetPrefixedLabelFromName(), LWSlider::GetTip(), KeyConfigPrefs::OnSet(), PitchName_Absolute(), EffectEqualization::PopulateOrExchange(), EffectScienFilter::PopulateOrExchange(), NyquistEffect::Process(), ShowExportErrorDialog(), 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
141  TranslatableString::DoSubstitute( prevFormatter,
142  str, TranslatableString::DoGetContext( prevFormatter ),
143  debug )
144  + separator
145  + arg.DoFormat( debug );
146  }
147  }
148  };
149  return *this;
150 }

References DoGetContext(), and DoSubstitute().

Referenced by MacroCommandsCatalog::MacroCommandsCatalog(), PluginRegistrationDialog::OnOK(), SelectHandle::Preview(), PrefsDialog::ShowModal(), EffectDistortion::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 ) ); }

◆ 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 }

References mMsgid.

Referenced by ComponentInterfaceSymbol::ComponentInterfaceSymbol(), anonymous_namespace{ProjectFileManager.cpp}::FindHelpUrl(), CommandManager::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  }

◆ 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 ) {
47  case Request::Context:
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 }

References DoGetContext(), and DoSubstitute().

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 ) ); }

◆ 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 ); }

References Strip().

Referenced by ShuttleGuiBase::AddCheckBoxOnRight(), ShuttleGuiBase::AddChoice(), BatchEvalCommand::Apply(), ShuttleGuiBase::ApplyItem(), MacroCommands::ApplyMacro(), CommandManager::GetPrefixedLabelFromName(), CommandManager::HandleCommandEntry(), CommandManager::NewIdentifier(), AButton::SetLabel(), AButton::SetToolTip(), Grabber::SetToolTip(), wxPanelWrapper::SetToolTip(), 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(); }

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{PluginMenus.cpp}::AddEffectMenuItemGroup(), ShuttleGuiBase::AddFixedText(), MousePrefs::AddItem(), ShuttleGuiBase::AddNumericTextBox(), ShuttleGuiBase::AddPrompt(), ShuttleGuiBase::AddReadOnlyText(), ShuttleGuiBase::AddSlider(), ShuttleGuiBase::AddSpinCtrl(), ShuttleGuiBase::AddTextBox(), ShuttleGuiBase::AddTitle(), SelectionBar::AddTitle(), ShuttleGuiBase::AddUnits(), ShuttleGuiBase::AddVariableText(), MacroCommands::ApplyCommand(), ShuttleGuiBase::ApplyItem(), ASlider::ASlider(), AudacityMessageBox(), VSTEffectsModule::Check(), ProgressDialog::Create(), FileDialogWrapper::Create(), wxDialogWrapper::Create(), wxPanelWrapper::Create(), ShuttleGuiBase::DoAddRadioButton(), HistoryDialog::DoUpdate(), CommandManager::EndMainMenu(), CommandManager::EndSubMenu(), CommandManager::FormatLabelForMenu(), CommandManager::FormatLabelWithDisabledAccel(), EffectDistortion::GetFactoryPresets(), EffectEqualization::GetFactoryPresets(), EffectReverb::GetFactoryPresets(), NyquistEffect::GetVersion(), CellularPanel::HandleMotion(), ImportStreamDialog::ImportStreamDialog(), ExportMP3Options::LoadNames(), MacroCommandsCatalog::MacroCommandsCatalog(), MixerBoard::MakeButtonBitmap(), TrackPanelAx::MessageForScreenReader(), MultiDialog::MultiDialog(), anonymous_namespace{wxWidgetsBasicUI.cpp}::MyGenericProgress::MyGenericProgress(), TimerRecordDialog::NewPathControl(), DependencyDialog::OnCopyToClipboard(), LinkingHtmlWindow::OnLinkClicked(), EffectUIHost::OnMenu(), TipWindow::OnPaint(), DirectoriesPrefs::OnTempText(), operator<<(), NumericConverter::ParseFormatString(), FrequencyPlotDialog::PlotPaint(), SelectionBar::Populate(), TranscriptionToolBar::Populate(), AccessibleLinksFormatter::Populate(), LabelDialog::PopulateLabels(), DependencyDialog::PopulateList(), TagsEditorDialog::PopulateOrExchange(), BenchmarkDialog::Printf(), NyquistEffect::Process(), NyquistEffect::ProcessOne(), UndoManager::PushState(), KeyView::RefreshBindings(), CommandManager::RemoveDuplicateShortcuts(), ProjectStatus::Set(), Importer::SetDefaultOpenType(), AButton::SetLabel(), wxPanelWrapper::SetLabel(), wxDialogWrapper::SetLabel(), Importer::SetLastOpenType(), ProgressDialog::SetMessage(), NumericTextCtrl::SetName(), wxPanelWrapper::SetName(), wxDialogWrapper::SetName(), anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::SetPrefix(), ProjectManager::SetStatusText(), AButton::SetToolTip(), Grabber::SetToolTip(), wxPanelWrapper::SetToolTip(), ReadOnlyText::SetValue(), HelpSystem::ShowHtmlText(), ShuttleGuiBase::StartNotebookPage(), ShuttleGuiBase::StartStatic(), ComponentInterfaceSymbol::StrippedTranslation(), 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(), ComponentInterfaceSymbol::Translation(), NyquistEffect::UnQuote(), EffectDistortion::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 EffectUIHost::BuildButtonBar(), and EffectPanel::EffectPanel().

◆ mFormatter

Formatter TranslatableString::mFormatter
private

◆ mMsgid

wxString TranslatableString::mMsgid
private

Definition at line 285 of file TranslatableString.h.

Referenced by MSGID(), and std::hash< TranslatableString >::operator()().

◆ 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:
TranslatableString::Request::Format
@ Format
Given the msgid, format the string for end users.
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
TranslatableString::DoGetContext
static wxString DoGetContext(const Formatter &formatter)
Definition: TranslatableString.cpp:89
TranslatableString::Context
TranslatableString & Context(const wxString &context) &
Choose a non-default and non-null disambiguating context for lookups.
Definition: TranslatableString.h:137
TranslatableString::Ellipses
@ Ellipses
Definition: TranslatableString.h:191
TranslatableString::Request
Request
Definition: TranslatableString.h:215
TranslatableString::NullContextFormatter
static const Formatter NullContextFormatter
Definition: TranslatableString.h:204
TranslatableString::Request::Context
@ Context
return a disambiguating context string
Identifier
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
TranslatableString::Strip
TranslatableString & Strip(unsigned options=MenuCodes) &
Definition: TranslatableString.cpp:41
TranslatableString::DoFormat
wxString DoFormat(bool debug) const
Definition: TranslatableString.h:228
TranslatableString::mFormatter
Formatter mFormatter
Definition: TranslatableString.h:286
TranslatableString::DoSubstitute
static wxString DoSubstitute(const Formatter &formatter, const wxString &format, const wxString &context, bool debug)
Definition: TranslatableString.cpp:94
TranslatableString::TranslateArgument
static const T & TranslateArgument(const T &arg, bool)
Definition: TranslatableString.h:236
format
int format
Definition: ExportPCM.cpp:56
HAS_I18N_CONTEXTS
#define HAS_I18N_CONTEXTS
Definition: Internat.h:165
TranslatableString::Request::DebugFormat
@ DebugFormat
Given the msgid, format the string for developers.
TranslatableString::TranslatableString
TranslatableString()
Definition: TranslatableString.h:47
TranslatableString::MenuCodes
@ MenuCodes
Definition: TranslatableString.h:190
TranslatableString::mMsgid
wxString mMsgid
Definition: TranslatableString.h:285
TranslatableString::Translation
wxString Translation() const
Definition: TranslatableString.h:79
TranslatableString::Format
TranslatableString & Format(Args &&...args) &
Capture variadic format arguments (by copy) when there is no plural.
Definition: TranslatableString.h:103
TranslatableString::Join
TranslatableString & Join(TranslatableString arg, const wxString &separator={}) &
Append another translatable string.
Definition: TranslatableString.cpp:124
TranslatableString::Stripped
TranslatableString Stripped(unsigned options=MenuCodes) const
non-mutating, constructs another TranslatableString object
Definition: TranslatableString.h:198
Request
Class to construct the HTTP request.
TranslatableString::NullContextName
static const wxChar *const NullContextName
Definition: TranslatableString.h:221