1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-22 15:20:15 +02:00

Remove 56 macro _ calls and fix a few i8n mistakes

This commit is contained in:
Paul Licameli 2020-05-23 08:05:56 -04:00
commit f2b96ff640
25 changed files with 105 additions and 127 deletions

View File

@ -449,7 +449,7 @@ void DependencyDialog::PopulateList()
mFileListCtrl->SetItemState(i, 0, wxLIST_STATE_SELECTED); // Deselect. mFileListCtrl->SetItemState(i, 0, wxLIST_STATE_SELECTED); // Deselect.
mFileListCtrl->SetItemTextColour(i, *wxRED); mFileListCtrl->SetItemTextColour(i, *wxRED);
} }
mFileListCtrl->SetItem(i, 1, Internat::FormatSize(byteCount)); mFileListCtrl->SetItem(i, 1, Internat::FormatSize(byteCount).Translation());
mFileListCtrl->SetItemData(i, long(bOriginalExists)); mFileListCtrl->SetItemData(i, long(bOriginalExists));
++i; ++i;
@ -541,25 +541,24 @@ void DependencyDialog::OnRightClick( wxListEvent& event)
PopupMenu(&menu); PopupMenu(&menu);
} }
void DependencyDialog::OnCopyToClipboard( wxCommandEvent& evt ) void DependencyDialog::OnCopyToClipboard( wxCommandEvent& )
{ {
static_cast<void>(evt); TranslatableString Files;
wxString Files;
for (const auto &aliasedFile : mAliasedFiles) { for (const auto &aliasedFile : mAliasedFiles) {
const wxFileName & fileName = aliasedFile.mFileName; const wxFileName & fileName = aliasedFile.mFileName;
wxLongLong byteCount = (aliasedFile.mByteCount * 124) / 100; wxLongLong byteCount = (aliasedFile.mByteCount * 124) / 100;
bool bOriginalExists = aliasedFile.mbOriginalExists; bool bOriginalExists = aliasedFile.mbOriginalExists;
// All fields quoted, as e.g. size may contain a comma in the number. // All fields quoted, as e.g. size may contain a comma in the number.
Files += wxString::Format( "\"%s\", \"%s\", \"%s\"\n", Files += XO( "\"%s\", \"%s\", \"%s\"\n").Format(
fileName.GetFullPath(), fileName.GetFullPath(),
Internat::FormatSize( byteCount), Internat::FormatSize( byteCount),
bOriginalExists ? "OK":"Missing" ); bOriginalExists ? XO("OK") : XO("Missing") );
} }
// copy data onto clipboard // copy data onto clipboard
if (wxTheClipboard->Open()) { if (wxTheClipboard->Open()) {
// Clipboard owns the data you give it // Clipboard owns the data you give it
wxTheClipboard->SetData(safenew wxTextDataObject(Files)); wxTheClipboard->SetData(safenew wxTextDataObject(Files.Translation()));
wxTheClipboard->Close(); wxTheClipboard->Close();
} }
} }

View File

@ -875,7 +875,7 @@ wxFileNameWrapper DirManager::MakeBlockFilePath(const wxString &value) {
if(!dir.DirExists() && !dir.Mkdir(0777,wxPATH_MKDIR_FULL)) if(!dir.DirExists() && !dir.Mkdir(0777,wxPATH_MKDIR_FULL))
{ // need braces to avoid compiler warning about ambiguous else, see the macro { // need braces to avoid compiler warning about ambiguous else, see the macro
wxLogSysError(_("mkdir in DirManager::MakeBlockFilePath failed.")); wxLogSysError(wxT("mkdir in DirManager::MakeBlockFilePath failed."));
} }
} }
return dir; return dir;
@ -906,7 +906,7 @@ bool DirManager::AssignFile(wxFileNameWrapper &fileName,
wxString collision; wxString collision;
checkit.GetFirst(&collision,filespec); checkit.GetFirst(&collision,filespec);
wxLogWarning(_("Audacity found an orphan block file: %s. \nPlease consider saving and reloading the project to perform a complete project check."), wxLogWarning(wxT("Audacity found an orphan block file: %s. \nPlease consider saving and reloading the project to perform a complete project check."),
collision); collision);
return FALSE; return FALSE;
@ -1495,7 +1495,7 @@ bool DirManager::EnsureSafeFilename(const wxFileName &fName)
wxFile testFile(renamedFullPath, wxFile::write); wxFile testFile(renamedFullPath, wxFile::write);
if (!testFile.IsOpened()) { if (!testFile.IsOpened()) {
{ // need braces to avoid compiler warning about ambiguous else, see the macro { // need braces to avoid compiler warning about ambiguous else, see the macro
wxLogSysError(_("Unable to open/create test file."), wxLogSysError(wxT("Unable to open/create test file."),
renamedFullPath); renamedFullPath);
} }
return false; return false;
@ -1507,7 +1507,7 @@ bool DirManager::EnsureSafeFilename(const wxFileName &fName)
if (!wxRemoveFile(renamedFullPath)) { if (!wxRemoveFile(renamedFullPath)) {
{ // need braces to avoid compiler warning about ambiguous else, see the macro { // need braces to avoid compiler warning about ambiguous else, see the macro
/* i18n-hint: %s is the name of a file.*/ /* i18n-hint: %s is the name of a file.*/
wxLogSysError(_("Unable to remove '%s'."), wxLogSysError(wxT("Unable to remove '%s'."),
renamedFullPath); renamedFullPath);
} }
return false; return false;
@ -1548,7 +1548,7 @@ bool DirManager::EnsureSafeFilename(const wxFileName &fName)
// just in case!!! // just in case!!!
// Print error message and cancel the export // Print error message and cancel the export
wxLogSysError(_("Unable to rename '%s' to '%s'."), wxLogSysError(wxT("Unable to rename '%s' to '%s'."),
fullPath, fullPath,
renamedFullPath); renamedFullPath);
@ -1619,7 +1619,7 @@ void DirManager::FindMissingAliasFiles(
iter = missingAliasFilesPathHash.begin(); iter = missingAliasFilesPathHash.begin();
while (iter != missingAliasFilesPathHash.end()) while (iter != missingAliasFilesPathHash.end())
{ {
wxLogWarning(_("Missing aliased audio file: '%s'"), iter->first); wxLogWarning(wxT("Missing aliased audio file: '%s'"), iter->first);
++iter; ++iter;
} }
} }
@ -1643,7 +1643,7 @@ void DirManager::FindMissingAUFs(
if (!fileName.FileExists()) if (!fileName.FileExists())
{ {
missingAUFHash[key] = b; missingAUFHash[key] = b;
wxLogWarning(_("Missing alias (.auf) block file: '%s'"), wxLogWarning(wxT("Missing alias (.auf) block file: '%s'"),
fileName.GetFullPath()); fileName.GetFullPath());
} }
} }
@ -1673,7 +1673,7 @@ void DirManager::FindMissingAUs(
wxFile{ path }.Length() == 0) wxFile{ path }.Length() == 0)
{ {
missingAUHash[key] = b; missingAUHash[key] = b;
wxLogWarning(_("Missing data block file: '%s'"), path); wxLogWarning(wxT("Missing data block file: '%s'"), path);
} }
} }
} }
@ -1716,7 +1716,7 @@ void DirManager::FindOrphanBlockFiles(
} }
} }
for ( const auto &orphan : orphanFilePathArray ) for ( const auto &orphan : orphanFilePathArray )
wxLogWarning(_("Orphan block file: '%s'"), orphan); wxLogWarning(wxT("Orphan block file: '%s'"), orphan);
} }

View File

@ -33,9 +33,9 @@ License: GPL v2. See License.txt.
#if !defined(USE_FFMPEG) #if !defined(USE_FFMPEG)
/// FFmpeg support may or may not be compiled in, /// FFmpeg support may or may not be compiled in,
/// but Preferences dialog requires this function nevertheless /// but Preferences dialog requires this function nevertheless
wxString GetFFmpegVersion(wxWindow *parent) TranslatableString GetFFmpegVersion()
{ {
return wxString(_("FFmpeg support not compiled in")); return XO("FFmpeg support not compiled in");
} }
#else #else
@ -110,14 +110,14 @@ void FFmpegStartup()
} }
} }
wxString GetFFmpegVersion(wxWindow * WXUNUSED(parent)) TranslatableString GetFFmpegVersion()
{ {
PickFFmpegLibs(); PickFFmpegLibs();
wxString versionString = _("FFmpeg library not found"); auto versionString = XO("FFmpeg library not found");
if (FFmpegLibsInst()->ValidLibsLoaded()) { if (FFmpegLibsInst()->ValidLibsLoaded()) {
versionString = FFmpegLibsInst()->GetLibraryVersion(); versionString = Verbatim( FFmpegLibsInst()->GetLibraryVersion() );
} }
DropFFmpegLibs(); DropFFmpegLibs();

View File

@ -168,7 +168,7 @@ void av_log_wx_callback(void* ptr, int level, const char* fmt, va_list vl);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Get FFmpeg library version // Get FFmpeg library version
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
wxString GetFFmpegVersion(wxWindow *parent); TranslatableString GetFFmpegVersion();
/* from here on in, this stuff only applies when ffmpeg is available */ /* from here on in, this stuff only applies when ffmpeg is available */
#if defined(USE_FFMPEG) #if defined(USE_FFMPEG)

View File

@ -204,18 +204,17 @@ void HistoryDialog::DoUpdate()
wxLongLong_t total = 0; wxLongLong_t total = 0;
mSelected = mManager->GetCurrentState() - 1; mSelected = mManager->GetCurrentState() - 1;
for (i = 0; i < (int)mManager->GetNumStates(); i++) { for (i = 0; i < (int)mManager->GetNumStates(); i++) {
TranslatableString desc; TranslatableString desc, size;
wxString size;
total += mManager->GetLongDescription(i + 1, &desc, &size); total += mManager->GetLongDescription(i + 1, &desc, &size);
mList->InsertItem(i, desc.Translation(), i == mSelected ? 1 : 0); mList->InsertItem(i, desc.Translation(), i == mSelected ? 1 : 0);
mList->SetItem(i, 1, size); mList->SetItem(i, 1, size.Translation());
} }
mTotal->SetValue(Internat::FormatSize(total)); mTotal->SetValue(Internat::FormatSize(total).Translation());
auto clipboardUsage = mManager->GetClipboardSpaceUsage(); auto clipboardUsage = mManager->GetClipboardSpaceUsage();
mClipboard->SetValue(Internat::FormatSize(clipboardUsage)); mClipboard->SetValue(Internat::FormatSize(clipboardUsage).Translation());
FindWindowById(ID_DISCARD_CLIPBOARD)->Enable(clipboardUsage > 0); FindWindowById(ID_DISCARD_CLIPBOARD)->Enable(clipboardUsage > 0);
mList->EnsureVisible(mSelected); mList->EnsureVisible(mSelected);

View File

@ -188,7 +188,7 @@ wxString Internat::ToDisplayString(double numberToConvert,
return result; return result;
} }
wxString Internat::FormatSize(wxLongLong size) TranslatableString Internat::FormatSize(wxLongLong size)
{ {
/* wxLongLong contains no built-in conversion to double */ /* wxLongLong contains no built-in conversion to double */
double dSize = size.GetHi() * pow(2.0, 32); // 2 ^ 32 double dSize = size.GetHi() * pow(2.0, 32); // 2 ^ 32
@ -197,27 +197,27 @@ wxString Internat::FormatSize(wxLongLong size)
return FormatSize(dSize); return FormatSize(dSize);
} }
wxString Internat::FormatSize(double size) TranslatableString Internat::FormatSize(double size)
{ {
wxString sizeStr; TranslatableString sizeStr;
if (size == -1) if (size == -1)
sizeStr = _("Unable to determine"); sizeStr = XO("Unable to determine");
else { else {
/* make it look nice, by formatting into k, MB, etc */ /* make it look nice, by formatting into k, MB, etc */
if (size < 1024.0) if (size < 1024.0)
sizeStr = ToDisplayString(size) + wxT(" ") + _("bytes"); sizeStr = XO("%s bytes").Format( ToDisplayString(size) );
else if (size < 1024.0 * 1024.0) { else if (size < 1024.0 * 1024.0) {
/* i18n-hint: Abbreviation for Kilo bytes */ /* i18n-hint: Abbreviation for Kilo bytes */
sizeStr = ToDisplayString(size / 1024.0, 1) + wxT(" ") + _("KB"); sizeStr = XO("%s KB").Format( ToDisplayString(size / 1024.0, 1) );
} }
else if (size < 1024.0 * 1024.0 * 1024.0) { else if (size < 1024.0 * 1024.0 * 1024.0) {
/* i18n-hint: Abbreviation for Mega bytes */ /* i18n-hint: Abbreviation for Mega bytes */
sizeStr = ToDisplayString(size / (1024.0 * 1024.0), 1) + wxT(" ") + _("MB"); sizeStr = XO("%s MB").Format( ToDisplayString(size / (1024.0 * 1024.0), 1) );
} }
else { else {
/* i18n-hint: Abbreviation for Giga bytes */ /* i18n-hint: Abbreviation for Giga bytes */
sizeStr = ToDisplayString(size / (1024.0 * 1024.0 * 1024.0), 1) + wxT(" ") + _("GB"); sizeStr = XO("%s GB").Format( ToDisplayString(size / (1024.0 * 1024.0 * 1024.0), 1) );
} }
} }
@ -247,19 +247,6 @@ bool Internat::SanitiseFilename(wxString &name, const wxString &sub)
return result; return result;
} }
wxString Internat::StripAccelerators(const wxString &s)
{
wxString result;
result.reserve(s.length());
for(size_t i = 0; i < s.length(); i++) {
if (s[i] == '\t')
break;
if (s[i] != '&' && s[i] != '.')
result += s[i];
}
return result;
}
TranslatableStrings Msgids( TranslatableStrings Msgids(
const EnumValueSymbol strings[], size_t nStrings) const EnumValueSymbol strings[], size_t nStrings)
{ {

View File

@ -123,8 +123,8 @@ public:
/** \brief Convert a number to a string while formatting it in bytes, KB, /** \brief Convert a number to a string while formatting it in bytes, KB,
* MB, GB */ * MB, GB */
static wxString FormatSize(wxLongLong size); static TranslatableString FormatSize(wxLongLong size);
static wxString FormatSize(double size); static TranslatableString FormatSize(double size);
/** \brief Check a proposed file name string for illegal characters and /** \brief Check a proposed file name string for illegal characters and
* remove them * remove them
@ -133,15 +133,6 @@ public:
*/ */
static bool SanitiseFilename(wxString &name, const wxString &sub); static bool SanitiseFilename(wxString &name, const wxString &sub);
/** \brief Remove accelerator characters from strings
*
* Utility function - takes a translatable string to be used as a menu item,
* for example _("&Splash...\tAlt+S"), and strips all of the menu
* accelerator stuff from it, to make "Splash". That way the same
* translatable string can be used both when accelerators are needed and
* when they aren't, saving translators effort. */
static wxString StripAccelerators(const wxString& str);
static const wxArrayString &GetExcludedCharacters() static const wxArrayString &GetExcludedCharacters()
{ return exclude; } { return exclude; }
@ -151,8 +142,6 @@ private:
static wxArrayString exclude; static wxArrayString exclude;
}; };
#define _NoAcc(X) Internat::StripAccelerators(_(X))
// Convert C strings to wxString // Convert C strings to wxString
#define UTF8CTOWX(X) wxString((X), wxConvUTF8) #define UTF8CTOWX(X) wxString((X), wxConvUTF8)
#define LAT1CTOWX(X) wxString((X), wxConvISO8859_1) #define LAT1CTOWX(X) wxString((X), wxConvISO8859_1)

View File

@ -133,18 +133,22 @@ void LabelDialog::PopulateLabels()
mGrid->CreateGrid(0, Col_Max); mGrid->CreateGrid(0, Col_Max);
mGrid->SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_CENTER); mGrid->SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
/* i18n-hint: (noun). A track contains waves, audio etc.*/ size_t ii = 0;
mGrid->SetColLabelValue(0,_("Track")); for ( const auto &label : {
/* i18n-hint: (noun)*/ /* i18n-hint: (noun). A track contains waves, audio etc.*/
mGrid->SetColLabelValue(1,_("Label")); XO("Track"),
/* i18n-hint: (noun) of a label*/ /* i18n-hint: (noun)*/
mGrid->SetColLabelValue(2,_("Start Time")); XO("Label"),
/* i18n-hint: (noun) of a label*/ /* i18n-hint: (noun) of a label*/
mGrid->SetColLabelValue(3,_("End Time")); XO("Start Time"),
/* i18n-hint: (noun) of a label*/ /* i18n-hint: (noun) of a label*/
mGrid->SetColLabelValue(4,_("Low Frequency")); XO("End Time"),
/* i18n-hint: (noun) of a label*/ /* i18n-hint: (noun) of a label*/
mGrid->SetColLabelValue(5,_("High Frequency")); XO("Low Frequency"),
/* i18n-hint: (noun) of a label*/
XO("High Frequency"),
})
mGrid->SetColLabelValue( ii++, label.Translation() );
// Create and remember editors. No need to DELETE these as the wxGrid will // Create and remember editors. No need to DELETE these as the wxGrid will
// do it for us. (The DecRef() that is needed after GetDefaultEditorForType // do it for us. (The DecRef() that is needed after GetDefaultEditorForType

View File

@ -1187,9 +1187,10 @@ void MixerBoard::UpdateWidth()
// //
void MixerBoard::MakeButtonBitmap( wxMemoryDC & dc, wxBitmap & WXUNUSED(bitmap), wxRect & bev, const wxString & str, bool up ) void MixerBoard::MakeButtonBitmap( wxMemoryDC & dc, wxBitmap & WXUNUSED(bitmap), wxRect & bev, const TranslatableString & str, bool up )
{ {
const auto translation = str.Translation();
int textWidth, textHeight; int textWidth, textHeight;
int fontSize = 10; int fontSize = 10;
@ -1197,7 +1198,7 @@ void MixerBoard::MakeButtonBitmap( wxMemoryDC & dc, wxBitmap & WXUNUSED(bitmap),
fontSize = 8; fontSize = 8;
#endif #endif
wxFont font(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); wxFont font(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
GetTextExtent(str, &textWidth, &textHeight, NULL, NULL, &font); GetTextExtent(translation, &textWidth, &textHeight, NULL, NULL, &font);
AColor::UseThemeColour( &dc, clrMedium ); AColor::UseThemeColour( &dc, clrMedium );
dc.DrawRectangle(bev); dc.DrawRectangle(bev);
@ -1209,15 +1210,15 @@ void MixerBoard::MakeButtonBitmap( wxMemoryDC & dc, wxBitmap & WXUNUSED(bitmap),
dc.SetFont(font); dc.SetFont(font);
dc.SetTextForeground(theTheme.Colour(clrTrackPanelText)); dc.SetTextForeground(theTheme.Colour(clrTrackPanelText));
dc.SetBackgroundMode(wxTRANSPARENT); dc.SetBackgroundMode(wxTRANSPARENT);
dc.DrawText(str, x, y); dc.DrawText(translation, x, y);
// dc.DrawText(str, 0, 0); // dc.DrawText(translation, 0, 0);
} }
void MixerBoard::CreateMuteSoloImages() void MixerBoard::CreateMuteSoloImages()
{ {
// Much of this is similar to TrackInfo::MuteOrSoloDrawFunction. // Much of this is similar to TrackInfo::MuteOrSoloDrawFunction.
wxMemoryDC dc; wxMemoryDC dc;
wxString str = _("Mute"); auto str = XO("Mute");
//mMuteSoloWidth = textWidth + kQuadrupleInset; //mMuteSoloWidth = textWidth + kQuadrupleInset;
//if (mMuteSoloWidth < kRightSideStackWidth - kInset) //if (mMuteSoloWidth < kRightSideStackWidth - kInset)
@ -1243,7 +1244,7 @@ void MixerBoard::CreateMuteSoloImages()
mImageMuteDisabled = std::make_unique<wxImage>(mMuteSoloWidth, MUTE_SOLO_HEIGHT); // Leave empty because unused. mImageMuteDisabled = std::make_unique<wxImage>(mMuteSoloWidth, MUTE_SOLO_HEIGHT); // Leave empty because unused.
str = _("Solo"); str = XO("Solo");
MakeButtonBitmap( dc, bitmap, bev, str, up ); MakeButtonBitmap( dc, bitmap, bev, str, up );
mImageSoloUp = std::make_unique<wxImage>(bitmap.ConvertToImage()); mImageSoloUp = std::make_unique<wxImage>(bitmap.ConvertToImage());
mImageSoloOver = std::make_unique<wxImage>(bitmap.ConvertToImage()); // Same as up, for now. mImageSoloOver = std::make_unique<wxImage>(bitmap.ConvertToImage()); // Same as up, for now.

View File

@ -224,7 +224,7 @@ private:
void ResetMeters(const bool bResetClipping); void ResetMeters(const bool bResetClipping);
void RemoveTrackCluster(size_t nIndex); void RemoveTrackCluster(size_t nIndex);
void MakeButtonBitmap( wxMemoryDC & dc, wxBitmap & bitmap, void MakeButtonBitmap( wxMemoryDC & dc, wxBitmap & bitmap,
wxRect & bev, const wxString & str, bool up ); wxRect & bev, const TranslatableString & str, bool up );
void CreateMuteSoloImages(); void CreateMuteSoloImages();
int FindMixerTrackCluster(const PlayableTrack* pTrack, int FindMixerTrackCluster(const PlayableTrack* pTrack,
MixerTrackCluster** hMixerTrackCluster) const; MixerTrackCluster** hMixerTrackCluster) const;

View File

@ -112,7 +112,7 @@ bool Module::Load()
auto Error = wxString(wxSysErrorMsg()); auto Error = wxString(wxSysErrorMsg());
AudacityMessageBox(XO("Unable to load the \"%s\" module.\n\nError: %s").Format(ShortName, Error), AudacityMessageBox(XO("Unable to load the \"%s\" module.\n\nError: %s").Format(ShortName, Error),
XO("Module Unsuitable")); XO("Module Unsuitable"));
wxLogMessage(_("Unable to load the module \"%s\". Error: %s").Format(mName, Error)); wxLogMessage(wxT("Unable to load the module \"%s\". Error: %s"), mName, Error);
return false; return false;
} }
@ -123,7 +123,7 @@ bool Module::Load()
XO("The module \"%s\" does not provide a version string.\n\nIt will not be loaded.") XO("The module \"%s\" does not provide a version string.\n\nIt will not be loaded.")
.Format( ShortName), .Format( ShortName),
XO("Module Unsuitable")); XO("Module Unsuitable"));
wxLogMessage(wxString::Format(_("The module \"%s\" does not provide a version string. It will not be loaded."), mName)); wxLogMessage(wxT("The module \"%s\" does not provide a version string. It will not be loaded."), mName);
mLib->Unload(); mLib->Unload();
return false; return false;
} }
@ -134,7 +134,7 @@ bool Module::Load()
XO("The module \"%s\" is matched with Audacity version \"%s\".\n\nIt will not be loaded.") XO("The module \"%s\" is matched with Audacity version \"%s\".\n\nIt will not be loaded.")
.Format(ShortName, moduleVersion), .Format(ShortName, moduleVersion),
XO("Module Unsuitable")); XO("Module Unsuitable"));
wxLogMessage(wxString::Format(_("The module \"%s\" is matched with Audacity version \"%s\". It will not be loaded."), mName, moduleVersion)); wxLogMessage(wxT("The module \"%s\" is matched with Audacity version \"%s\". It will not be loaded."), mName, moduleVersion);
mLib->Unload(); mLib->Unload();
return false; return false;
} }
@ -159,7 +159,7 @@ bool Module::Load()
AudacityMessageBox( AudacityMessageBox(
XO("The module \"%s\" failed to initialize.\n\nIt will not be loaded.").Format(ShortName), XO("The module \"%s\" failed to initialize.\n\nIt will not be loaded.").Format(ShortName),
XO("Module Unsuitable")); XO("Module Unsuitable"));
wxLogMessage(wxString::Format(_("The module \"%s\" failed to initialize.\nIt will not be loaded."), mName)); wxLogMessage(wxT("The module \"%s\" failed to initialize.\nIt will not be loaded."), mName);
mLib->Unload(); mLib->Unload();
return false; return false;
@ -342,7 +342,7 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
AudacityMessageBox( AudacityMessageBox(
XO("The module \"%s\" does not provide any of the required functions.\n\nIt will not be loaded.").Format(ShortName), XO("The module \"%s\" does not provide any of the required functions.\n\nIt will not be loaded.").Format(ShortName),
XO("Module Unsuitable")); XO("Module Unsuitable"));
wxLogMessage(wxString::Format(_("The module \"%s\" does not provide any of the required functions. It will not be loaded."), files[i])); wxLogMessage(wxT("The module \"%s\" does not provide any of the required functions. It will not be loaded."), files[i]);
module->Unload(); module->Unload();
} }
else else

