From 6604e974934e5aab5c78221da1feec0b984e355a Mon Sep 17 00:00:00 2001 From: David Sansome Date: Mon, 2 Aug 2010 19:02:21 +0000 Subject: [PATCH] Make it possible to change the language with --language, or an option in the settings dialog. Fixes issue #583 --- src/core/commandlineoptions.cpp | 10 +++++--- src/core/commandlineoptions.h | 2 ++ src/main.cpp | 24 ++++++++++++++----- src/translations/ar.po | 12 ++++++++++ src/translations/bg.po | 12 ++++++++++ src/translations/cs.po | 12 ++++++++++ src/translations/da.po | 12 ++++++++++ src/translations/de.po | 12 ++++++++++ src/translations/el.po | 12 ++++++++++ src/translations/en_CA.po | 12 ++++++++++ src/translations/en_GB.po | 12 ++++++++++ src/translations/es.po | 12 ++++++++++ src/translations/fi.po | 12 ++++++++++ src/translations/fr.po | 12 ++++++++++ src/translations/gl.po | 12 ++++++++++ src/translations/it.po | 12 ++++++++++ src/translations/kk.po | 12 ++++++++++ src/translations/lt.po | 12 ++++++++++ src/translations/nb.po | 12 ++++++++++ src/translations/nl.po | 12 ++++++++++ src/translations/oc.po | 12 ++++++++++ src/translations/pl.po | 12 ++++++++++ src/translations/pt.po | 12 ++++++++++ src/translations/pt_BR.po | 12 ++++++++++ src/translations/ro.po | 12 ++++++++++ src/translations/ru.po | 12 ++++++++++ src/translations/sk.po | 12 ++++++++++ src/translations/sr.po | 12 ++++++++++ src/translations/sv.po | 12 ++++++++++ src/translations/tr.po | 12 ++++++++++ src/translations/translations.pot | 12 ++++++++++ src/translations/uk.po | 12 ++++++++++ src/translations/zh_CN.po | 12 ++++++++++ src/translations/zh_TW.po | 12 ++++++++++ src/ui/settingsdialog.cpp | 40 ++++++++++++++++++++++++++++++- src/ui/settingsdialog.h | 3 +++ src/ui/settingsdialog.ui | 27 ++++++++++++++++++++- 37 files changed, 467 insertions(+), 11 deletions(-) diff --git a/src/core/commandlineoptions.cpp b/src/core/commandlineoptions.cpp index c576d03dd..49a083662 100644 --- a/src/core/commandlineoptions.cpp +++ b/src/core/commandlineoptions.cpp @@ -47,7 +47,8 @@ const char* CommandlineOptions::kHelpText = "\n" "%20:\n" " -o, --show-osd %21\n" - " -e, --engine %22\n"; + " -e, --engine %22\n" + " -g, --language %23\n"; CommandlineOptions::CommandlineOptions(int argc, char** argv) @@ -109,6 +110,7 @@ bool CommandlineOptions::Parse() { {"show-osd", no_argument, 0, 'o'}, {"engine", required_argument, 0, 'e'}, + {"language", required_argument, 0, 'g'}, {0, 0, 0, 0} }; @@ -116,7 +118,7 @@ bool CommandlineOptions::Parse() { // Parse the arguments bool ok = false; forever { - int c = getopt_long(argc_, argv_, "hptusrfv:alk:oe:", kOptions, NULL); + int c = getopt_long(argc_, argv_, "hptusrfv:alk:oe:g:", kOptions, NULL); // End of the options if (c == -1) @@ -143,7 +145,8 @@ bool CommandlineOptions::Parse() { tr("Play the th track in the playlist"), tr("Other options"), tr("Display the on-screen-display"), - tr("Select engine")); + tr("Select engine"), + tr("Change the language")); std::cout << translated_help_text.toLocal8Bit().constData(); return false; @@ -158,6 +161,7 @@ bool CommandlineOptions::Parse() { case 'a': url_list_action_ = UrlList_Append; break; case 'l': url_list_action_ = UrlList_Load; break; case 'o': show_osd_ = true; break; + case 'g': language_ = QString(optarg); break; case VolumeUp: volume_modifier_ = +4; break; case VolumeDown: volume_modifier_ = -4; break; diff --git a/src/core/commandlineoptions.h b/src/core/commandlineoptions.h index 1e37a2296..110f643cf 100644 --- a/src/core/commandlineoptions.h +++ b/src/core/commandlineoptions.h @@ -62,6 +62,7 @@ class CommandlineOptions { bool show_osd() const { return show_osd_; } QList urls() const { return urls_; } Engine::Type engine() const { return engine_; } + QString language() const { return language_; } QByteArray Serialize() const; void Load(const QByteArray& serialized); @@ -93,6 +94,7 @@ class CommandlineOptions { int play_track_at_; bool show_osd_; Engine::Type engine_; + QString language_; QList urls_; }; diff --git a/src/main.cpp b/src/main.cpp index b73178c77..c0f4d1f65 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -64,7 +64,8 @@ Q_IMPORT_PLUGIN(qsqlite) #endif -void LoadTranslation(const QString& prefix, const QString& path) { +void LoadTranslation(const QString& prefix, const QString& path, + const QString& override_language = QString()) { #if QT_VERSION < 0x040700 // QTranslator::load will try to open and read "clementine" if it exists, // without checking if it's a file first. @@ -74,8 +75,11 @@ void LoadTranslation(const QString& prefix, const QString& path) { return; #endif + QString language = override_language.isEmpty() ? + QLocale::system().name() : override_language; + QTranslator* t = new PoTranslator; - if (t->load(prefix + "_" + QLocale::system().name(), path)) + if (t->load(prefix + "_" + language, path)) QCoreApplication::installTranslator(t); else delete t; @@ -168,11 +172,19 @@ int main(int argc, char *argv[]) { Q_INIT_RESOURCE(data); Q_INIT_RESOURCE(translations); + // Has the user forced a different language? + QString language = options.language(); + if (language.isEmpty()) { + QSettings s; + s.beginGroup("General"); + language = s.value("language").toString(); + } + // Translations - LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath)); - LoadTranslation("clementine", ":/translations"); - LoadTranslation("clementine", a.applicationDirPath()); - LoadTranslation("clementine", QDir::currentPath()); + LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath), language); + LoadTranslation("clementine", ":/translations", language); + LoadTranslation("clementine", a.applicationDirPath(), language); + LoadTranslation("clementine", QDir::currentPath(), language); // Icons IconLoader::Init(); diff --git a/src/translations/ar.po b/src/translations/ar.po index ac9c5e8f0..77b5a7d30 100644 --- a/src/translations/ar.po +++ b/src/translations/ar.po @@ -295,6 +295,9 @@ msgstr "" msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "" @@ -843,6 +846,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "" @@ -1653,6 +1659,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1722,6 +1731,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "" diff --git a/src/translations/bg.po b/src/translations/bg.po index 4544d200f..372450b46 100644 --- a/src/translations/bg.po +++ b/src/translations/bg.po @@ -295,6 +295,9 @@ msgstr "" msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "" @@ -843,6 +846,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "" @@ -1653,6 +1659,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1722,6 +1731,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "" diff --git a/src/translations/cs.po b/src/translations/cs.po index f3731257f..218ded074 100644 --- a/src/translations/cs.po +++ b/src/translations/cs.po @@ -296,6 +296,9 @@ msgstr "Procházet…" msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Hledáni aktualizaci..." @@ -847,6 +850,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Notebook/Sluchátka" @@ -1657,6 +1663,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1726,6 +1735,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "vaše přihlašovací údaje k Last.fm byly neplatné" diff --git a/src/translations/da.po b/src/translations/da.po index d14f5196e..5ad2e56be 100644 --- a/src/translations/da.po +++ b/src/translations/da.po @@ -296,6 +296,9 @@ msgstr "Gennemse..." msgid "Change shortcut..." msgstr "Ændrer smutvej..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Tjek efter opdateringer..." @@ -848,6 +851,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Bærbar/hovedtelefoner" @@ -1660,6 +1666,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1729,6 +1738,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Dine Last.fm login-oplysninger var forkerte" diff --git a/src/translations/de.po b/src/translations/de.po index b317f70ef..268c7f386 100644 --- a/src/translations/de.po +++ b/src/translations/de.po @@ -300,6 +300,9 @@ msgstr "Durchsuchen…" msgid "Change shortcut..." msgstr "Tastenkürzel ändern..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Suche nach Aktualisierungen..." @@ -859,6 +862,9 @@ msgstr "Zum aktuellen Stück springen" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Laptop/Kopfhörer" @@ -1674,6 +1680,9 @@ msgstr "Gnome Tastenkürzel verwenden" msgid "Use Replay Gain metadata if it is available" msgstr "Benutze Replay Gain Metadaten wenn verfügbar" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1752,6 +1761,9 @@ msgstr "" "style:italic;\">Zugriff für Hilfsgeräte aktivieren\" in \"Bedienhilfen" "\" um Clementines Tastenkürzel zu benutzen." +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Ihre Last.fm Daten sind falsch" diff --git a/src/translations/el.po b/src/translations/el.po index e3527ff10..c29e68f28 100644 --- a/src/translations/el.po +++ b/src/translations/el.po @@ -302,6 +302,9 @@ msgstr "Αναζήτηση..." msgid "Change shortcut..." msgstr "Αλλαγή συντόμευσης..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Έλεγχος για ενημερώσεις" @@ -862,6 +865,9 @@ msgstr "Μετάβαση στο τρέχον κομμάτι που παίζει" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Φορητός/ακουστικά" @@ -1678,6 +1684,9 @@ msgstr "Χρήση πλήκτρων συντόμευσης του Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Χρήση των μετα δεδομένων Replay Gain αν είναι διαθέσημα" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1757,6 +1766,9 @@ msgstr "" "Ενεργοποίηση πρόσβασης σε βοηθητικές συσκευές\" για να " "χρησιμοποιήσετε καθολικές συντομεύσεις στον Clementine." +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Τα στοιχεία σας στο Last.fm ήταν εσφαλμένα" diff --git a/src/translations/en_CA.po b/src/translations/en_CA.po index 7f8673553..50f16e899 100644 --- a/src/translations/en_CA.po +++ b/src/translations/en_CA.po @@ -295,6 +295,9 @@ msgstr "" msgid "Change shortcut..." msgstr "Change shortcut..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Check for updates..." @@ -847,6 +850,9 @@ msgstr "Jump to the currently playing track" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Laptop/Headphones" @@ -1658,6 +1664,9 @@ msgstr "Use Gnome's shortcut keys" msgid "Use Replay Gain metadata if it is available" msgstr "Use Replay Gain metadata if it is available" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1727,6 +1736,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Your Last.fm credentials were incorrect" diff --git a/src/translations/en_GB.po b/src/translations/en_GB.po index f66302141..f5405fe1c 100644 --- a/src/translations/en_GB.po +++ b/src/translations/en_GB.po @@ -295,6 +295,9 @@ msgstr "" msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Check for updates..." @@ -845,6 +848,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Laptop/Headphones" @@ -1655,6 +1661,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1724,6 +1733,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Your Last.fm credentials were incorrect" diff --git a/src/translations/es.po b/src/translations/es.po index 29f108444..3f0d30341 100644 --- a/src/translations/es.po +++ b/src/translations/es.po @@ -303,6 +303,9 @@ msgstr "Explorar..." msgid "Change shortcut..." msgstr "Cambiar combinación de teclas" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Buscar actualizaciones..." @@ -864,6 +867,9 @@ msgstr "Ir a la pista actualmente reproduciéndose" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Laptop/Auriculares" @@ -1679,6 +1685,9 @@ msgstr "Usar las combinaciones de teclas de Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Usar metadatos de ganancia de repetición si están disponibles" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1758,6 +1767,9 @@ msgstr "" "style: italic;\">Activar acceso para dispositivos de asistencia\" " "para utilizar los atajos de teclado globales en Clementine." +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Sus credenciales de Last.fm fueron incorrectas" diff --git a/src/translations/fi.po b/src/translations/fi.po index fd55f729b..63675c07a 100644 --- a/src/translations/fi.po +++ b/src/translations/fi.po @@ -295,6 +295,9 @@ msgstr "Selaa..." msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Tarkista päivitykset..." @@ -844,6 +847,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "" @@ -1655,6 +1661,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1724,6 +1733,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "" diff --git a/src/translations/fr.po b/src/translations/fr.po index 13589b616..c001e7f51 100644 --- a/src/translations/fr.po +++ b/src/translations/fr.po @@ -296,6 +296,9 @@ msgstr "Parcourir..." msgid "Change shortcut..." msgstr "Changer le raccourci..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Vérifier les mises à jour" @@ -851,6 +854,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Portable/Ecouteurs" @@ -1667,6 +1673,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1738,6 +1747,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Vos identifiants Last.fm sont incorrects" diff --git a/src/translations/gl.po b/src/translations/gl.po index 7c359c1b5..9ab2f9dae 100644 --- a/src/translations/gl.po +++ b/src/translations/gl.po @@ -295,6 +295,9 @@ msgstr "" msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Verificar se há actualizazóns..." @@ -844,6 +847,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Portátil/Auscultadores" @@ -1655,6 +1661,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1724,6 +1733,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "A suas credenciais da Last.fm son incorrectas" diff --git a/src/translations/it.po b/src/translations/it.po index a20dc3400..3958340bc 100644 --- a/src/translations/it.po +++ b/src/translations/it.po @@ -302,6 +302,9 @@ msgstr "Sfoglia..." msgid "Change shortcut..." msgstr "Cambia la scorciatoia" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Controlla aggiornamenti..." @@ -863,6 +866,9 @@ msgstr "Salta alla traccia in riproduzione" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Portatile/Cuffie" @@ -1684,6 +1690,9 @@ msgstr "Utilizza le scorciatoie di Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Utilizza i metadati del guadagno di riproduzione se disponibili" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1762,6 +1771,9 @@ msgstr "" "italic;\">Abilita l'accesso per i dispositivi di assistenza\" per " "utilizzare le scorciatoie globali in Clementine." +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Le credenziali Last.fm non sono corrette" diff --git a/src/translations/kk.po b/src/translations/kk.po index ee49ec3e9..f7a88f310 100644 --- a/src/translations/kk.po +++ b/src/translations/kk.po @@ -295,6 +295,9 @@ msgstr "" msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "" @@ -845,6 +848,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "" @@ -1655,6 +1661,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1724,6 +1733,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "" diff --git a/src/translations/lt.po b/src/translations/lt.po index f49ae80db..e966f854c 100644 --- a/src/translations/lt.po +++ b/src/translations/lt.po @@ -295,6 +295,9 @@ msgstr "" msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "" @@ -843,6 +846,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "" @@ -1653,6 +1659,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1722,6 +1731,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "" diff --git a/src/translations/nb.po b/src/translations/nb.po index 45f404530..47fbacd76 100644 --- a/src/translations/nb.po +++ b/src/translations/nb.po @@ -295,6 +295,9 @@ msgstr "" msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "" @@ -846,6 +849,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Laptop/Hodetelefoner" @@ -1657,6 +1663,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1726,6 +1735,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Din last.fm brukerinformasjon var ikke korrekt" diff --git a/src/translations/nl.po b/src/translations/nl.po index dee059372..e49051f46 100644 --- a/src/translations/nl.po +++ b/src/translations/nl.po @@ -299,6 +299,9 @@ msgstr "Bladeren..." msgid "Change shortcut..." msgstr "Sneltoets wijzigen" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Zoeken naar updates..." @@ -859,6 +862,9 @@ msgstr "Spring naar de nu spelende track" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Laptop/koptelefoon" @@ -1676,6 +1682,9 @@ msgstr "Gebruik Gnome's sneltoetsen" msgid "Use Replay Gain metadata if it is available" msgstr "Gebruik Replay Gain metadata indien beschikbaar" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1751,6 +1760,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Uw Last.fm gegevens zijn incorrect" diff --git a/src/translations/oc.po b/src/translations/oc.po index e68389bc0..d896b483d 100644 --- a/src/translations/oc.po +++ b/src/translations/oc.po @@ -295,6 +295,9 @@ msgstr "" msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "" @@ -843,6 +846,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "" @@ -1653,6 +1659,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1722,6 +1731,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "" diff --git a/src/translations/pl.po b/src/translations/pl.po index e8e94ae19..dc840487c 100644 --- a/src/translations/pl.po +++ b/src/translations/pl.po @@ -296,6 +296,9 @@ msgstr "Przeglądaj..." msgid "Change shortcut..." msgstr "Zmień skrót..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Sprawdź aktualizacje..." @@ -850,6 +853,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Laptop/Słuchawki" @@ -1664,6 +1670,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1733,6 +1742,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Twoje dane dla Last.fm są niepoprawne" diff --git a/src/translations/pt.po b/src/translations/pt.po index 58d4dc060..fb899e147 100644 --- a/src/translations/pt.po +++ b/src/translations/pt.po @@ -300,6 +300,9 @@ msgstr "Procurar..." msgid "Change shortcut..." msgstr "Alterar atalho..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Verificar por actualizações..." @@ -856,6 +859,9 @@ msgstr "Ir para a faixa de reprodução actual" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Portátil/Auscultadores" @@ -1671,6 +1677,9 @@ msgstr "Usar teclas de atalho Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Usar Consistência de meta-dados se estiver disponível" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1748,6 +1757,9 @@ msgstr "" "font-style:italic;\">Activar acesso de apoio a dispositivos\" de modo " "a utilizar os atalhos globais do Clementine." +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "A suas credenciais da Last.fm estão incorrectas" diff --git a/src/translations/pt_BR.po b/src/translations/pt_BR.po index 9faf27660..757602ca9 100644 --- a/src/translations/pt_BR.po +++ b/src/translations/pt_BR.po @@ -298,6 +298,9 @@ msgstr "Procurar..." msgid "Change shortcut..." msgstr "Mudar atalho..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Checar atualizações..." @@ -851,6 +854,9 @@ msgstr "Pular para a faixa em execução" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Notebook / fones de ouvido" @@ -1666,6 +1672,9 @@ msgstr "Usar teclas de atalho do Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Usar metadados do fator de ganho se ele estiver disponível" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1742,6 +1751,9 @@ msgstr "" "style=\" font-style:italic;\">Ativar acesso por dispositivos assistidos\" para utilizar os atalhos globais no Clementine." +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Suas credencias do Last.fm estavam incorretas" diff --git a/src/translations/ro.po b/src/translations/ro.po index c0497466f..6bc3bc432 100644 --- a/src/translations/ro.po +++ b/src/translations/ro.po @@ -295,6 +295,9 @@ msgstr "" msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "" @@ -844,6 +847,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Laptop/Căști" @@ -1654,6 +1660,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1723,6 +1732,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "" diff --git a/src/translations/ru.po b/src/translations/ru.po index c6b07e061..7b4da5acf 100644 --- a/src/translations/ru.po +++ b/src/translations/ru.po @@ -298,6 +298,9 @@ msgstr "Обзор..." msgid "Change shortcut..." msgstr "Изменить горячую клавишу..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Проверить обновления..." @@ -854,6 +857,9 @@ msgstr "Перейти к текущей композиции" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Портативный компьютер/наушники" @@ -1671,6 +1677,9 @@ msgstr "Использовать горячие клавиши Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Использовать метаданные Replay Gain если возможно" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1748,6 +1757,9 @@ msgstr "" "функцию \"Разрешить доступ для вспомогательных устройств\" для " "использования глобальных горячих клавиш в Clementine" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Ваши данные Last.fm некорректны" diff --git a/src/translations/sk.po b/src/translations/sk.po index f34c48e3b..1e0c4a4c0 100644 --- a/src/translations/sk.po +++ b/src/translations/sk.po @@ -300,6 +300,9 @@ msgstr "Prehľadávať..." msgid "Change shortcut..." msgstr "Zmeniť skratku..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Skontrolovať aktualizácie..." @@ -857,6 +860,9 @@ msgstr "Skočiť na práve prehrávanú skladbu" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Notebook/sluchátka" @@ -1670,6 +1676,9 @@ msgstr "Použiť klávesové skratky GNOME" msgid "Use Replay Gain metadata if it is available" msgstr "Použiť metadáta na vyrovnanie hlasitosti ak sú dostupné" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1746,6 +1755,9 @@ msgstr "" "style:italic;\">Povoliť prístup pre pomocné zariadenia\" na použitie " "globálnych skratiek v Clementine." +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Vaše Last.fm poverenie bolo nekorektné" diff --git a/src/translations/sr.po b/src/translations/sr.po index 4d233e818..b2ecfff20 100644 --- a/src/translations/sr.po +++ b/src/translations/sr.po @@ -295,6 +295,9 @@ msgstr "Прегледај..." msgid "Change shortcut..." msgstr "Промени пречицу..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Потражи ажурирања..." @@ -847,6 +850,9 @@ msgstr "Скочи на нумеру која се тренутно пушта" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Лаптоп/слушалице" @@ -1658,6 +1664,9 @@ msgstr "Користи Гномове пречице" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1729,6 +1738,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Акредитиви за ЛастФМ које сте унели су нетачни" diff --git a/src/translations/sv.po b/src/translations/sv.po index a868e8a26..99e3c3a4e 100644 --- a/src/translations/sv.po +++ b/src/translations/sv.po @@ -295,6 +295,9 @@ msgstr "" msgid "Change shortcut..." msgstr "Ändra genväg..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Kontrollera efter uppdateringar..." @@ -848,6 +851,9 @@ msgstr "Hoppa till det spår som spelas för tillfället" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "Bärbar dator/Hörlurar" @@ -1661,6 +1667,9 @@ msgid "Use Replay Gain metadata if it is available" msgstr "" "Använd metadata för uppspelningsförstärkning om de de finns tillgängliga." +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1730,6 +1739,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Dina referenser för Last.fm var felaktiga" diff --git a/src/translations/tr.po b/src/translations/tr.po index c6774e09d..133357195 100644 --- a/src/translations/tr.po +++ b/src/translations/tr.po @@ -295,6 +295,9 @@ msgstr "Gözat..." msgid "Change shortcut..." msgstr "Kısayolu değiştir..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Güncellemeleri denetle..." @@ -845,6 +848,9 @@ msgstr "Şu anda çalınan parçaya atla" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "" @@ -1659,6 +1665,9 @@ msgstr "Gnome kısayol tuşlarını kullan" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1728,6 +1737,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Last.fm giriş bilgileriniz doğru değil" diff --git a/src/translations/translations.pot b/src/translations/translations.pot index 0204b57a4..133e72119 100644 --- a/src/translations/translations.pot +++ b/src/translations/translations.pot @@ -285,6 +285,9 @@ msgstr "" msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "" @@ -833,6 +836,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "" @@ -1643,6 +1649,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1712,6 +1721,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "" diff --git a/src/translations/uk.po b/src/translations/uk.po index c2809f838..c798c749b 100644 --- a/src/translations/uk.po +++ b/src/translations/uk.po @@ -299,6 +299,9 @@ msgstr "Огляд..." msgid "Change shortcut..." msgstr "Змінити комбінацію клавіш..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "Перевірити оновлення..." @@ -856,6 +859,9 @@ msgstr "Перейти до відтворюваної доріжки" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "портативний комп’ютер/навушники" @@ -1670,6 +1676,9 @@ msgstr "Використовувати комбінації клавіш Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Використовувати метадані Replay Gain, якщо наявні" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1747,6 +1756,9 @@ msgstr "" "style=\" font-style:italic;\">Увімкнути доступ для допоміжних пристроїв\", щоб використовувати глобальні комбінації клавіш в Clementine." +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "Ваші облікові дані Last.fm неправильні" diff --git a/src/translations/zh_CN.po b/src/translations/zh_CN.po index be5c5fd34..71411dcd7 100644 --- a/src/translations/zh_CN.po +++ b/src/translations/zh_CN.po @@ -295,6 +295,9 @@ msgstr "" msgid "Change shortcut..." msgstr "" +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "" @@ -843,6 +846,9 @@ msgstr "" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "" @@ -1653,6 +1659,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1722,6 +1731,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "" diff --git a/src/translations/zh_TW.po b/src/translations/zh_TW.po index 5dea2e6e7..c99a38bf6 100644 --- a/src/translations/zh_TW.po +++ b/src/translations/zh_TW.po @@ -299,6 +299,9 @@ msgstr "瀏覽..." msgid "Change shortcut..." msgstr "更改快速鍵..." +msgid "Change the language" +msgstr "" + msgid "Check for updates..." msgstr "檢查更新..." @@ -848,6 +851,9 @@ msgstr "跳轉到目前播放的歌曲" msgid "Keep the original files" msgstr "" +msgid "Language" +msgstr "" + msgid "Laptop/Headphones" msgstr "筆記本電腦 /耳機" @@ -1658,6 +1664,9 @@ msgstr "使用Gnome的快速鍵" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use the system default" +msgstr "" + msgid "Used" msgstr "" @@ -1729,6 +1738,9 @@ msgid "" "shortcuts in Clementine." msgstr "" +msgid "You will need to restart Clementine if you change the language." +msgstr "" + msgid "Your Last.fm credentials were incorrect" msgstr "" diff --git a/src/ui/settingsdialog.cpp b/src/ui/settingsdialog.cpp index 8e985cc13..71ceb385c 100644 --- a/src/ui/settingsdialog.cpp +++ b/src/ui/settingsdialog.cpp @@ -27,8 +27,9 @@ # include "engines/gstengine.h" #endif -#include #include +#include +#include #include @@ -64,6 +65,30 @@ SettingsDialog::SettingsDialog(QWidget* parent) // Behaviour connect(ui_->b_show_tray_icon_, SIGNAL(toggled(bool)), SLOT(ShowTrayIconToggled(bool))); + // Populate the language combo box. We do this by looking at all the + // compiled in translations. + QDir dir(":/translations/"); + QStringList codes(dir.entryList(QStringList() << "*.qm")); + QRegExp lang_re("^clementine_(.*).qm$"); + foreach (const QString& filename, codes) { + // The regex captures the "ru" from "clementine_ru.qm" + if (!lang_re.exactMatch(filename)) + continue; + + QString code = lang_re.cap(1); + QString name = QString("%1 (%2)").arg( + QLocale::languageToString(QLocale(code).language()), code); + + language_map_[name] = code; + } + + language_map_["English (en)"] = "en"; + + // Sort the names and show them in the UI + QStringList names = language_map_.keys(); + qStableSort(names); + ui_->language->addItems(names); + // Global shortcuts #ifdef Q_OS_MAC if (QSysInfo::MacintoshVersion != QSysInfo::MV_SNOWLEOPARD) { @@ -152,6 +177,11 @@ void SettingsDialog::accept() { s.setValue("startupbehaviour", int(behaviour)); s.endGroup(); + s.beginGroup("General"); + s.setValue("language", language_map_.contains(ui_->language->currentText()) ? + language_map_[ui_->language->currentText()] : QString()); + s.endGroup(); + // Playback s.beginGroup(Engine::Base::kSettingsGroup); s.setValue("FadeoutEnabled", ui_->fading_out->isChecked()); @@ -216,6 +246,14 @@ void SettingsDialog::showEvent(QShowEvent*) { } s.endGroup(); + s.beginGroup("General"); + QString name = language_map_.key(s.value("language").toString()); + if (name.isEmpty()) + ui_->language->setCurrentIndex(0); + else + ui_->language->setCurrentIndex(ui_->language->findText(name)); + s.endGroup(); + // Last.fm ui_->lastfm->Load(); diff --git a/src/ui/settingsdialog.h b/src/ui/settingsdialog.h index d8e62d8a8..0750bc2b8 100644 --- a/src/ui/settingsdialog.h +++ b/src/ui/settingsdialog.h @@ -18,6 +18,7 @@ #define SETTINGSDIALOG_H #include +#include #include "config.h" @@ -83,6 +84,8 @@ class SettingsDialog : public QDialog { bool loading_settings_; OSDPretty* pretty_popup_; + + QMap language_map_; }; #endif // SETTINGSDIALOG_H diff --git a/src/ui/settingsdialog.ui b/src/ui/settingsdialog.ui index 61a618e78..bf77012d2 100644 --- a/src/ui/settingsdialog.ui +++ b/src/ui/settingsdialog.ui @@ -114,7 +114,7 @@ - 2 + 1 @@ -399,6 +399,31 @@ + + + + Language + + + + + + + Use the system default + + + + + + + + You will need to restart Clementine if you change the language. + + + + + +