mirror of
https://github.com/naruxde/revpicommander.git
synced 2025-11-08 16:43:53 +01:00
QTranslator uses ui_languages to find translation
Loading translations was very static, now we use the array, the user set in the gui to find a translation file.
This commit is contained in:
6
Makefile
6
Makefile
@@ -60,9 +60,9 @@ install:
|
|||||||
.PHONY: build install
|
.PHONY: build install
|
||||||
|
|
||||||
## PyInstaller
|
## PyInstaller
|
||||||
installer_mac: all
|
installer_mac:
|
||||||
$(PYTHON) -m PyInstaller -n "RevPi Commander" \
|
$(PYTHON) -m PyInstaller -n "RevPi Commander" \
|
||||||
--add-data="src/$(PACKAGE)/locale:locale" \
|
--add-data="src/$(PACKAGE)/locale:./revpicommander/locale" \
|
||||||
--add-data="data/$(PACKAGE).icns:." \
|
--add-data="data/$(PACKAGE).icns:." \
|
||||||
--icon=data/$(PACKAGE).icns \
|
--icon=data/$(PACKAGE).icns \
|
||||||
--noconfirm \
|
--noconfirm \
|
||||||
@@ -78,6 +78,6 @@ installer_win: all
|
|||||||
|
|
||||||
## Clean
|
## Clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf build dist src/*.egg-info src/$(PACKAGE)/ui/[^__]*.py *.spec
|
rm -rf build dist src/*.egg-info *.spec
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|||||||
@@ -487,10 +487,11 @@ def main() -> int:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# Setup translation from file with system language
|
# Setup translation from file with system language
|
||||||
locale = QtCore.QLocale.system().name()
|
|
||||||
translator = QtCore.QTranslator()
|
translator = QtCore.QTranslator()
|
||||||
locale_file_name = "revpicommander_{0}".format(locale)
|
translator.load(
|
||||||
translator.load(join(dirname(__file__), "locale", locale_file_name), suffix=".qm")
|
QtCore.QLocale.system(),
|
||||||
|
"revpicommander", "_", join(dirname(__file__), "locale"), ".qm"
|
||||||
|
)
|
||||||
app.installTranslator(translator)
|
app.installTranslator(translator)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user