1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-27 07:43:50 +01:00

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

@@ -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)