View File

@ -168,7 +168,7 @@ XO("Project check of \"%s\" folder \
++iter; ++iter;
} }
if ((action == 2) && bAutoRecoverMode) if ((action == 2) && bAutoRecoverMode)
wxLogWarning(_(" Project check replaced missing aliased file(s) with silence.")); wxLogWarning(wxT(" Project check replaced missing aliased file(s) with silence."));
} }
} }
@ -240,7 +240,7 @@ XO("Project check of \"%s\" folder \
++iter; ++iter;
} }
if ((action == 0) && bAutoRecoverMode) if ((action == 0) && bAutoRecoverMode)
wxLogWarning(_(" Project check regenerated missing alias summary file(s).")); wxLogWarning(wxT(" Project check regenerated missing alias summary file(s)."));
} }
} }
@ -316,7 +316,7 @@ XO("Project check of \"%s\" folder \
++iter; ++iter;
} }
if ((action == 2) && bAutoRecoverMode) if ((action == 2) && bAutoRecoverMode)
wxLogWarning(_(" Project check replaced missing audio data block file(s) with silence.")); wxLogWarning(wxT(" Project check replaced missing audio data block file(s) with silence."));
} }
} }
@ -332,7 +332,7 @@ XO("Project check of \"%s\" folder \
// They will be deleted when project is saved the first time. // They will be deleted when project is saved the first time.
if (bAutoRecoverMode) if (bAutoRecoverMode)
{ {
wxLogWarning(_(" Project check ignored orphan block file(s). They will be deleted when project is saved.")); wxLogWarning(wxT(" Project check ignored orphan block file(s). They will be deleted when project is saved."));
action = 1; action = 1;
} }
else else
@ -391,7 +391,7 @@ other projects. \
!missingAUHash.empty() || !missingAUHash.empty() ||
!orphanFilePathArray.empty()) !orphanFilePathArray.empty())
{ {
wxLogWarning(_("Project check found file inconsistencies inspecting the loaded project data.")); wxLogWarning(wxT("Project check found file inconsistencies inspecting the loaded project data."));
wxLog::FlushActive(); // Flush is modal and will clear the log (both desired). wxLog::FlushActive(); // Flush is modal and will clear the log (both desired).
// In auto-recover mode, we didn't do any ShowMultiDialog calls above, so put up an alert. // In auto-recover mode, we didn't do any ShowMultiDialog calls above, so put up an alert.

View File

@ -177,7 +177,7 @@ bool ProjectFileIO::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
auto &dirManager = DirManager::Get( project ); auto &dirManager = DirManager::Get( project );
auto &settings = ProjectSettings::Get( project ); auto &settings = ProjectSettings::Get( project );
bool bFileVersionFound = false; bool bFileVersionFound = false;
wxString fileVersion = _("<unrecognized version -- possibly corrupt project file>"); wxString fileVersion;
wxString audacityVersion = _("<unrecognized version -- possibly corrupt project file>"); wxString audacityVersion = _("<unrecognized version -- possibly corrupt project file>");
int requiredTags = 0; int requiredTags = 0;
long longVpos = 0; long longVpos = 0;

View File

@ -165,7 +165,7 @@ void UndoManager::CalculateSpaceUsage()
} }
wxLongLong_t UndoManager::GetLongDescription( wxLongLong_t UndoManager::GetLongDescription(
unsigned int n, TranslatableString *desc, wxString *size) unsigned int n, TranslatableString *desc, TranslatableString *size)
{ {
n -= 1; // 1 based to zero based n -= 1; // 1 based to zero based

View File

@ -141,7 +141,7 @@ class AUDACITY_DLL_API UndoManager final
void GetShortDescription(unsigned int n, TranslatableString *desc); void GetShortDescription(unsigned int n, TranslatableString *desc);
// Return value must first be calculated by CalculateSpaceUsage(): // Return value must first be calculated by CalculateSpaceUsage():
wxLongLong_t GetLongDescription( wxLongLong_t GetLongDescription(
unsigned int n, TranslatableString *desc, wxString *size); unsigned int n, TranslatableString *desc, TranslatableString *size);
void SetLongDescription(unsigned int n, const TranslatableString &desc); void SetLongDescription(unsigned int n, const TranslatableString &desc);
// These functions accept a callback that uses the state, // These functions accept a callback that uses the state,

View File

@ -434,18 +434,18 @@ namespace {
return format0.Format( value ); return format0.Format( value );
} }
wxString FormatDifference( float diffdB ) TranslatableString FormatDifference( float diffdB )
{ {
if( diffdB != diffdB ) // test for NaN, reliant on IEEE implementation if( diffdB != diffdB ) // test for NaN, reliant on IEEE implementation
return _("indeterminate"); return XO("indeterminate");
else { else {
if( diffdB != std::numeric_limits<float>::infinity() ) if( diffdB != std::numeric_limits<float>::infinity() )
/* i18n-hint: dB abbreviates decibels /* i18n-hint: dB abbreviates decibels
* RMS abbreviates root mean square, a certain averaging method */ * RMS abbreviates root mean square, a certain averaging method */
return wxString::Format(_("%.2f dB RMS"), diffdB); return XO("%.2f dB RMS").Format( diffdB );
else else
/* i18n-hint: dB abbreviates decibels */ /* i18n-hint: dB abbreviates decibels */
return _("Infinite dB difference"); return XO("Infinite dB difference");
} }
} }
@ -494,7 +494,7 @@ void ContrastDialog::results()
/* i18n-hint: i.e. difference in loudness at the moment. */ /* i18n-hint: i.e. difference in loudness at the moment. */
mDiffText->SetName(_("Current difference")); mDiffText->SetName(_("Current difference"));
mDiffText->ChangeValue( FormatDifference( diffdB ) ); mDiffText->ChangeValue( FormatDifference( diffdB ).Translation() );
} }
if (mForegroundIsDefined) { if (mForegroundIsDefined) {

View File

@ -542,7 +542,7 @@ unsigned VSTEffectsModule::DiscoverPluginsAtPath(
} }
catch (...) catch (...)
{ {
wxLogMessage(_("VST plugin registration failed for %s\n"), path); wxLogMessage(wxT("VST plugin registration failed for %s\n"), path);
error = true; error = true;
} }
@ -2176,7 +2176,7 @@ bool VSTEffect::Load()
} }
catch (...) catch (...)
{ {
wxLogMessage(_("VST plugin initialization failed\n")); wxLogMessage(wxT("VST plugin initialization failed\n"));
mAEffect = NULL; mAEffect = NULL;
} }

