From 0cf7964e38c18aef578f781a85d7be677cdd3208 Mon Sep 17 00:00:00 2001 From: James Crook Date: Fri, 23 Mar 2018 14:17:05 +0000 Subject: [PATCH] Bug 1661 - Default audio track name not being translated We need a blank name stored in the config, if the name is the local version of "Audio Tracks" --- src/prefs/PrefsDialog.cpp | 4 +++- src/prefs/TracksPrefs.cpp | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/prefs/PrefsDialog.cpp b/src/prefs/PrefsDialog.cpp index 9e0f4405d..d0f046973 100644 --- a/src/prefs/PrefsDialog.cpp +++ b/src/prefs/PrefsDialog.cpp @@ -478,7 +478,9 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event)) gPrefs->Flush(); if (mCategories) { // Now apply the changes - for (size_t i = 0; i < mCategories->GetPageCount(); i++) { + // Reverse order - so Track Name is updated before language change + // A workaround for Bug 1661 + for (int i = (int)mCategories->GetPageCount()-1; i>= 0; i--) { PrefsPanel *panel = (PrefsPanel *)mCategories->GetPage(i); panel->Preview(); diff --git a/src/prefs/TracksPrefs.cpp b/src/prefs/TracksPrefs.cpp index c076cdfef..f8e799517 100644 --- a/src/prefs/TracksPrefs.cpp +++ b/src/prefs/TracksPrefs.cpp @@ -217,7 +217,8 @@ wxString TracksPrefs::GetDefaultAudioTrackNamePreference() { const auto name = gPrefs->Read(wxT("/GUI/TrackNames/DefaultTrackName"), wxT("")); - if (name.empty()) + + if (name.empty() || ( name == "Audio Track" )) // When nothing was specified, // the default-default is whatever translation of... /* i18n-hint: The default name for an audio track. */ @@ -233,8 +234,9 @@ bool TracksPrefs::Commit() ShuttleGui S(this, eIsSavingToPrefs); PopulateOrExchange(S); - if (gPrefs->Read(wxT("/GUI/TrackNames/DefaultTrackName"), - _("Audio Track")) == _("Audio Track")) { + // Bug 1661: Don't store the name for new tracks if the name is the + // default in that language. + if (GetDefaultAudioTrackNamePreference() == _("Audio Track")) { gPrefs->DeleteEntry(wxT("/GUI/TrackNames/DefaultTrackName")); gPrefs->Flush(); }