diff --git a/.flake8 b/.flake8 index 35abd39..9656ec8 100644 --- a/.flake8 +++ b/.flake8 @@ -1,6 +1,7 @@ [flake8] builtins = _ max-line-length = 100 +show-source = true # Temporary exclude = src/diffuse/main.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5abdfa8..1be2757 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,10 +22,10 @@ jobs: - run: pip install -r requirements.txt - name: Flake8 - run: flake8 src/ + run: flake8 src/ po/ - name: MyPy - run: mypy src/ + run: mypy src/ po/ meson-build-test: runs-on: ubuntu-latest diff --git a/po/update-translations.py b/po/update-translations.py index 235a1e5..306c20a 100755 --- a/po/update-translations.py +++ b/po/update-translations.py @@ -20,17 +20,18 @@ # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import argparse -import glob import os import subprocess import shutil import tempfile + def check_translation(filename): - subprocess.run(["msgfmt", "-c", "-v", filename]) + subprocess.run(['msgfmt', '-c', '-v', filename]) + def update_translation(filename): - print(f"Updating translation file '{filename}'...") + print(f'Updating translation file "{filename}"...') # Get language lang = os.path.splitext(filename)[0] @@ -40,17 +41,34 @@ def update_translation(filename): shutil.move(filename, tmpfile) # Create a new .po file for this language - emptypofile = os.path.join(tmpdir, f"{lang}.empty.po") - subprocess.run(["msginit", "--no-wrap", "--no-translator", "-l", lang, "-o", emptypofile, "-i", "diffuse.pot"]) + emptypofile = os.path.join(tmpdir, f'{lang}.empty.po') + subprocess.run([ + 'msginit', + '--no-wrap', + '--no-translator', + '-l', + lang, + '-o', + emptypofile, + '-i', + 'diffuse.pot']) # Merge with the old translation - subprocess.run(["msgmerge", "-q", "--no-wrap", tmpfile, emptypofile, "-o", filename]) + subprocess.run([ + 'msgmerge', + '-q', + '--no-wrap', + tmpfile, + emptypofile, + '-o', + filename]) # Validate translation - print(f"Validate {filename}:") + print(f'Validate "{filename}":') check_translation(filename) - print(f"Update done.") + print('Update done.') + # Setup argument parser parser = argparse.ArgumentParser(description='Update translation files (.po).') @@ -68,7 +86,7 @@ po_files.sort() if args.check_only: for file in po_files: - print(f"Validate {file}:") + print(f'Validate "{file}":') check_translation(file) exit(0)