TranslatableString for undo history short and long descriptions

This commit is contained in:
Paul Licameli 2019-12-08 12:11:31 -05:00
parent 1f86a77569
commit 4eb220e7b9
36 changed files with 273 additions and 279 deletions

View File

@ -958,19 +958,19 @@ bool MacroCommands::ApplyMacro(
mFileName.Empty();
// Macro was successfully applied; save the NEW project state
wxString longDesc, shortDesc;
TranslatableString longDesc, shortDesc;
wxString name = gPrefs->Read(wxT("/Batch/ActiveMacro"), wxEmptyString);
if (name.empty())
{
/* i18n-hint: active verb in past tense */
longDesc = _("Applied Macro");
shortDesc = _("Apply Macro");
longDesc = XO("Applied Macro");
shortDesc = XO("Apply Macro");
}
else
{
/* i18n-hint: active verb in past tense */
longDesc = wxString::Format(_("Applied Macro '%s'"), name);
shortDesc = wxString::Format(_("Apply '%s'"), name);
longDesc = XO("Applied Macro '%s'").Format( name );
shortDesc = XO("Apply '%s'").Format( name );
}
if (!proj)

View File

@ -203,10 +203,11 @@ void HistoryDialog::DoUpdate()
wxLongLong_t total = 0;
mSelected = mManager->GetCurrentState() - 1;
for (i = 0; i < (int)mManager->GetNumStates(); i++) {
wxString desc, size;
TranslatableString desc;
wxString size;
total += mManager->GetLongDescription(i + 1, &desc, &size);
mList->InsertItem(i, desc, i == mSelected ? 1 : 0);
mList->InsertItem(i, desc.Translation(), i == mSelected ? 1 : 0);
mList->SetItem(i, 1, size);
}

View File

@ -316,7 +316,7 @@ void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
// TODO: This surely belongs in CommandManager?
void MenuManager::ModifyUndoMenuItems(AudacityProject &project)
{
wxString desc;
TranslatableString desc;
auto &undoManager = UndoManager::Get( project );
auto &commandManager = CommandManager::Get( project );
int cur = undoManager.GetCurrentState();

View File

@ -415,7 +415,7 @@ void MixerTrackCluster::HandleSliderGain(const bool bWantPushState /*= false*/)
TrackPanel::Get( *mProject ).RefreshTrack(mTrack.get());
if (bWantPushState)
ProjectHistory::Get( *mProject )
.PushState(_("Moved gain slider"), _("Gain"), UndoPush::CONSOLIDATE );
.PushState(XO("Moved gain slider"), XO("Gain"), UndoPush::CONSOLIDATE );
}
#ifdef EXPERIMENTAL_MIDI_OUT
@ -429,7 +429,7 @@ void MixerTrackCluster::HandleSliderVelocity(const bool bWantPushState /*= false
TrackPanel::Get( *mProject ).RefreshTrack(mTrack.get());
if (bWantPushState)
ProjectHistory::Get( *mProject )
.PushState(_("Moved velocity slider"), _("Velocity"),
.PushState(XO("Moved velocity slider"), XO("Velocity"),
UndoPush::CONSOLIDATE);
}
#endif
@ -447,7 +447,7 @@ void MixerTrackCluster::HandleSliderPan(const bool bWantPushState /*= false*/)
if (bWantPushState)
ProjectHistory::Get( *mProject )
.PushState(_("Moved pan slider"), _("Pan"),
.PushState(XO("Moved pan slider"), XO("Pan"),
UndoPush::CONSOLIDATE );
}

View File

@ -880,7 +880,7 @@ You are saving directly to a slow external storage device\n\
}
else
// Add to history
history.PushState(_("Recorded Audio"), _("Record"));
history.PushState(XO("Recorded Audio"), XO("Record"));
}
// Write all cached files to disk, if any

View File

@ -1452,7 +1452,7 @@ void ProjectFileManager::OpenFile(const FilePath &fileNameArg, bool addtohistory
::ProjectFSCK(dirManager, err, true); // Correct problems in auto-recover mode.
// PushState calls AutoSave(), so no longer need to do so here.
history.PushState(_("Project was recovered"), _("Recover"));
history.PushState(XO("Project was recovered"), XO("Recover"));
if (!wxRemoveFile(fileName))
AudacityMessageBox(_("Could not remove old auto save file"),
@ -1619,8 +1619,8 @@ ProjectFileManager::AddImportedTracks(const FilePath &fileName,
SelectionBar::Get( project ).SetRate( newRate );
}
history.PushState(wxString::Format(_("Imported '%s'"), fileName),
_("Import"));
history.PushState(XO("Imported '%s'").Format( fileName ),
XO("Import"));
#if defined(__WXGTK__)
// See bug #1224

View File

@ -54,7 +54,7 @@ void ProjectHistory::InitialState()
undoManager.PushState(
&tracks, viewInfo.selectedRegion, tags.shared_from_this(),
_("Created new project"), wxT(""));
XO("Created new project"), {});
undoManager.StateSaved();
}
@ -77,13 +77,14 @@ bool ProjectHistory::RedoAvailable() const
!tracks.HasPendingTracks();
}
void ProjectHistory::PushState(const wxString &desc, const wxString &shortDesc)
void ProjectHistory::PushState(
const TranslatableString &desc, const TranslatableString &shortDesc)
{
PushState(desc, shortDesc, UndoPush::AUTOSAVE);
}
void ProjectHistory::PushState(const wxString &desc,
const wxString &shortDesc,
void ProjectHistory::PushState(const TranslatableString &desc,
const TranslatableString &shortDesc,
UndoPush flags )
{
auto &project = mProject;

View File

@ -35,8 +35,12 @@ public:
void SetStateTo(unsigned int n);
bool UndoAvailable() const;
bool RedoAvailable() const;
void PushState(const wxString &desc, const wxString &shortDesc); // use UndoPush::AUTOSAVE
void PushState(const wxString &desc, const wxString &shortDesc, UndoPush flags);
void PushState(
const TranslatableString &desc,
const TranslatableString &shortDesc); // use UndoPush::AUTOSAVE
void PushState(
const TranslatableString &desc,
const TranslatableString &shortDesc, UndoPush flags);
void RollbackState();
void ModifyState(bool bWantsAutoSave); // if true, writes auto-save file.
// Should set only if you really want the state change restored after

View File

@ -57,20 +57,20 @@ void InitDitherers()
gHighQualityDither = Dither::BestDitherChoice();
}
const wxChar *GetSampleFormatStr(sampleFormat format)
TranslatableString GetSampleFormatStr(sampleFormat format)
{
switch(format) {
case int16Sample:
/* i18n-hint: Audio data bit depth (precision): 16-bit integers */
return _("16-bit PCM");
return XO("16-bit PCM");
case int24Sample:
/* i18n-hint: Audio data bit depth (precision): 24-bit integers */
return _("24-bit PCM");
return XO("24-bit PCM");
case floatSample:
/* i18n-hint: Audio data bit depth (precision): 32-bit floating point */
return _("32-bit float");
return XO("32-bit float");
}
return wxT("Unknown format"); // compiler food
return XO("Unknown format"); // compiler food
}
// TODO: Risky? Assumes 0.0f is represented by 0x00000000;

View File

@ -44,7 +44,7 @@ typedef enum {
#define SAMPLE_SIZE_DISK(SampleFormat) (((SampleFormat) == int24Sample) ? \
size_t{ 3 } : SAMPLE_SIZE(SampleFormat) )
const wxChar *GetSampleFormatStr(sampleFormat format);
TranslatableString GetSampleFormatStr(sampleFormat format);
//
// Allocating/Freeing Samples

View File

@ -498,7 +498,8 @@ void Sequence::Paste(sampleCount s, const Sequence *src)
{
wxLogError(
wxT("Sequence::Paste: Sample format to be pasted, %s, does not match destination format, %s."),
GetSampleFormatStr(src->mSampleFormat), GetSampleFormatStr(src->mSampleFormat));
GetSampleFormatStr(src->mSampleFormat).Debug(),
GetSampleFormatStr(mSampleFormat).Debug());
THROW_INCONSISTENCY_EXCEPTION;
}

View File

@ -56,7 +56,7 @@ void DoRemoveTracks( AudacityProject &project )
}
ProjectHistory::Get( project )
.PushState(_("Removed audio track(s)"), _("Remove Track"));
.PushState(XO("Removed audio track(s)"), XO("Remove Track"));
trackPanel.UpdateViewIfNoTracks();
}
@ -191,9 +191,8 @@ void DoRemoveTrack(AudacityProject &project, Track * toRemove)
trackFocus.Set( newFocus );
ProjectHistory::Get( project ).PushState(
wxString::Format(_("Removed track '%s.'"),
name),
_("Track Remove"));
XO("Removed track '%s.'").Format( name ),
XO("Track Remove"));
}
void DoMoveTrack
@ -201,14 +200,14 @@ void DoMoveTrack
{
auto &tracks = TrackList::Get( project );
wxString longDesc, shortDesc;
TranslatableString longDesc, shortDesc;
switch (choice)
{
case OnMoveTopID:
/* i18n-hint: Past tense of 'to move', as in 'moved audio track up'.*/
longDesc = _("Moved '%s' to Top");
shortDesc = _("Move Track to Top");
longDesc = XO("Moved '%s' to Top");
shortDesc = XO("Move Track to Top");
// TODO: write TrackList::Rotate to do this in one step and avoid emitting
// an event for each swap
@ -218,8 +217,8 @@ void DoMoveTrack
break;
case OnMoveBottomID:
/* i18n-hint: Past tense of 'to move', as in 'moved audio track up'.*/
longDesc = _("Moved '%s' to Bottom");
shortDesc = _("Move Track to Bottom");
longDesc = XO("Moved '%s' to Bottom");
shortDesc = XO("Move Track to Bottom");
// TODO: write TrackList::Rotate to do this in one step and avoid emitting
// an event for each swap
@ -233,16 +232,16 @@ void DoMoveTrack
tracks.Move(target, bUp);
longDesc =
/* i18n-hint: Past tense of 'to move', as in 'moved audio track up'.*/
bUp? _("Moved '%s' Up")
: _("Moved '%s' Down");
bUp? XO("Moved '%s' Up")
: XO("Moved '%s' Down");
shortDesc =
/* i18n-hint: Past tense of 'to move', as in 'moved audio track up'.*/
bUp? _("Move Track Up")
: _("Move Track Down");
bUp? XO("Move Track Up")
: XO("Move Track Down");
}
longDesc = longDesc.Format(target->GetName());
longDesc.Format(target->GetName());
ProjectHistory::Get( project ).PushState(longDesc, shortDesc);
}

View File

