From b2382eab2a6a1495730f1c89f068b2cc2b867a1d Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 6 Sep 2017 16:35:08 -0400 Subject: [PATCH] Translation of Quality preference choices --- src/Resample.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Resample.cpp b/src/Resample.cpp index 5abde49b7..e8d914fa5 100644 --- a/src/Resample.cpp +++ b/src/Resample.cpp @@ -24,6 +24,7 @@ #include "Resample.h" #include "Prefs.h" +#include "TranslatableStringArray.h" #include @@ -52,11 +53,28 @@ int Resample::GetNumMethods() { return 4; } wxString Resample::GetMethodName(int index) { - static char const * const soxr_method_names[] = { - "Low Quality (Fastest)", "Medium Quality", "High Quality", "Best Quality (Slowest)" + static const wxString soxr_method_names[] = { + XO("Low Quality (Fastest)"), + XO("Medium Quality"), + XO("High Quality"), + XO("Best Quality (Slowest)") }; - return wxString(wxString::FromAscii(soxr_method_names[index])); + wxASSERT( GetNumMethods() == + sizeof(soxr_method_names) / sizeof(*soxr_method_names) ); + + class MethodNamesArray final : public TranslatableStringArray + { + void Populate() override + { + for (auto &name : soxr_method_names) + mContents.push_back( wxGetTranslation( name ) ); + } + }; + + static MethodNamesArray theArray; + + return theArray.Get()[ index ]; } const wxString Resample::GetFastMethodKey()