From 5384dbfc89fc852618b2d3217ca2187b15cb4c93 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Thu, 20 Jan 2022 18:51:57 +0100 Subject: [PATCH] Adding commandline argument to force language. --- .gitignore | 1 + LogarithmPlotter/__init__.py | 2 +- LogarithmPlotter/logarithmplotter.py | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b6e886d..1a8dac4 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ linux/flatpak/.flatpak-builder **/**.qmlc **/**.jsc **/**.pyc +**/**.qm *.jsc *.qmlc .DS_Store diff --git a/LogarithmPlotter/__init__.py b/LogarithmPlotter/__init__.py index 5fb66ac..edcf0d0 100644 --- a/LogarithmPlotter/__init__.py +++ b/LogarithmPlotter/__init__.py @@ -17,7 +17,7 @@ """ from shutil import which -__VERSION__ = "0.1.3" +__VERSION__ = "0.1.4" is_release = False diff --git a/LogarithmPlotter/logarithmplotter.py b/LogarithmPlotter/logarithmplotter.py index 621e7c0..9859813 100644 --- a/LogarithmPlotter/logarithmplotter.py +++ b/LogarithmPlotter/logarithmplotter.py @@ -176,7 +176,10 @@ def run(): # Installing translators translator = QTranslator() - if (translator.load(QLocale(), "lp", "_", path.realpath(path.join(getcwd(), "i18n")))): + # Check if lang is forced. + forcedlang = [p for p in argv if p[:7]=="--lang="] + locale = QLocale(forcedlang[0][7:]) if len(forcedlang) > 0 else QLocale() + if (translator.load(locale, "lp", "_", path.realpath(path.join(getcwd(), "i18n")))): app.installTranslator(translator); # Installing macOS file handler.