@ -50,8 +50,8 @@ using Set = std::unordered_set<ConstBlockFilePtr>;
struct UndoStackElem {
UndoStackElem(std::shared_ptr<TrackList> &&tracks_,
const wxString &description_,
const wxString &shortDescription_,
const TranslatableString &description_,
const TranslatableString &shortDescription_,
const SelectedRegion &selectedRegion_,
const std::shared_ptr<Tags> &tags_)
: state(std::move(tracks_), tags_, selectedRegion_)
@ -61,8 +61,8 @@ struct UndoStackElem {
}
UndoState state;
wxString description;
wxString shortDescription;
TranslatableString description;
TranslatableString shortDescription;
};
static const AudacityProject::AttachedObjects::RegisteredFactory key{
@ -164,8 +164,8 @@ void UndoManager::CalculateSpaceUsage()
//TIMER_STOP( space_calc );
}
wxLongLong_t UndoManager::GetLongDescription(unsigned int n, wxString *desc,
wxString *size)
wxLongLong_t UndoManager::GetLongDescription(
unsigned int n, TranslatableString *desc, wxString *size)
{
n -= 1; // 1 based to zero based
@ -179,7 +179,7 @@ wxLongLong_t UndoManager::GetLongDescription(unsigned int n, wxString *desc,
return space[n];
}
void UndoManager::GetShortDescription(unsigned int n, wxString *desc)
void UndoManager::GetShortDescription(unsigned int n, TranslatableString *desc)
{
n -= 1; // 1 based to zero based
@ -188,7 +188,8 @@ void UndoManager::GetShortDescription(unsigned int n, wxString *desc)
*desc = stack[n]->shortDescription;
}
void UndoManager::SetLongDescription(unsigned int n, const wxString &desc)
void UndoManager::SetLongDescription(
unsigned int n, const TranslatableString &desc)
{
n -= 1;
@ -275,14 +276,14 @@ void UndoManager::ModifyState(const TrackList * l,
void UndoManager::PushState(const TrackList * l,
const SelectedRegion &selectedRegion,
const std::shared_ptr<Tags> &tags,
const wxString &longDescription,
const wxString &shortDescription,
const TranslatableString &longDescription,
const TranslatableString &shortDescription,
UndoPush flags)
{
unsigned int i;
if ( ((flags & UndoPush::CONSOLIDATE) != UndoPush::MINIMAL) &&
lastAction == longDescription &&
lastAction.Translation() == longDescription.Translation() &&
mayConsolidate ) {
ModifyState(l, selectedRegion, tags);
// MB: If the "saved" state was modified by ModifyState, reset
@ -336,7 +337,7 @@ void UndoManager::SetStateTo(unsigned int n, const Consumer &consumer)
current = n;
lastAction = wxT("");
lastAction = {};
mayConsolidate = false;
consumer( stack[current]->state );
@ -351,7 +352,7 @@ void UndoManager::Undo(const Consumer &consumer)
current--;
lastAction = wxT("");
lastAction = {};
mayConsolidate = false;
consumer( stack[current]->state );
@ -379,7 +380,7 @@ void UndoManager::Redo(const Consumer &consumer)
}
*/
lastAction = wxT("");
lastAction = {};
mayConsolidate = false;
consumer( stack[current]->state );

View File

@ -125,7 +125,8 @@ class AUDACITY_DLL_API UndoManager final
void PushState(const TrackList * l,
const SelectedRegion &selectedRegion,
const std::shared_ptr<Tags> &tags,
const wxString &longDescription, const wxString &shortDescription,
const TranslatableString &longDescription,
const TranslatableString &shortDescription,
UndoPush flags = UndoPush::AUTOSAVE);
void ModifyState(const TrackList * l,
const SelectedRegion &selectedRegion, const std::shared_ptr<Tags> &tags);
@ -137,10 +138,11 @@ class AUDACITY_DLL_API UndoManager final
void StopConsolidating() { mayConsolidate = false; }
void GetShortDescription(unsigned int n, wxString *desc);
void GetShortDescription(unsigned int n, TranslatableString *desc);
// Return value must first be calculated by CalculateSpaceUsage():
wxLongLong_t GetLongDescription(unsigned int n, wxString *desc, wxString *size);
void SetLongDescription(unsigned int n, const wxString &desc);
wxLongLong_t GetLongDescription(
unsigned int n, TranslatableString *desc, wxString *size);
void SetLongDescription(unsigned int n, const TranslatableString &desc);
// These functions accept a callback that uses the state,
// and then they send to the project EVT_UNDO_RESET or EVT_UNDO_OR_REDO when
@ -178,7 +180,7 @@ class AUDACITY_DLL_API UndoManager final
int saved;
UndoStack stack;
wxString lastAction;
TranslatableString lastAction;
bool mayConsolidate { false };
SpaceArray space;

View File

@ -180,7 +180,7 @@ void EffectManager::UnregisterEffect(const PluginID & ID)
{
auto shortDesc = em.GetCommandName(ID);
auto longDesc = em.GetCommandDescription(ID);
ProjectHistory::Get( project ).PushState(longDesc.Translation(), shortDesc.Translation());
ProjectHistory::Get( project ).PushState(longDesc, shortDesc);
}
if (!(flags & EffectManager::kDontRepeatLast))

View File

@ -393,7 +393,8 @@ const ExportPluginArray &Exporter::GetPlugins()
}
bool Exporter::DoEditMetadata(AudacityProject &project,
const TranslatableString &title, const wxString &shortUndoDescription, bool force)
const TranslatableString &title,
const TranslatableString &shortUndoDescription, bool force)
{
auto &settings = ProjectSettings::Get( project );
auto &tags = Tags::Get( project );
@ -409,7 +410,7 @@ bool Exporter::DoEditMetadata(AudacityProject &project,
if (tags != *newTags) {
// Commit the change to project state only now.
Tags::Set( project, newTags );
ProjectHistory::Get( project ).PushState(title.Translation(), shortUndoDescription);
ProjectHistory::Get( project ).PushState( title, shortUndoDescription);
}
bool bShowInFuture;
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &bShowInFuture, true);
@ -446,7 +447,7 @@ bool Exporter::Process(AudacityProject *project, bool selectedOnly, double t0, d
// Let user edit MetaData
if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) {
if (!DoEditMetadata( *project,
XO("Edit Metadata Tags"), _("Exported Tags"),
XO("Edit Metadata Tags"), XO("Exported Tags"),
ProjectSettings::Get( *mProject ).GetShowId3Dialog())) {
return false;
}
@ -1103,7 +1104,7 @@ bool Exporter::SetAutoExportOptions(AudacityProject *project) {
if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) {
if (!DoEditMetadata( *project,
XO("Edit Metadata Tags"),
_("Exported Tags"),
XO("Exported Tags"),
ProjectSettings::Get(*mProject).GetShowId3Dialog())) {
return false;
}

View File

@ -178,7 +178,8 @@ public:
};
static bool DoEditMetadata(AudacityProject &project,
const TranslatableString &title, const wxString &shortUndoDescription, bool force);
const TranslatableString &title,
const TranslatableString &shortUndoDescription, bool force);
Exporter();
virtual ~Exporter();

View File

@ -44,9 +44,8 @@ bool DoImportMIDI( AudacityProject &project, const FilePath &fileName )
ProjectHistory::Get( project )
.PushState(
wxString::Format(_("Imported MIDI from '%s'"),
fileName),
_("Import MIDI")
XO("Imported MIDI from '%s'").Format( fileName ),
XO("Import MIDI")
);
ProjectWindow::Get( project ).ZoomAfterImport(pTrack);

View File

@ -714,15 +714,15 @@ void DoClipLeftOrRight
window.ScrollIntoView(selectedRegion.t0());
if (amount != 0.0) {
wxString message = right? _("Time shifted clips to the right") :
_("Time shifted clips to the left");
auto message = right? XO("Time shifted clips to the right") :
XO("Time shifted clips to the left");
// The following use of the UndoPush flags is so that both a single
// keypress (keydown, then keyup), and holding down a key
// (multiple keydowns followed by a keyup) result in a single
// entry in Audacity's history dialog.
ProjectHistory::Get( project )
.PushState(message, _("Time-Shift"), UndoPush::CONSOLIDATE);
.PushState(message, XO("Time-Shift"), UndoPush::CONSOLIDATE);
}
if ( amount == 0.0 )

View File

@ -56,7 +56,7 @@ bool DoPasteText(AudacityProject &project)
selectedRegion.t1() ))
{
ProjectHistory::Get( project )
.PushState(_("Pasted text from the clipboard"), _("Paste"));
.PushState(XO("Pasted text from the clipboard"), XO("Paste"));
// Make sure caret is in view
int x;
@ -153,7 +153,7 @@ bool DoPasteNothingSelected(AudacityProject &project)
quantT1 - quantT0);
ProjectHistory::Get( project )
.PushState(_("Pasted from the clipboard"), _("Paste"));
.PushState(XO("Pasted from the clipboard"), XO("Paste"));
if (pFirstNewTrack) {
TrackFocus::Get(project).Set(pFirstNewTrack);
@ -312,7 +312,8 @@ void OnCut(const CommandContext &context)
selectedRegion.collapseToT0();
ProjectHistory::Get( project ).PushState(_("Cut to the clipboard"), _("Cut"));
ProjectHistory::Get( project )
.PushState(XO("Cut to the clipboard"), XO("Cut"));
// Bug 1663
//mRuler->ClearPlayRegion();
@ -336,10 +337,10 @@ void OnDelete(const CommandContext &context)
selectedRegion.collapseToT0();
ProjectHistory::Get( project ).PushState(wxString::Format(_("Deleted %.2f seconds at t=%.2f"),
seconds,
selectedRegion.t0()),
_("Delete"));
ProjectHistory::Get( project ).PushState(
XO("Deleted %.2f seconds at t=%.2f")
.Format( seconds, selectedRegion.t0()),
XO("Delete"));
}
@ -635,7 +636,7 @@ void OnPaste(const CommandContext &context)
selectedRegion.setT1( t0 + clipboard.Duration() );
ProjectHistory::Get( project )
.PushState(_("Pasted from the clipboard"), _("Paste"));
.PushState(XO("Pasted from the clipboard"), XO("Paste"));
if (ff) {
TrackFocus::Get(project).Set(ff);
@ -667,7 +668,8 @@ void OnDuplicate(const CommandContext &context)
break;
}
ProjectHistory::Get( project ).PushState(_("Duplicated"), _("Duplicate"));
ProjectHistory::Get( project )
.PushState(XO("Duplicated"), XO("Duplicate"));
}
void OnSplitCut(const CommandContext &context)
@ -707,7 +709,8 @@ void OnSplitCut(const CommandContext &context)
clipboard.Assign( std::move( newClipboard ),
selectedRegion.t0(), selectedRegion.t1(), &project );
ProjectHistory::Get( project ).PushState(_("Split-cut to the clipboard"), _("Split Cut"));
ProjectHistory::Get( project )
.PushState(XO("Split-cut to the clipboard"), XO("Split Cut"));
}
void OnSplitDelete(const CommandContext &context)
@ -729,10 +732,9 @@ void OnSplitDelete(const CommandContext &context)
);
ProjectHistory::Get( project ).PushState(
wxString::Format(_("Split-deleted %.2f seconds at t=%.2f"),
selectedRegion.duration(),
selectedRegion.t0()),
_("Split Delete"));
XO("Split-deleted %.2f seconds at t=%.2f")
.Format( selectedRegion.duration(), selectedRegion.t0() ),
XO("Split Delete"));
}
void OnSilence(const CommandContext &context)
@ -745,10 +747,9 @@ void OnSilence(const CommandContext &context)
n->Silence(selectedRegion.t0(), selectedRegion.t1());
ProjectHistory::Get( project ).PushState(
wxString::Format(_("Silenced selected tracks for %.2f seconds at %.2f"),
selectedRegion.duration(),
selectedRegion.t0()),
_("Silence"));
XO("Silenced selected tracks for %.2f seconds at %.2f")
.Format( selectedRegion.duration(), selectedRegion.t0() ),
XO("Silence"));
}
void OnTrim(const CommandContext &context)
@ -770,10 +771,9 @@ void OnTrim(const CommandContext &context)
);
ProjectHistory::Get( project ).PushState(
wxString::Format(
_("Trim selected audio tracks from %.2f seconds to %.2f seconds"),
selectedRegion.t0(), selectedRegion.t1()),
_("Trim Audio"));
XO("Trim selected audio tracks from %.2f seconds to %.2f seconds")
.Format( selectedRegion.t0(), selectedRegion.t1() ),
XO("Trim Audio"));
}
void OnSplit(const CommandContext &context)
@ -788,7 +788,7 @@ void OnSplit(const CommandContext &context)
for (auto wt : tracks.Selected< WaveTrack >())
wt->Split( sel0, sel1 );
ProjectHistory::Get( project ).PushState(_("Split"), _("Split"));
ProjectHistory::Get( project ).PushState(XO("Split"), XO("Split"));
#if 0
//ANSWER-ME: Do we need to keep this commented out OnSplit() code?
// This whole section no longer used...
@ -885,7 +885,7 @@ void OnSplitNew(const CommandContext &context)
}
ProjectHistory::Get( project )
.PushState(_("Split to new track"), _("Split New"));
.PushState(XO("Split to new track"), XO("Split New"));
}
void OnJoin(const CommandContext &context)
@ -900,10 +900,9 @@ void OnJoin(const CommandContext &context)
selectedRegion.t1());
ProjectHistory::Get( project ).PushState(
wxString::Format(_("Joined %.2f seconds at t=%.2f"),
selectedRegion.duration(),
selectedRegion.t0()),
_("Join"));
XO("Joined %.2f seconds at t=%.2f")
.Format( selectedRegion.duration(), selectedRegion.t0() ),
XO("Join"));
}
void OnDisjoin(const CommandContext &context)
@ -918,17 +917,16 @@ void OnDisjoin(const CommandContext &context)
selectedRegion.t1());
ProjectHistory::Get( project ).PushState(
wxString::Format(_("Detached %.2f seconds at t=%.2f"),
selectedRegion.duration(),
selectedRegion.t0()),
_("Detach"));
XO("Detached %.2f seconds at t=%.2f")
.Format( selectedRegion.duration(), selectedRegion.t0() ),
XO("Detach"));
}
void OnEditMetadata(const CommandContext &context)
{
auto &project = context.project;
(void)Exporter::DoEditMetadata( project,
XO("Edit Metadata Tags"), _("Metadata Tags"), true);
XO("Edit Metadata Tags"), XO("Metadata Tags"), true);
}
void OnPreferences(const CommandContext &context)

View File

@ -449,8 +449,8 @@ void OnImportLabels(const CommandContext &context)
tracks.Add( newTrack );
ProjectHistory::Get( project ).PushState(
wxString::Format(_("Imported labels from '%s'"), fileName),
_("Import Labels"));
XO("Imported labels from '%s'").Format( fileName ),
XO("Import Labels"));
window.ZoomAfterImport(nullptr);
}

View File

@ -76,7 +76,8 @@ int DoAddLabel(
LabelTrackView::Get( *lt ).AddLabel(region, title, focusTrackNumber);
}
ProjectHistory::Get( project ).PushState(_("Added label"), _("Label"));
ProjectHistory::Get( project )
.PushState(XO("Added label"), XO("Label"));
if (!useDialog) {
TrackFocus::Get(project).Set(lt);
@ -345,7 +346,7 @@ void OnPasteNewLabel(const CommandContext &context)
if (bPastedSomething) {
ProjectHistory::Get( project ).PushState(
_("Pasted from the clipboard"), _("Paste Text to New Label"));
XO("Pasted from the clipboard"), XO("Paste Text to New Label"));
}
}
@ -384,9 +385,9 @@ void OnCutLabels(const CommandContext &context)
ProjectHistory::Get( project ).PushState(
/* i18n-hint: (verb) past tense. Audacity has just cut the labeled audio
regions.*/
_( "Cut labeled audio regions to clipboard" ),
XO( "Cut labeled audio regions to clipboard" ),
/* i18n-hint: (verb)*/
_( "Cut Labeled Audio" ) );
XO( "Cut Labeled Audio" ) );
}
void OnDeleteLabels(const CommandContext &context)
@ -405,9 +406,9 @@ void OnDeleteLabels(const CommandContext &context)
ProjectHistory::Get( project ).PushState(
/* i18n-hint: (verb) Audacity has just deleted the labeled audio regions*/
_( "Deleted labeled audio regions" ),
XO( "Deleted labeled audio regions" ),
/* i18n-hint: (verb)*/
_( "Delete Labeled Audio" ) );
XO( "Delete Labeled Audio" ) );
}
void OnSplitCutLabels(const CommandContext &context)
@ -426,9 +427,9 @@ void OnSplitCutLabels(const CommandContext &context)
ProjectHistory::Get( project ).PushState(
/* i18n-hint: (verb) Audacity has just split cut the labeled audio
regions*/
_( "Split Cut labeled audio regions to clipboard" ),
XO( "Split Cut labeled audio regions to clipboard" ),
/* i18n-hint: (verb) Do a special kind of cut on the labels*/
_( "Split Cut Labeled Audio" ) );
XO( "Split Cut Labeled Audio" ) );
}
void OnSplitDeleteLabels(const CommandContext &context)
@ -446,10 +447,10 @@ void OnSplitDeleteLabels(const CommandContext &context)
ProjectHistory::Get( project ).PushState(
/* i18n-hint: (verb) Audacity has just done a special kind of DELETE on
the labeled audio regions */
_( "Split Deleted labeled audio regions" ),
XO( "Split Deleted labeled audio regions" ),
/* i18n-hint: (verb) Do a special kind of DELETE on labeled audio
regions */
_( "Split Delete Labeled Audio" ) );
XO( "Split Delete Labeled Audio" ) );
}
void OnSilenceLabels(const CommandContext &context)
@ -465,9 +466,9 @@ void OnSilenceLabels(const CommandContext &context)
ProjectHistory::Get( project ).PushState(
/* i18n-hint: (verb)*/
_( "Silenced labeled audio regions" ),
XO( "Silenced labeled audio regions" ),
/* i18n-hint: (verb)*/
_( "Silence Labeled Audio" ) );
XO( "Silence Labeled Audio" ) );
}
void OnCopyLabels(const CommandContext &context)
@ -482,9 +483,9 @@ void OnCopyLabels(const CommandContext &context)
EditClipboardByLabel( project,
tracks, selectedRegion, &WaveTrack::CopyNonconst );
ProjectHistory::Get( project ).PushState( _( "Copied labeled audio regions to clipboard" ),
ProjectHistory::Get( project ).PushState( XO( "Copied labeled audio regions to clipboard" ),
/* i18n-hint: (verb)*/
_( "Copy Labeled Audio" ) );
XO( "Copy Labeled Audio" ) );
}
void OnSplitLabels(const CommandContext &context)
@ -499,9 +500,9 @@ void OnSplitLabels(const CommandContext &context)
ProjectHistory::Get( project ).PushState(
/* i18n-hint: (verb) past tense. Audacity has just split the labeled
audio (a point or a region)*/
_( "Split labeled audio (points or regions)" ),
XO( "Split labeled audio (points or regions)" ),
/* i18n-hint: (verb)*/
_( "Split Labeled Audio" ) );
XO( "Split Labeled Audio" ) );
}
void OnJoinLabels(const CommandContext &context)
@ -519,9 +520,9 @@ void OnJoinLabels(const CommandContext &context)
ProjectHistory::Get( project ).PushState(
/* i18n-hint: (verb) Audacity has just joined the labeled audio (points or
regions) */
_( "Joined labeled audio (points or regions)" ),
XO( "Joined labeled audio (points or regions)" ),
/* i18n-hint: (verb) */
_( "Join Labeled Audio" ) );
XO( "Join Labeled Audio" ) );
}
void OnDisjoinLabels(const CommandContext &context)
@ -540,9 +541,9 @@ void OnDisjoinLabels(const CommandContext &context)
/* i18n-hint: (verb) Audacity has just detached the labeled audio regions.
This message appears in history and tells you about something
Audacity has done.*/
_( "Detached labeled audio regions" ),
XO( "Detached labeled audio regions" ),
/* i18n-hint: (verb)*/
_( "Detach Labeled Audio" ) );
XO( "Detach Labeled Audio" ) );
}
}; // struct Handler

