Skip to content

Commit

Permalink
Remove languages from qresources
Browse files Browse the repository at this point in the history
  • Loading branch information
Dummerle committed Dec 10, 2021
1 parent fd05540 commit bab0659
Show file tree
Hide file tree
Showing 5 changed files with 518 additions and 5,109 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include README.md
include rare/resources/images/*
include rare/resources/languages/*
12 changes: 6 additions & 6 deletions rare/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import time
import traceback

from PyQt5.QtCore import QThreadPool, QSettings, QTranslator, QFile
from PyQt5.QtCore import QThreadPool, QSettings, QTranslator
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QSystemTrayIcon, QMessageBox
from requests import HTTPError

# noinspection PyUnresolvedReferences
import rare.resources.resources
import rare.shared as shared
from rare import cache_dir
from rare import cache_dir, resources_path
from rare.components.dialogs.launch_dialog import LaunchDialog
from rare.components.main_window import MainWindow
from rare.components.tray_icon import TrayIcon
Expand Down Expand Up @@ -100,17 +100,17 @@ def __init__(self):
self.translator = QTranslator()
lang = self.settings.value("language", self.core.language_code, type=str)

if QFile(f":/languages/{lang}.qm").exists():
self.translator.load(f":/languages/{lang}.qm")
if os.path.isfile(f := os.path.join(resources_path, "languages", f"{lang}.qm")):
self.translator.load(f)
logger.info("Your language is supported: " + lang)
elif not lang == "en":
logger.info("Your language is not supported")
self.installTranslator(self.translator)

# translator for qt stuff
if QFile(f":/languages/{lang}.qm").exists():
if os.path.isfile(f := os.path.join(resources_path, f"qt_{lang}.qm")):
self.qt_translator = QTranslator()
self.qt_translator.load(f":/languages/qt_{lang}.qm")
self.qt_translator.load(f)
self.installTranslator(self.qt_translator)

# Style
Expand Down
Loading

0 comments on commit bab0659

Please sign in to comment.