1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 14:41:39 +00:00

Fix Issues from Translation Update

- Add Qtlib to transifex config
- Pull latest qtlib translations
- Fix flake8 error
- Remove code for manual translation import, use transifex-client instead
This commit is contained in:
2021-08-06 22:21:35 -05:00
parent 0cd8f5e948
commit c51a82a2ce
20 changed files with 1059 additions and 887 deletions

View File

@@ -8,7 +8,6 @@ import os
import os.path as op
from optparse import OptionParser
import shutil
from pathlib import Path
from setuptools import setup, Extension
@@ -61,12 +60,6 @@ def parse_args():
dest="modules",
help="Build the python modules.",
)
parser.add_option(
"--importpo",
action="store_true",
dest="importpo",
help="Import all PO files downloaded from transifex.",
)
(options, args) = parser.parse_args()
return options
@@ -136,33 +129,6 @@ def build_normpo():
# loc.normalize_all_pos(op.join("cocoalib", "locale"))
def build_importpo():
basePath = Path.cwd()
# expect a folder named transifex with all the .po files from the exports
translationsPath = basePath.joinpath("transifex")
# locations where the translation files go
qtlibPath = basePath.joinpath("qtlib", "locale")
localePath = basePath.joinpath("locale")
for translation in translationsPath.iterdir():
# transifex files are named resource_lang.po so split on first '_'
parts = translation.stem.split("_", 1)
resource = parts[0]
language = parts[1]
# make sure qtlib resources go to dedicated folder
if resource == "qtlib":
outputPath = qtlibPath
else:
outputPath = localePath
outputFolder = outputPath.joinpath(language, "LC_MESSAGES")
# create the language folder if it is new
if not outputFolder.exists():
outputFolder.mkdir(parents=True)
# copy the po file over
shutil.copy(translation, outputFolder.joinpath(resource + ".po"))
# normalize files after complete
build_normpo()
def build_pe_modules():
print("Building PE Modules")
exts = [
@@ -225,8 +191,6 @@ def main():
build_normpo()
elif options.modules:
build_pe_modules()
elif options.importpo:
build_importpo()
else:
build_normal()