View File

@ -95,23 +95,18 @@ void DoMixAndRender
// Smart history/undo message
if (selectedCount==1) {
wxString msg;
msg.Printf(_("Rendered all audio in track '%s'"), firstName);
auto msg = XO("Rendered all audio in track '%s'").Format( firstName );
/* i18n-hint: Convert the audio into a more usable form, so apply
* panning and amplification and write to some external file.*/
ProjectHistory::Get( project ).PushState(msg, _("Render"));
ProjectHistory::Get( project ).PushState(msg, XO("Render"));
}
else {
wxString msg;
if (pNewRight)
msg.Printf(
_("Mixed and rendered %d tracks into one new stereo track"),
(int)selectedCount);
else
msg.Printf(
_("Mixed and rendered %d tracks into one new mono track"),
(int)selectedCount);
ProjectHistory::Get( project ).PushState(msg, _("Mix and Render"));
auto msg = (pNewRight
? XO("Mixed and rendered %d tracks into one new stereo track")
: XO("Mixed and rendered %d tracks into one new mono track")
)
.Format( (int)selectedCount );
ProjectHistory::Get( project ).PushState(msg, XO("Mix and Render"));
}
trackPanel.SetFocus();
@ -137,7 +132,7 @@ void DoPanTracks(AudacityProject &project, float PanValue)
auto flags = UndoPush::AUTOSAVE;
/*i18n-hint: One or more audio tracks have been panned*/
ProjectHistory::Get( project )
.PushState(_("Panned audio track(s)"), _("Pan Track"), flags);
.PushState(XO("Panned audio track(s)"), XO("Pan Track"), flags);
flags = flags | UndoPush::CONSOLIDATE;
}
@ -169,8 +164,7 @@ void DoAlign
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto &window = ProjectWindow::Get( project );
wxString action;
wxString shortAction;
TranslatableString action, shortAction;
double delta = 0.0;
double newPos = -1.0;
@ -198,72 +192,72 @@ void DoAlign
times, and the time selection may be "moved" too. The first
noun -- "start" in this example -- is the object of a verb (not of
an implied preposition "from"). */
? _("Aligned/Moved start to zero")
: _("Aligned start to zero");
? XO("Aligned/Moved start to zero")
: XO("Aligned start to zero");
/* i18n-hint: This and similar messages give shorter descriptions of
the aligning and moving editing actions */
shortAction = moveSel
? _("Align/Move Start")
: _("Align Start");
? XO("Align/Move Start")
: XO("Align Start");
break;
case kAlignStartSelStart:
delta = selectedRegion.t0() - minOffset();
action = moveSel
? _("Aligned/Moved start to cursor/selection start")
: _("Aligned start to cursor/selection start");
? XO("Aligned/Moved start to cursor/selection start")
: XO("Aligned start to cursor/selection start");
shortAction = moveSel
? _("Align/Move Start")
: _("Align Start");
? XO("Align/Move Start")
: XO("Align Start");
break;
case kAlignStartSelEnd:
delta = selectedRegion.t1() - minOffset();
action = moveSel
? _("Aligned/Moved start to selection end")
: _("Aligned start to selection end");
? XO("Aligned/Moved start to selection end")
: XO("Aligned start to selection end");
shortAction = moveSel
? _("Align/Move Start")
: _("Align Start");
? XO("Align/Move Start")
: XO("Align Start");
break;
case kAlignEndSelStart:
delta = selectedRegion.t0() - maxEndOffset();
action = moveSel
? _("Aligned/Moved end to cursor/selection start")
: _("Aligned end to cursor/selection start");
? XO("Aligned/Moved end to cursor/selection start")
: XO("Aligned end to cursor/selection start");
shortAction =
moveSel
? _("Align/Move End")
: _("Align End");
? XO("Align/Move End")
: XO("Align End");
break;
case kAlignEndSelEnd:
delta = selectedRegion.t1() - maxEndOffset();
action = moveSel
? _("Aligned/Moved end to selection end")
: _("Aligned end to selection end");
? XO("Aligned/Moved end to selection end")
: XO("Aligned end to selection end");
shortAction =
moveSel
? _("Align/Move End")
: _("Align End");
? XO("Align/Move End")
: XO("Align End");
break;
// index set in alignLabelsNoSync
case kAlignEndToEnd:
newPos = firstTrackOffset();
action = moveSel
? _("Aligned/Moved end to end")
: _("Aligned end to end");
? XO("Aligned/Moved end to end")
: XO("Aligned end to end");
shortAction =
moveSel
? _("Align/Move End to End")
: _("Align End to End");
? XO("Align/Move End to End")
: XO("Align End to End");
break;
case kAlignTogether:
newPos = avgOffset();
action = moveSel
? _("Aligned/Moved together")
: _("Aligned together");
? XO("Aligned/Moved together")
: XO("Aligned together");
shortAction =
moveSel
? _("Align/Move Together")
: _("Align Together");
? XO("Align/Move Together")
: XO("Align Together");
}
if ((unsigned)index >= kAlignLabelsCount) {
@ -541,7 +535,7 @@ void SetTrackGain(AudacityProject &project, WaveTrack * wt, LWSlider * slider)
channel->SetGain(newValue);
ProjectHistory::Get( project )
.PushState(_("Adjusted gain"), _("Gain"), UndoPush::CONSOLIDATE);
.PushState(XO("Adjusted gain"), XO("Gain"), UndoPush::CONSOLIDATE);
TrackPanel::Get( project ).RefreshTrack(wt);
}
@ -555,7 +549,7 @@ void SetTrackPan(AudacityProject &project, WaveTrack * wt, LWSlider * slider)
channel->SetPan(newValue);
ProjectHistory::Get( project )
.PushState(_("Adjusted Pan"), _("Pan"), UndoPush::CONSOLIDATE);
.PushState(XO("Adjusted Pan"), XO("Pan"), UndoPush::CONSOLIDATE);
TrackPanel::Get( project ).RefreshTrack(wt);
}
@ -585,7 +579,7 @@ void OnNewWaveTrack(const CommandContext &context)
t->SetSelected(true);
ProjectHistory::Get( project )
.PushState(_("Created new audio track"), _("New Track"));
.PushState(XO("Created new audio track"), XO("New Track"));
TrackFocus::Get(project).Set(t);
t->EnsureVisible();
@ -613,7 +607,7 @@ void OnNewStereoTrack(const CommandContext &context)
tracks.GroupChannels(*left, 2);
ProjectHistory::Get( project )
.PushState(_("Created new stereo audio track"), _("New Track"));
.PushState(XO("Created new stereo audio track"), XO("New Track"));
TrackFocus::Get(project).Set(left);
left->EnsureVisible();
@ -633,7 +627,7 @@ void OnNewLabelTrack(const CommandContext &context)
t->SetSelected(true);
ProjectHistory::Get( project )
.PushState(_("Created new label track"), _("New Track"));
.PushState(XO("Created new label track"), XO("New Track"));
TrackFocus::Get(project).Set(t);
t->EnsureVisible();
@ -658,7 +652,7 @@ void OnNewTimeTrack(const CommandContext &context)
t->SetSelected(true);
ProjectHistory::Get( project )
.PushState(_("Created new time track"), _("New Track"));
.PushState(XO("Created new time track"), XO("New Track"));
TrackFocus::Get(project).Set(t);
t->EnsureVisible();
@ -778,7 +772,7 @@ void OnResample(const CommandContext &context)
// consolidate.
ProjectHistory::Get( project ).PushState(
_("Resampled audio track(s)"), _("Resample Track"), flags);
XO("Resampled audio track(s)"), XO("Resample Track"), flags);
flags = flags | UndoPush::CONSOLIDATE;
}
@ -1016,7 +1010,7 @@ void OnSortTime(const CommandContext &context)
DoSortTracks(project, kAudacitySortByTime);
ProjectHistory::Get( project )
.PushState(_("Tracks sorted by time"), _("Sort by Time"));
.PushState(XO("Tracks sorted by time"), XO("Sort by Time"));
}
void OnSortName(const CommandContext &context)
@ -1025,7 +1019,7 @@ void OnSortName(const CommandContext &context)
DoSortTracks(project, kAudacitySortByName);
ProjectHistory::Get( project )
.PushState(_("Tracks sorted by name"), _("Sort by Name"));
.PushState(XO("Tracks sorted by name"), XO("Sort by Name"));
}
void OnSyncLock(const CommandContext &context)

View File

@ -378,8 +378,8 @@ UIHandle::Result LabelGlyphHandle::Release
auto &viewInfo = ViewInfo::Get( *pProject );
if (HandleGlyphDragRelease(
*pProject, *mpHit, event, mRect, viewInfo, viewInfo.selectedRegion)) {
ProjectHistory::Get( *pProject ).PushState(_("Modified Label"),
_("Label Edit"),
ProjectHistory::Get( *pProject ).PushState(XO("Modified Label"),
XO("Label Edit"),
UndoPush::CONSOLIDATE);
}

View File

@ -1292,8 +1292,8 @@ unsigned LabelTrackView::KeyDown(
// Pass keystroke to labeltrack's handler and add to history if any
// updates were done
if (DoKeyDown( *project, viewInfo.selectedRegion, event )) {
ProjectHistory::Get( *project ).PushState(_("Modified Label"),
_("Label Edit"),
ProjectHistory::Get( *project ).PushState(XO("Modified Label"),
XO("Label Edit"),
UndoPush::CONSOLIDATE);
}
@ -1322,8 +1322,8 @@ unsigned LabelTrackView::Char(
// updates were done
if (DoChar( *project, viewInfo.selectedRegion, event ))
ProjectHistory::Get( *project ).PushState(_("Modified Label"),
_("Label Edit"),
ProjectHistory::Get( *project ).PushState(XO("Modified Label"),
XO("Label Edit"),
UndoPush::CONSOLIDATE);
// If selection modified, refresh
@ -1614,13 +1614,15 @@ bool LabelTrackView::DoChar(
}
pTrack->SetSelected(true);
pTrack->AddLabel(selectedRegion, title);
ProjectHistory::Get( project ).PushState(_("Added label"), _("Label"));
ProjectHistory::Get( project )
.PushState(XO("Added label"), XO("Label"));
return false;
}
else {
pTrack->SetSelected(true);
AddLabel( selectedRegion );
ProjectHistory::Get( project ).PushState(_("Added label"), _("Label"));
ProjectHistory::Get( project )
.PushState(XO("Added label"), XO("Label"));
}
}
@ -1734,8 +1736,8 @@ void LabelTrackView::OnContextMenu(
case OnCutSelectedTextID:
if (CutSelectedText( project ))
{
ProjectHistory::Get( project ).PushState(_("Modified Label"),
_("Label Edit"),
ProjectHistory::Get( project ).PushState(XO("Modified Label"),
XO("Label Edit"),
UndoPush::CONSOLIDATE);
}
break;
@ -1750,8 +1752,8 @@ void LabelTrackView::OnContextMenu(
if (PasteSelectedText(
project, selectedRegion.t0(), selectedRegion.t1() ))
{
ProjectHistory::Get( project ).PushState(_("Modified Label"),
_("Label Edit"),
ProjectHistory::Get( project ).PushState(XO("Modified Label"),
XO("Label Edit"),
UndoPush::CONSOLIDATE);
}
break;
@ -1763,8 +1765,8 @@ void LabelTrackView::OnContextMenu(
{
const auto pTrack = FindLabelTrack();
pTrack->DeleteLabel(ndx);
ProjectHistory::Get( project ).PushState(_("Deleted Label"),
_("Label Edit"),
ProjectHistory::Get( project ).PushState(XO("Deleted Label"),
XO("Label Edit"),
UndoPush::CONSOLIDATE);
}
}
@ -2060,7 +2062,7 @@ void LabelTrackView::DoEditLabels
if (dlg.ShowModal() == wxID_OK) {
ProjectHistory::Get( project )
.PushState(_("Edited labels"), _("Label"));
.PushState(XO("Edited labels"), XO("Label"));
}
}

View File

@ -64,7 +64,7 @@ UIHandle::Result VelocitySliderHandle::CommitChanges
(const wxMouseEvent &, AudacityProject *pProject)
{
ProjectHistory::Get( *pProject )
.PushState(_("Moved velocity slider"), _("Velocity"),
.PushState(XO("Moved velocity slider"), XO("Velocity"),
UndoPush::CONSOLIDATE);
return RefreshCode::RefreshCell;
}

View File

@ -252,12 +252,12 @@ UIHandle::Result StretchHandle::Release
/* i18n-hint: (noun) The track that is used for MIDI notes which can be
dragged to change their duration.*/
ProjectHistory::Get( *pProject ).PushState(_("Stretch Note Track"),
ProjectHistory::Get( *pProject ).PushState(XO("Stretch Note Track"),
/* i18n-hint: In the history list, indicates a MIDI note has
been dragged to change its duration (stretch it). Using either past
or present tense is fine here. If unsure, go for whichever is
shorter.*/
_("Stretch"),
XO("Stretch"),
UndoPush::CONSOLIDATE | UndoPush::AUTOSAVE);
return RefreshAll;
}

View File

@ -224,15 +224,15 @@ UIHandle::Result CutlineHandle::Release
wxASSERT(false);
case Merge:
ProjectHistory::Get( *pProject )
.PushState(_("Merged Clips"), _("Merge"), UndoPush::CONSOLIDATE);
.PushState(XO("Merged Clips"), XO("Merge"), UndoPush::CONSOLIDATE);
break;
case Expand:
ProjectHistory::Get( *pProject )
.PushState(_("Expanded Cut Line"), _("Expand"));
.PushState(XO("Expanded Cut Line"), XO("Expand"));
break;
case Remove:
ProjectHistory::Get( *pProject )
.PushState(_("Removed Cut Line"), _("Remove"));
.PushState(XO("Removed Cut Line"), XO("Remove"));
break;
}

View File

@ -419,8 +419,8 @@ UIHandle::Result SampleHandle::Release
//*************************************************
//On up-click, send the state to the undo stack
mClickedTrack.reset(); //Set this to NULL so it will catch improper drag events.
ProjectHistory::Get( *pProject ).PushState(_("Moved Samples"),
_("Sample Edit"),
ProjectHistory::Get( *pProject ).PushState(XO("Moved Samples"),
XO("Sample Edit"),
UndoPush::CONSOLIDATE | UndoPush::AUTOSAVE);
// No change to draw since last drag

View File

@ -188,21 +188,21 @@ void WaveColorMenuTable::InitMenu(Menu *pMenu, void *pUserData)
}
}
const wxString GetWaveColorStr(int colorIndex)
const TranslatableString GetWaveColorStr(int colorIndex)
{
return wxString::Format( _("Instrument %i"), colorIndex+1 );
return XO("Instrument %i").Format( colorIndex+1 );
}
BEGIN_POPUP_MENU(WaveColorMenuTable)
POPUP_MENU_RADIO_ITEM(OnInstrument1ID,
GetWaveColorStr(0), OnWaveColorChange)
GetWaveColorStr(0).Translation(), OnWaveColorChange)
POPUP_MENU_RADIO_ITEM(OnInstrument2ID,
GetWaveColorStr(1), OnWaveColorChange)
GetWaveColorStr(1).Translation(), OnWaveColorChange)
POPUP_MENU_RADIO_ITEM(OnInstrument3ID,
GetWaveColorStr(2), OnWaveColorChange)
GetWaveColorStr(2).Translation(), OnWaveColorChange)
POPUP_MENU_RADIO_ITEM(OnInstrument4ID,
GetWaveColorStr(3), OnWaveColorChange)
GetWaveColorStr(3).Translation(), OnWaveColorChange)
END_POPUP_MENU()
/// Converts a WaveColor enumeration to a wxWidgets menu item Id.
@ -225,10 +225,9 @@ void WaveColorMenuTable::OnWaveColorChange(wxCommandEvent & event)
channel->SetWaveColorIndex(newWaveColor);
ProjectHistory::Get( *project )
.PushState(wxString::Format(_("Changed '%s' to %s"),
pTrack->GetName(),
GetWaveColorStr(newWaveColor)),
_("WaveColor Change"));
.PushState(XO("Changed '%s' to %s")
.Format( pTrack->GetName(), GetWaveColorStr(newWaveColor) ),
XO("WaveColor Change"));
using namespace RefreshCode;
mpData->result = RefreshAll | FixScrollbars;
@ -284,11 +283,11 @@ void FormatMenuTable::InitMenu(Menu *pMenu, void *pUserData)
BEGIN_POPUP_MENU(FormatMenuTable)
POPUP_MENU_RADIO_ITEM(On16BitID,
GetSampleFormatStr(int16Sample), OnFormatChange)
GetSampleFormatStr(int16Sample).Translation(), OnFormatChange)
POPUP_MENU_RADIO_ITEM(On24BitID,
GetSampleFormatStr(int24Sample), OnFormatChange)
GetSampleFormatStr(int24Sample).Translation(), OnFormatChange)
POPUP_MENU_RADIO_ITEM(OnFloatID,
GetSampleFormatStr(floatSample), OnFormatChange)
GetSampleFormatStr(floatSample).Translation(), OnFormatChange)
END_POPUP_MENU()
/// Converts a format enumeration to a wxWidgets menu item Id.
@ -344,10 +343,9 @@ void FormatMenuTable::OnFormatChange(wxCommandEvent & event)
/* i18n-hint: The strings name a track and a format */
ProjectHistory::Get( *project )
.PushState(wxString::Format(_("Changed '%s' to %s"),
pTrack->GetName(),
GetSampleFormatStr(newFormat)),
_("Format Change"));
.PushState(XO("Changed '%s' to %s")
.Format( pTrack->GetName(), GetSampleFormatStr(newFormat) ),
XO("Format Change"));
using namespace RefreshCode;
mpData->result = RefreshAll | FixScrollbars;
@ -449,9 +447,9 @@ void RateMenuTable::SetRate(WaveTrack * pTrack, double rate)
wxString rateString = wxString::Format(wxT("%.3f"), rate);
/* i18n-hint: The string names a track */
ProjectHistory::Get( *project )
.PushState(wxString::Format(_("Changed '%s' to %s Hz"),
pTrack->GetName(), rateString),
_("Rate Change"));
.PushState(XO("Changed '%s' to %s Hz")
.Format( pTrack->GetName(), rateString),
XO("Rate Change"));
}
/// This method handles the selection from the Rate
@ -922,10 +920,9 @@ void WaveTrackMenuTable::OnMergeStereo(wxCommandEvent &)
}
/* i18n-hint: The string names a track */
ProjectHistory::Get( *project )
.PushState(wxString::Format(_("Made '%s' a stereo track"),
pTrack->GetName()),
_("Make Stereo"));
ProjectHistory::Get( *project ).PushState(
XO("Made '%s' a stereo track").Format( pTrack->GetName() ),
XO("Make Stereo"));
using namespace RefreshCode;
mpData->result = RefreshAll | FixScrollbars;
@ -993,10 +990,9 @@ void WaveTrackMenuTable::OnSwapChannels(wxCommandEvent &)
trackFocus.Set(partner);
/* i18n-hint: The string names a track */
ProjectHistory::Get( *project )
.PushState(wxString::Format(_("Swapped Channels in '%s'"),
pTrack->GetName()),
_("Swap Channels"));
ProjectHistory::Get( *project ).PushState(
XO("Swapped Channels in '%s'").Format( pTrack->GetName() ),
XO("Swap Channels"));
mpData->result = RefreshCode::RefreshAll;
}
@ -1008,10 +1004,9 @@ void WaveTrackMenuTable::OnSplitStereo(wxCommandEvent &)
WaveTrack *const pTrack = static_cast<WaveTrack*>(mpData->pTrack);
AudacityProject *const project = ::GetActiveProject();
/* i18n-hint: The string names a track */
ProjectHistory::Get( *project )
.PushState(wxString::Format(_("Split stereo track '%s'"),
pTrack->GetName()),
_("Split"));
ProjectHistory::Get( *project ).PushState(
XO("Split stereo track '%s'").Format( pTrack->GetName() ),
XO("Split"));
using namespace RefreshCode;
mpData->result = RefreshAll | FixScrollbars;
@ -1024,10 +1019,9 @@ void WaveTrackMenuTable::OnSplitStereoMono(wxCommandEvent &)
WaveTrack *const pTrack = static_cast<WaveTrack*>(mpData->pTrack);
AudacityProject *const project = ::GetActiveProject();
/* i18n-hint: The string names a track */
ProjectHistory::Get( *project ).
PushState(wxString::Format(_("Split Stereo to Mono '%s'"),
pTrack->GetName()),
_("Split to Mono"));
ProjectHistory::Get( *project ).PushState(
XO("Split Stereo to Mono '%s'").Format( pTrack->GetName() ),
XO("Split to Mono"));
using namespace RefreshCode;
mpData->result = RefreshAll | FixScrollbars;
@ -1088,10 +1082,10 @@ void GainSliderDrawFunction
}
void StatusDrawFunction
( const wxString &string, wxDC *dc, const wxRect &rect )
( const TranslatableString &string, wxDC *dc, const wxRect &rect )
{
static const int offset = 3;
dc->DrawText(string, rect.x + offset, rect.y);
dc->DrawText(string.Translation(), rect.x + offset, rect.y);
}
void Status1DrawFunction
@ -1105,20 +1099,20 @@ void Status1DrawFunction
/// indicating whether the track is mono, left, right, or
/// stereo and what sample rate it's using.
auto rate = wt ? wt->GetRate() : 44100.0;
wxString s;
TranslatableString s;
if (!pTrack || TrackList::Channels(pTrack).size() > 1)
// TODO: more-than-two-channels-message
// more appropriate strings
s = _("Stereo, %dHz");
s = XO("Stereo, %dHz");
else {
if (wt->GetChannel() == Track::MonoChannel)
s = _("Mono, %dHz");
s = XO("Mono, %dHz");
else if (wt->GetChannel() == Track::LeftChannel)
s = _("Left, %dHz");
s = XO("Left, %dHz");
else if (wt->GetChannel() == Track::RightChannel)
s = _("Right, %dHz");
s = XO("Right, %dHz");
}
s = wxString::Format( s, (int) (rate + 0.5) );
s.Format( (int) (rate + 0.5) );
StatusDrawFunction( s, dc, rect );
}

View File

@ -60,7 +60,7 @@ UIHandle::Result GainSliderHandle::CommitChanges
(const wxMouseEvent &, AudacityProject *pProject)
{
ProjectHistory::Get( *pProject )
.PushState(_("Moved gain slider"), _("Gain"), UndoPush::CONSOLIDATE);
.PushState(XO("Moved gain slider"), XO("Gain"), UndoPush::CONSOLIDATE);
return RefreshCode::RefreshCell;
}
@ -139,7 +139,7 @@ UIHandle::Result PanSliderHandle::CommitChanges
(const wxMouseEvent &, AudacityProject *pProject)
{
ProjectHistory::Get( *pProject )
.PushState(_("Moved pan slider"), _("Pan"), UndoPush::CONSOLIDATE);
.PushState(XO("Moved pan slider"), XO("Pan"), UndoPush::CONSOLIDATE);
return RefreshCode::RefreshCell;
}

View File

@ -106,11 +106,9 @@ void TimeTrackMenuTable::OnSetTimeTrackRange(wxCommandEvent & /*event*/)
pTrack->SetRangeLower((double)lower / 100.0);
pTrack->SetRangeUpper((double)upper / 100.0);
ProjectHistory::Get( *project )
.PushState(wxString::Format(_("Set range to '%ld' - '%ld'"),
lower,
upper),
/* i18n-hint: (verb)*/
_("Set Range"));
.PushState(XO("Set range to '%ld' - '%ld'").Format( lower, upper ),
/* i18n-hint: (verb)*/
XO("Set Range"));
mpData->result = RefreshCode::RefreshAll;
}
}
@ -122,7 +120,7 @@ void TimeTrackMenuTable::OnTimeTrackLin(wxCommandEvent & /*event*/)
pTrack->SetDisplayLog(false);
AudacityProject *const project = ::GetActiveProject();
ProjectHistory::Get( *project )
.PushState(_("Set time track display to linear"), _("Set Display"));
.PushState(XO("Set time track display to linear"), XO("Set Display"));
using namespace RefreshCode;
mpData->result = RefreshAll | UpdateVRuler;
@ -134,7 +132,7 @@ void TimeTrackMenuTable::OnTimeTrackLog(wxCommandEvent & /*event*/)
pTrack->SetDisplayLog(true);
AudacityProject *const project = ::GetActiveProject();
ProjectHistory::Get( *project )
.PushState(_("Set time track display to logarithmic"), _("Set Display"));
.PushState(XO("Set time track display to logarithmic"), XO("Set Display"));
using namespace RefreshCode;
mpData->result = RefreshAll | UpdateVRuler;
@ -147,12 +145,12 @@ void TimeTrackMenuTable::OnTimeTrackLogInt(wxCommandEvent & /*event*/)
if (pTrack->GetInterpolateLog()) {
pTrack->SetInterpolateLog(false);
ProjectHistory::Get( *project )
.PushState(_("Set time track interpolation to linear"), _("Set Interpolation"));
.PushState(XO("Set time track interpolation to linear"), XO("Set Interpolation"));
}
else {
pTrack->SetInterpolateLog(true);
ProjectHistory::Get( *project ).
PushState(_("Set time track interpolation to logarithmic"), _("Set Interpolation"));
PushState(XO("Set time track interpolation to logarithmic"), XO("Set Interpolation"));
}
mpData->result = RefreshCode::RefreshAll;
}

