diff --git a/UM/i18n.py b/UM/i18n.py index 5ba7d5a2e..d31cccc15 100644 --- a/UM/i18n.py +++ b/UM/i18n.py @@ -2,8 +2,6 @@ # Uranium is released under the terms of the LGPLv3 or higher. import gettext -import polib -import os import struct # Catching errors generated by gettext. from typing import Any, Dict, Optional, cast, TYPE_CHECKING @@ -203,17 +201,6 @@ def _replaceTags(self, string: str) -> str: return output - def compile_po_to_mo(self, po_file_path, mo_file_path): - # Load the .po file - po = polib.pofile(po_file_path) - - # Create or ensure the directory for the .mo file exists - mo_dir = os.path.dirname(mo_file_path) - os.makedirs(mo_dir, exist_ok=True) - - # Compile the .po file to .mo - po.save_as_mofile(mo_file_path) - def _update(self) -> None: """Fill the catalogue by loading the translated texts from file (again).""" @@ -228,19 +215,11 @@ def _update(self) -> None: # Ask gettext for all the translations in the .mo files. for path in Resources.getAllPathsForType(Resources.i18n): - name = cast(str, self.__name) - pofile = os.path.join(path, self.__language, '%s.po' % name) - if os.path.exists(pofile): - mofile = os.path.join(path, self.__language, 'LC_MESSAGES', '%s.mo' % name) - if not os.path.exists(mofile): - # create mo file - self.compile_po_to_mo(pofile, mofile) - - if gettext.find(name, path, languages = [self.__language]): - try: - self.__translation = gettext.translation(cast(str, self.__name), path, languages = [self.__language]) - except (EnvironmentError, struct.error, UnicodeDecodeError): - Logger.warning("Corrupt or inaccessible translation file: {fname}".format(fname = self.__name)) + if gettext.find(cast(str, self.__name), path, languages = [self.__language]): + try: + self.__translation = gettext.translation(cast(str, self.__name), path, languages = [self.__language]) + except (EnvironmentError, struct.error, UnicodeDecodeError): + Logger.warning("Corrupt or inaccessible translation file: {fname}".format(fname = self.__name)) self.__require_update = False diff --git a/requirements.txt b/requirements.txt index dcc34aeef..b8d2aa6ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -249,5 +249,3 @@ typing-extensions==4.3.0 \ colorama==0.4.5; \ sys_platform=="win32" \ --hash=sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da -polib==1.1.1; \ - --hash=sha256:d3ee85e0c6788f789353416b1612c6c92d75fe6ccfac0029711974d6abd0f86d