aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/gettext.py
diff options
context:
space:
mode:
authorCorentin Noël <corentin@elementary.io>2017-10-05 00:12:30 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-10-07 18:03:22 +0300
commit93d2ced31f9e23491ce010161475956b795a6235 (patch)
treef0c65e2ea97e1961b4c8073a82ebe1b9560f28b4 /mesonbuild/scripts/gettext.py
parent7b36897ff9102b44f57359d0dd3ddc47ea19a052 (diff)
downloadmeson-93d2ced31f9e23491ce010161475956b795a6235.zip
meson-93d2ced31f9e23491ce010161475956b795a6235.tar.gz
meson-93d2ced31f9e23491ce010161475956b795a6235.tar.bz2
Create the .po file with the `update_po` subcommand if it doesn't exist
Diffstat (limited to 'mesonbuild/scripts/gettext.py')
-rw-r--r--mesonbuild/scripts/gettext.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/scripts/gettext.py b/mesonbuild/scripts/gettext.py
index ef4f42a..30ac54c 100644
--- a/mesonbuild/scripts/gettext.py
+++ b/mesonbuild/scripts/gettext.py
@@ -70,7 +70,10 @@ def update_po(src_sub, pkgname, langs):
potfile = os.path.join(src_sub, pkgname + '.pot')
for l in langs:
pofile = os.path.join(src_sub, l + '.po')
- subprocess.check_call(['msgmerge', '-q', '-o', pofile, pofile, potfile])
+ if os.path.exists(pofile):
+ subprocess.check_call(['msgmerge', '-q', '-o', pofile, pofile, potfile])
+ else:
+ subprocess.check_call(['msginit', '--input', potfile, '--output-file', pofile, '--locale', l, '--no-translator'])
return 0
def do_install(src_sub, bld_sub, dest, pkgname, langs):