View File

@ -211,10 +211,9 @@ void TrackMenuTable::OnSetName(wxCommandEvent &)
channel->SetName(newName);
ProjectHistory::Get( *proj )
.PushState(wxString::Format(_("Renamed '%s' to '%s'"),
oldName,
newName),
_("Name Change"));
.PushState(
XO("Renamed '%s' to '%s'").Format( oldName, newName ),
XO("Name Change"));
mpData->result = RefreshCode::RefreshAll;
}

View File

@ -284,9 +284,9 @@ UIHandle::Result EnvelopeHandle::Release
ProjectHistory::Get( *pProject ).PushState(
/* i18n-hint: (verb) Audacity has just adjusted the envelope .*/
_("Adjusted envelope."),
XO("Adjusted envelope."),
/* i18n-hint: The envelope is a curve that controls the audio loudness.*/
_("Envelope")
XO("Envelope")
);
mEnvelopeEditors.clear();

View File

@ -822,21 +822,21 @@ UIHandle::Result TimeShiftHandle::Release
}
}
wxString msg;
TranslatableString msg;
bool consolidate;
if (mDidSlideVertically) {
msg = _("Moved clips to another track");
msg = XO("Moved clips to another track");
consolidate = false;
}
else {
msg.Printf(
( mClipMoveState.hSlideAmount > 0
? _("Time shifted tracks/clips right %.02f seconds")
: _("Time shifted tracks/clips left %.02f seconds") ),
fabs( mClipMoveState.hSlideAmount ) );
msg = ( mClipMoveState.hSlideAmount > 0
? XO("Time shifted tracks/clips right %.02f seconds")
: XO("Time shifted tracks/clips left %.02f seconds")
)
.Format( fabs( mClipMoveState.hSlideAmount ) );
consolidate = true;
}
ProjectHistory::Get( *pProject ).PushState(msg, _("Time-Shift"),
ProjectHistory::Get( *pProject ).PushState(msg, XO("Time-Shift"),
consolidate ? (UndoPush::CONSOLIDATE) : (UndoPush::AUTOSAVE));
return result | FixScrollbars;

View File

@ -183,12 +183,10 @@ UIHandle::Result TrackSelectHandle::Release
if (mRearrangeCount != 0) {
AudacityProject *const project = ::GetActiveProject();
ProjectHistory::Get( *project ).PushState(
wxString::Format(
/* i18n-hint: will substitute name of track for %s */
( mRearrangeCount < 0 ? _("Moved '%s' up") : _("Moved '%s' down") ),
mpTrack->GetName()
),
_("Move Track"));
/* i18n-hint: will substitute name of track for %s */
( mRearrangeCount < 0 ? XO("Moved '%s' up") : XO("Moved '%s' down") )
.Format( mpTrack->GetName() ),
XO("Move Track"));
}
// Bug 1677
// Holding on to the reference to the track was causing it to be released far later