View File

@ -1827,7 +1827,7 @@ void AudioUnitEffect::ExportPresets()
if (!fn.Mkdir(fn.GetFullPath(), 0755, wxPATH_MKDIR_FULL)) if (!fn.Mkdir(fn.GetFullPath(), 0755, wxPATH_MKDIR_FULL))
{ {
wxLogError(_("Couldn't create the \"%s\" directory").Format(fn.GetPath())); wxLogError(wxT("Couldn't create the \"%s\" directory"), fn.GetPath());
return; return;
} }

View File

@ -1131,7 +1131,7 @@ size_t LV2Effect::ProcessBlock(float **inbuf, float **outbuf, size_t size)
else else
{ {
zix_ring_skip(ring, atom.size); zix_ring_skip(ring, atom.size);
wxLogError(_("LV2 sequence buffer overflow")); wxLogError(wxT("LV2 sequence buffer overflow"));
} }
} }
@ -1303,7 +1303,7 @@ bool LV2Effect::RealtimeProcessStart()
else else
{ {
zix_ring_skip(ring, atom.size); zix_ring_skip(ring, atom.size);
wxLogError(_("LV2 sequence buffer overflow")); wxLogError(wxT("LV2 sequence buffer overflow"));
} }
} }
lv2_atom_forge_pop(&mForge, &seqFrame); lv2_atom_forge_pop(&mForge, &seqFrame);
@ -1911,7 +1911,7 @@ bool LV2Effect::CheckFeatures(const LilvNode *subject, const LilvNode *predicate
{ {
if (required) if (required)
{ {
wxLogError(_("%s requires unsupported feature %s"), lilv_node_as_string(lilv_plugin_get_uri(mPlug)), uri); wxLogError(wxT("%s requires unsupported feature %s"), lilv_node_as_string(lilv_plugin_get_uri(mPlug)), uri);
printf(_("%s requires unsupported feature %s\n"), lilv_node_as_string(lilv_plugin_get_uri(mPlug)), uri); printf(_("%s requires unsupported feature %s\n"), lilv_node_as_string(lilv_plugin_get_uri(mPlug)), uri);
break; break;
} }
@ -1975,7 +1975,7 @@ bool LV2Effect::CheckOptions(const LilvNode *subject, const LilvNode *predicate,
{ {
if (required) if (required)
{ {
wxLogError(_("%s requires unsupported option %s"), lilv_node_as_string(lilv_plugin_get_uri(mPlug)), uri); wxLogError(wxT("%s requires unsupported option %s"), lilv_node_as_string(lilv_plugin_get_uri(mPlug)), uri);
printf(_("%s requires unsupported option %s\n"), lilv_node_as_string(lilv_plugin_get_uri(mPlug)), uri); printf(_("%s requires unsupported option %s\n"), lilv_node_as_string(lilv_plugin_get_uri(mPlug)), uri);
break; break;
} }
@ -2823,7 +2823,7 @@ void LV2Effect::OnIdle(wxIdleEvent &evt)
else else
{ {
zix_ring_skip(ring, atom->size); zix_ring_skip(ring, atom->size);
wxLogError(_("LV2 sequence buffer overflow")); wxLogError(wxT("LV2 sequence buffer overflow"));
} }
} }
free(atom); free(atom);

View File

@ -1379,7 +1379,7 @@ bool NyquistEffect::ProcessOne()
const auto output = mDebugOutput.Translation(); const auto output = mDebugOutput.Translation();
if (!output.empty() && !mDebug && !mTrace) { if (!output.empty() && !mDebug && !mTrace) {
/* i18n-hint: An effect "returned" a message.*/ /* i18n-hint: An effect "returned" a message.*/
wxLogMessage(_("\'%s\' returned:\n%s"), wxLogMessage(wxT("\'%s\' returned:\n%s"),
mName.Translation(), output); mName.Translation(), output);
} }
@ -2166,7 +2166,7 @@ bool NyquistEffect::Parse(
else else
{ {
wxString str; wxString str;
str.Printf(_("Bad Nyquist 'control' type specification: '%s' in plug-in file '%s'.\nControl not created."), str.Printf(wxT("Bad Nyquist 'control' type specification: '%s' in plug-in file '%s'.\nControl not created."),
tokens[3], mFileName.GetFullPath()); tokens[3], mFileName.GetFullPath());
// Too disturbing to show alert before Audacity frame is up. // Too disturbing to show alert before Audacity frame is up.

View File

@ -2211,10 +2211,10 @@ static Exporter::RegisteredExportPlugin sRegisteredPlugin{ "MP3",
// Return library version // Return library version
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
wxString GetMP3Version(wxWindow *parent, bool prompt) TranslatableString GetMP3Version(wxWindow *parent, bool prompt)
{ {
MP3Exporter exporter; MP3Exporter exporter;
wxString versionString = _("MP3 export library not found"); auto versionString = XO("MP3 export library not found");
#ifndef DISABLE_DYNAMIC_LOADING_LAME #ifndef DISABLE_DYNAMIC_LOADING_LAME
if (prompt) { if (prompt) {
@ -2223,10 +2223,9 @@ wxString GetMP3Version(wxWindow *parent, bool prompt)
if (exporter.LoadLibrary(parent, prompt ? MP3Exporter::Yes : MP3Exporter::No)) { if (exporter.LoadLibrary(parent, prompt ? MP3Exporter::Yes : MP3Exporter::No)) {
#endif // DISABLE_DYNAMIC_LOADING_LAME #endif // DISABLE_DYNAMIC_LOADING_LAME
versionString = exporter.GetLibraryVersion(); versionString = Verbatim( exporter.GetLibraryVersion() );
#ifdef MP3_EXPORT_BUILT_IN #ifdef MP3_EXPORT_BUILT_IN
versionString += " "; versionString.Join( XO("(Built-in)"), " " );
versionString += _("(Built-in)");
#endif #endif
#ifndef DISABLE_DYNAMIC_LOADING_LAME #ifndef DISABLE_DYNAMIC_LOADING_LAME

View File

@ -29,13 +29,13 @@ extern EnumSetting< MP3RateMode > MP3RateModeSetting;
#define MP3_EXPORT_BUILT_IN 1 #define MP3_EXPORT_BUILT_IN 1
#endif #endif
class wxString; class TranslatableString;
class wxWindow; class wxWindow;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Get MP3 library version // Get MP3 library version
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
wxString GetMP3Version(wxWindow *parent, bool prompt); TranslatableString GetMP3Version(wxWindow *parent, bool prompt);
#endif #endif

View File

@ -19,22 +19,22 @@ struct FoundTrack {
int trackNum{}; int trackNum{};
bool channel{}; bool channel{};
wxString ComposeTrackName() const TranslatableString ComposeTrackName() const
{ {
auto name = waveTrack->GetName(); auto name = waveTrack->GetName();
auto shortName = name == waveTrack->GetDefaultName() auto shortName = name == waveTrack->GetDefaultName()
/* i18n-hint: compose a name identifying an unnamed track by number */ /* i18n-hint: compose a name identifying an unnamed track by number */
? wxString::Format( _("Track %d"), trackNum ) ? XO("Track %d").Format( trackNum )
: name; : Verbatim(name);
auto longName = shortName; auto longName = shortName;
if (channel) { if (channel) {
// TODO: more-than-two-channels-message // TODO: more-than-two-channels-message
if ( waveTrack->IsLeader() ) if ( waveTrack->IsLeader() )
/* i18n-hint: given the name of a track, specify its left channel */ /* i18n-hint: given the name of a track, specify its left channel */
longName = wxString::Format(_("%s left"), shortName); longName = XO("%s left").Format(shortName);
else else
/* i18n-hint: given the name of a track, specify its right channel */ /* i18n-hint: given the name of a track, specify its right channel */
longName = wxString::Format(_("%s right"), shortName); longName = XO("%s right").Format(shortName);
} }
return longName; return longName;
} }

View File

@ -200,7 +200,7 @@ void DirectoriesPrefs::OnChooseTempDir(wxCommandEvent & e)
void DirectoriesPrefs::UpdateFreeSpace(wxCommandEvent & WXUNUSED(event)) void DirectoriesPrefs::UpdateFreeSpace(wxCommandEvent & WXUNUSED(event))
{ {
wxString tempDir; wxString tempDir;
wxString label; TranslatableString label;
if (mTempDir != NULL) { if (mTempDir != NULL) {
tempDir = mTempDir->GetValue(); tempDir = mTempDir->GetValue();
@ -212,12 +212,12 @@ void DirectoriesPrefs::UpdateFreeSpace(wxCommandEvent & WXUNUSED(event))
label = Internat::FormatSize(space); label = Internat::FormatSize(space);
} }
else { else {
label = _("unavailable - above location doesn't exist"); label = XO("unavailable - above location doesn't exist");
} }
if( mFreeSpace != NULL ) { if( mFreeSpace != NULL ) {
mFreeSpace->SetLabel(label); mFreeSpace->SetLabel(label.Translation());
mFreeSpace->SetName(label); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) mFreeSpace->SetName(label.Translation()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
} }
} }

View File

@ -185,7 +185,7 @@ void LibraryPrefs::PopulateOrExchange(ShuttleGui & S)
/// of the MP3 Library version. /// of the MP3 Library version.
void LibraryPrefs::SetMP3VersionText(bool prompt) void LibraryPrefs::SetMP3VersionText(bool prompt)
{ {
mMP3Version->SetLabel(GetMP3Version(this, prompt)); mMP3Version->SetLabel(GetMP3Version(this, prompt).Translation());
mMP3Version->SetName(mMP3Version->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) mMP3Version->SetName(mMP3Version->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
} }
@ -205,7 +205,7 @@ void LibraryPrefs::OnMP3DownButton(wxCommandEvent & WXUNUSED(event))
void LibraryPrefs::SetFFmpegVersionText() void LibraryPrefs::SetFFmpegVersionText()
{ {
mFFmpegVersion->SetLabel(GetFFmpegVersion(this)); mFFmpegVersion->SetLabel(GetFFmpegVersion().Translation());
mFFmpegVersion->SetName(mFFmpegVersion->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) mFFmpegVersion->SetName(mFFmpegVersion->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
} }