diff options
author | Konstantin <rilian-la-te@users.noreply.github.com> | 2019-04-22 14:54:05 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-04-22 14:54:05 +0300 |
commit | 841995cddf7ad2fe18ff89ac6508aef459ec5742 (patch) | |
tree | f13f065c15e00dee9633f54e9cb3460fd51cb477 | |
parent | 8dedddca363b2edb7c5e17d6560418f8a20626bd (diff) | |
download | meson-841995cddf7ad2fe18ff89ac6508aef459ec5742.zip meson-841995cddf7ad2fe18ff89ac6508aef459ec5742.tar.gz meson-841995cddf7ad2fe18ff89ac6508aef459ec5742.tar.bz2 |
i18n: add args keyword to merge_file
* i18n: add args keyword to merge_file
* i18n: add testcase to msgfmt args
-rw-r--r-- | docs/markdown/i18n-module.md | 1 | ||||
-rw-r--r-- | mesonbuild/modules/i18n.py | 7 | ||||
-rw-r--r-- | mesonbuild/scripts/msgfmthelper.py | 3 | ||||
-rw-r--r-- | test cases/frameworks/6 gettext/data2/meson.build | 3 | ||||
-rw-r--r-- | test cases/frameworks/6 gettext/data2/test.desktop.in | 2 | ||||
-rw-r--r-- | test cases/frameworks/6 gettext/installed_files.txt | 2 | ||||
-rw-r--r-- | test cases/frameworks/6 gettext/po/LINGUAS | 2 | ||||
-rw-r--r-- | test cases/frameworks/6 gettext/po/meson.build | 2 | ||||
-rw-r--r-- | test cases/frameworks/6 gettext/po/ru.po | 34 |
9 files changed, 51 insertions, 5 deletions
diff --git a/docs/markdown/i18n-module.md b/docs/markdown/i18n-module.md index 9053edc..4948fab 100644 --- a/docs/markdown/i18n-module.md +++ b/docs/markdown/i18n-module.md @@ -48,5 +48,6 @@ for normal keywords. In addition it accepts these keywords: also `i18n.gettext()`) * `po_dir`: directory containing translations, relative to current directory * `type`: type of file, valid options are `'xml'` (default) and `'desktop'` +* `args`: (*Added 0.51.0*) list of extra arguments to pass to `msgfmt` *Added 0.37.0* diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py index 4b37069..76b9d63 100644 --- a/mesonbuild/modules/i18n.py +++ b/mesonbuild/modules/i18n.py @@ -64,7 +64,8 @@ class I18nModule(ExtensionModule): return [path.join(src_dir, d) for d in dirs] @FeatureNew('i18n.merge_file', '0.37.0') - @permittedKwargs(build.CustomTarget.known_kwargs | {'data_dirs', 'po_dir', 'type'}) + @FeatureNewKwargs('i18n.merge_file', '0.51.0', ['args']) + @permittedKwargs(build.CustomTarget.known_kwargs | {'data_dirs', 'po_dir', 'type', 'args'}) def merge_file(self, state, args, kwargs): podir = kwargs.pop('po_dir', None) if not podir: @@ -86,6 +87,10 @@ class I18nModule(ExtensionModule): if datadirs: command.append(datadirs) + if 'args' in kwargs: + command.append('--') + command.append(mesonlib.stringlistify(kwargs.pop('args', []))) + kwargs['command'] = command inputfile = kwargs['input'] diff --git a/mesonbuild/scripts/msgfmthelper.py b/mesonbuild/scripts/msgfmthelper.py index d4deb00..737f1bc 100644 --- a/mesonbuild/scripts/msgfmthelper.py +++ b/mesonbuild/scripts/msgfmthelper.py @@ -22,6 +22,7 @@ parser.add_argument('output') parser.add_argument('type') parser.add_argument('podir') parser.add_argument('--datadirs', default='') +parser.add_argument('args', default=[], metavar='extra msgfmt argument', nargs='*') def run(args): @@ -31,5 +32,5 @@ def run(args): env = os.environ.copy() env.update({'GETTEXTDATADIRS': options.datadirs}) return subprocess.call(['msgfmt', '--' + options.type, '-d', options.podir, - '--template', options.input, '-o', options.output], + '--template', options.input, '-o', options.output] + options.args, env=env) diff --git a/test cases/frameworks/6 gettext/data2/meson.build b/test cases/frameworks/6 gettext/data2/meson.build index d927ba3..b8c90a1 100644 --- a/test cases/frameworks/6 gettext/data2/meson.build +++ b/test cases/frameworks/6 gettext/data2/meson.build @@ -1,8 +1,9 @@ i18n.merge_file( input: 'test.desktop.in', - output: 'test.desktop', + output: 'test.plugin', type: 'desktop', po_dir: '../po', + args: ['--keyword=Description'], install: true, install_dir: join_paths(get_option('datadir'), 'applications') ) diff --git a/test cases/frameworks/6 gettext/data2/test.desktop.in b/test cases/frameworks/6 gettext/data2/test.desktop.in index 33b9a9f..5c8ea2e 100644 --- a/test cases/frameworks/6 gettext/data2/test.desktop.in +++ b/test cases/frameworks/6 gettext/data2/test.desktop.in @@ -1,6 +1,6 @@ [Desktop Entry] Name=Test GenericName=Application -Comment=Test Application +Description=Test Application Type=Application diff --git a/test cases/frameworks/6 gettext/installed_files.txt b/test cases/frameworks/6 gettext/installed_files.txt index 850711a..f32b282 100644 --- a/test cases/frameworks/6 gettext/installed_files.txt +++ b/test cases/frameworks/6 gettext/installed_files.txt @@ -1,8 +1,10 @@ usr/bin/intlprog?exe usr/share/locale/de/LC_MESSAGES/intltest.mo usr/share/locale/fi/LC_MESSAGES/intltest.mo +usr/share/locale/ru/LC_MESSAGES/intltest.mo usr/share/applications/something.desktop usr/share/applications/test.desktop +usr/share/applications/test.plugin usr/share/applications/test2.desktop usr/share/applications/test3.desktop usr/share/applications/test4.desktop diff --git a/test cases/frameworks/6 gettext/po/LINGUAS b/test cases/frameworks/6 gettext/po/LINGUAS index d319e48..c9274bf 100644 --- a/test cases/frameworks/6 gettext/po/LINGUAS +++ b/test cases/frameworks/6 gettext/po/LINGUAS @@ -1,2 +1,4 @@ de fi +ru + diff --git a/test cases/frameworks/6 gettext/po/meson.build b/test cases/frameworks/6 gettext/po/meson.build index 8ea2c11..86e02f1 100644 --- a/test cases/frameworks/6 gettext/po/meson.build +++ b/test cases/frameworks/6 gettext/po/meson.build @@ -1,3 +1,3 @@ -langs = ['fi', 'de'] +langs = ['fi', 'de', 'ru'] i18n.gettext('intltest', languages : langs) diff --git a/test cases/frameworks/6 gettext/po/ru.po b/test cases/frameworks/6 gettext/po/ru.po new file mode 100644 index 0000000..e5867c8 --- /dev/null +++ b/test cases/frameworks/6 gettext/po/ru.po @@ -0,0 +1,34 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the intltest package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: intltest\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-31 05:16-0500\n" +"PO-Revision-Date: 2019-04-22 02:38+0300\n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Last-Translator: \n" +"Language-Team: \n" +"X-Generator: Poedit 2.2.1\n" + +#: src/intlmain.c:15 +msgid "International greeting." +msgstr "ΠΠ΅ΠΆΠ½Π°ΡΠΈΠΎΠ½Π°Π»ΡΠ½ΠΎΠ΅ ΠΏΡΠΈΠ²Π΅ΡΡΡΠ²ΠΈΠ΅." + +#: data/test.desktop.in:3 +msgid "Test" +msgstr "Π’Π΅ΡΡ" + +#: data/test.desktop.in:4 +msgid "Application" +msgstr "ΠΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅" + +#: data/test.desktop.in:5 +msgid "Test Application" +msgstr "Π’Π΅ΡΡΠΎΠ²ΠΎΠ΅ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅" |