mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 08:09:32 +02:00
Remove GUIPrefs::InitLang...
... Expand it in AudacityApp where initializing i18n services. Just call SetLang directly in CrashReport, because the argument was not null. Also eliminate call to SetLang in Nyquist, where really only the system language was needed.
This commit is contained in:
parent
ad5f895f65
commit
91e4eeadb8
@ -195,7 +195,7 @@ void PopulatePreferences()
|
|||||||
auto &ini = *pIni;
|
auto &ini = *pIni;
|
||||||
|
|
||||||
wxString lang;
|
wxString lang;
|
||||||
if (ini.Read(wxT("/FromInno/Language"), &lang))
|
if (ini.Read(wxT("/FromInno/Language"), &lang) && !lang.empty())
|
||||||
{
|
{
|
||||||
// Only change "langCode" if the language was actually specified in the ini file.
|
// Only change "langCode" if the language was actually specified in the ini file.
|
||||||
langCode = lang;
|
langCode = lang;
|
||||||
@ -217,7 +217,12 @@ void PopulatePreferences()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
langCode = GUIPrefs::InitLang( langCode );
|
// Use the system default language if one wasn't specified or if the user selected System.
|
||||||
|
if (langCode.empty())
|
||||||
|
langCode =
|
||||||
|
Languages::GetSystemLanguageCode(FileNames::AudacityPathList());
|
||||||
|
|
||||||
|
langCode = GUIPrefs::SetLang( langCode );
|
||||||
|
|
||||||
// User requested that the preferences be completely reset
|
// User requested that the preferences be completely reset
|
||||||
if (resetPrefs)
|
if (resetPrefs)
|
||||||
|
@ -60,8 +60,8 @@ void Generate(wxDebugReport::Context ctx)
|
|||||||
if (ctx == wxDebugReport::Context_Current)
|
if (ctx == wxDebugReport::Context_Current)
|
||||||
{
|
{
|
||||||
auto saveLang = GUIPrefs::GetLangShort();
|
auto saveLang = GUIPrefs::GetLangShort();
|
||||||
GUIPrefs::InitLang( wxT("en") );
|
GUIPrefs::SetLang( wxT("en") );
|
||||||
auto cleanup = finally( [&]{ GUIPrefs::InitLang( saveLang ); } );
|
auto cleanup = finally( [&]{ GUIPrefs::SetLang( saveLang ); } );
|
||||||
|
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIOBase::Get();
|
||||||
rpt.AddText(wxT("audiodev.txt"), gAudioIO->GetDeviceInfo(), wxT("Audio Device Info"));
|
rpt.AddText(wxT("audiodev.txt"), gAudioIO->GetDeviceInfo(), wxT("Audio Device Info"));
|
||||||
|
@ -54,6 +54,7 @@ effects from this one class.
|
|||||||
#include "../EffectManager.h"
|
#include "../EffectManager.h"
|
||||||
#include "../../FileNames.h"
|
#include "../../FileNames.h"
|
||||||
#include "../../LabelTrack.h"
|
#include "../../LabelTrack.h"
|
||||||
|
#include "../../Languages.h"
|
||||||
#include "../../NoteTrack.h"
|
#include "../../NoteTrack.h"
|
||||||
#include "../../TimeTrack.h"
|
#include "../../TimeTrack.h"
|
||||||
#include "../../prefs/SpectrogramSettings.h"
|
#include "../../prefs/SpectrogramSettings.h"
|
||||||
@ -700,7 +701,9 @@ bool NyquistEffect::Process()
|
|||||||
|
|
||||||
mProps += wxString::Format(wxT("(putprop '*AUDACITY* (list %d %d %d) 'VERSION)\n"), AUDACITY_VERSION, AUDACITY_RELEASE, AUDACITY_REVISION);
|
mProps += wxString::Format(wxT("(putprop '*AUDACITY* (list %d %d %d) 'VERSION)\n"), AUDACITY_VERSION, AUDACITY_RELEASE, AUDACITY_REVISION);
|
||||||
wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
|
wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
|
||||||
lang = (lang.empty())? GUIPrefs::SetLang(lang) : lang;
|
lang = (lang.empty())
|
||||||
|
? Languages::GetSystemLanguageCode(FileNames::AudacityPathList())
|
||||||
|
: lang;
|
||||||
mProps += wxString::Format(wxT("(putprop '*AUDACITY* \"%s\" 'LANGUAGE)\n"), lang);
|
mProps += wxString::Format(wxT("(putprop '*AUDACITY* \"%s\" 'LANGUAGE)\n"), lang);
|
||||||
|
|
||||||
mProps += wxString::Format(wxT("(setf *DECIMAL-SEPARATOR* #\\%c)\n"), wxNumberFormatter::GetDecimalSeparator());
|
mProps += wxString::Format(wxT("(setf *DECIMAL-SEPARATOR* #\\%c)\n"), wxNumberFormatter::GetDecimalSeparator());
|
||||||
|
@ -254,22 +254,6 @@ bool GUIPrefs::Commit()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString GUIPrefs::InitLang( wxString langCode )
|
|
||||||
{
|
|
||||||
if ( langCode.empty() )
|
|
||||||
langCode = gPrefs->Read(wxT("/Locale/Language"), wxEmptyString);
|
|
||||||
|
|
||||||
// Use the system default language if one wasn't specified or if the user selected System.
|
|
||||||
if (langCode.empty())
|
|
||||||
{
|
|
||||||
langCode =
|
|
||||||
Languages::GetSystemLanguageCode(FileNames::AudacityPathList());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize the language
|
|
||||||
return SetLang(langCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::unique_ptr<wxLocale> sLocale;
|
static std::unique_ptr<wxLocale> sLocale;
|
||||||
static wxString sLocaleName;
|
static wxString sLocaleName;
|
||||||
|
|
||||||
|
@ -40,11 +40,6 @@ class AUDACITY_DLL_API GUIPrefs final : public PrefsPanel
|
|||||||
int *pDefaultRangeIndex = nullptr
|
int *pDefaultRangeIndex = nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
// If no input language given, defaults first to choice in preferences, then
|
|
||||||
// to system language.
|
|
||||||
// Returns the language actually used which is not lang if lang cannot be found.
|
|
||||||
static wxString InitLang( wxString lang = {} );
|
|
||||||
|
|
||||||
// If no input language given, defaults to system language.
|
// If no input language given, defaults to system language.
|
||||||
// Returns the language actually used which is not lang if lang cannot be found.
|
// Returns the language actually used which is not lang if lang cannot be found.
|
||||||
static wxString SetLang( const wxString & lang );
|
static wxString SetLang( const wxString & lang );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user