Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Adam <dev@robert-adam.de>2021-03-12 13:55:00 +0300
committerRobert Adam <dev@robert-adam.de>2021-03-12 13:57:52 +0300
commitfcabef87d996cc21dcc0f8a817d894776e286c3d (patch)
tree8bed20dcd6d0298f44a1631091d16f5dd96fea73 /src
parent0dcc1f614b2ab4f0d4bbac5fd29676595072a133 (diff)
FEAT(client): Allow to overwrite setting's locale
In case you want to use a locale that does not have a corresponding bundled translation in Mumble, you will probably have a hard time setting this up in Mumble's settings. This is important though in case one wants to test a new translation from an external translation file. Therefore this commit adds a new command line option that allows overwriting Mumble's settings manually.
Diffstat (limited to 'src')
-rw-r--r--src/mumble/main.cpp36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp
index 947d419fe..42991c805 100644
--- a/src/mumble/main.cpp
+++ b/src/mumble/main.cpp
@@ -227,6 +227,7 @@ int main(int argc, char **argv) {
QString rpcCommand;
QUrl url;
QStringList extraTranslationDirs;
+ QString localeOverwrite;
if (a.arguments().count() > 1) {
for (int i = 1; i < args.count(); ++i) {
@@ -285,6 +286,12 @@ int main(int argc, char **argv) {
" Print out the paths in which Mumble will search for\n"
" translation files that overwrite the bundled ones.\n"
" (Useful for translators testing their translations)\n"
+ " --locale <locale>\n"
+ " Overwrite the locale in Mumble's settings with a\n"
+ " locale that corresponds to the given locale string.\n"
+ " If the format is invalid, Mumble will error.\n"
+ " Otherwise the locale will be permanently saved to\n"
+ " Mumble's settings."
"\n");
QString rpcHelpBanner = MainWindow::tr("Remote controlling Mumble:\n"
"\n");
@@ -383,6 +390,14 @@ int main(int argc, char **argv) {
qCritical("Missing argument for --translation-dir!");
return 1;
}
+ } else if (args.at(i) == "--locale") {
+ if (i + 1 < args.count()) {
+ localeOverwrite = args.at(i + 1);
+ i++;
+ } else {
+ qCritical("Missing argument for --locale!");
+ return 1;
+ }
} else {
if (!bRpcMode) {
QUrl u = QUrl::fromEncoded(args.at(i).toUtf8());
@@ -548,9 +563,24 @@ int main(int argc, char **argv) {
}
#endif
- QLocale settingsLocale = QLocale(Global::get().s.qsLanguage);
- if (settingsLocale == QLocale::c()) {
- settingsLocale = systemLocale;
+ QLocale settingsLocale;
+
+ if (localeOverwrite.isEmpty()) {
+ settingsLocale = QLocale(Global::get().s.qsLanguage);
+ if (settingsLocale == QLocale::c()) {
+ settingsLocale = systemLocale;
+ }
+ } else {
+ // Manually specified locale overwrite
+ settingsLocale = QLocale(localeOverwrite);
+
+ if (settingsLocale == QLocale::c()) {
+ qFatal("Invalid locale specification \"%s\"", qUtf8Printable(localeOverwrite));
+ return 1;
+ }
+
+ // The locale is valid -> save it to the settings
+ Global::get().s.qsLanguage = settingsLocale.nativeLanguageName();
}
qWarning("Locale is \"%s\" (System: \"%s\")", qUtf8Printable(settingsLocale.name()), qUtf8Printable(systemLocale.name()));