aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/import_po.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2021-02-03 19:17:50 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2021-02-03 19:17:50 -0500
commit475d074fd74425efbe783fad08f97f2df0c4909f (patch)
tree2acdae53999b3c74b716efa4edb5b40311fa356a /scripts/import_po.py
parentcd502d52787f666fff3254d7d7e7578930c813c2 (diff)
parent3a0d66f07b112b6d2bdc2b57bbf717a89a351ce6 (diff)
Update upstream source from tag 'upstream/8.1.2'
Update to upstream version '8.1.2' with Debian dir e5e966a9e6010ef70618dc9a61558fa4db35aceb
Diffstat (limited to 'scripts/import_po.py')
-rwxr-xr-xscripts/import_po.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/import_po.py b/scripts/import_po.py
index 2f887c5..3f2c984 100755
--- a/scripts/import_po.py
+++ b/scripts/import_po.py
@@ -1,16 +1,18 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Download translations from transifex and regenerate files."""
-from __future__ import unicode_literals, print_function
import io
from glob import glob
import os
import sys
import polib
-if 'nopull' not in sys.argv:
+if 'nopull' not in sys.argv or '--nopull' in sys.argv:
os.system("tx pull -a")
+elif '-h' in sys.argv or '--help' in sys.argv:
+ print("Internal use only. Takes optional 'nopull' argument to prevent pulling from Transifex.")
+ exit()
trans_files = glob(os.path.join('translations', 'nikola.messages', '*.po'))
for fname in trans_files:
@@ -20,7 +22,7 @@ for fname in trans_files:
'messages', 'messages_{0}.py'.format(lang))
po = polib.pofile(fname)
lines = """# -*- encoding:utf-8 -*-
-from __future__ import unicode_literals
+\"\"\"Autogenerated file, do not edit. Submit translations on Transifex.\"\"\"
MESSAGES = {""".splitlines()
lines2 = []