diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/frameworks/6 gettext | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/frameworks/6 gettext')
23 files changed, 336 insertions, 0 deletions
diff --git a/meson/test cases/frameworks/6 gettext/data/data3/meson.build b/meson/test cases/frameworks/6 gettext/data/data3/meson.build new file mode 100644 index 000000000..044b498bf --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/data/data3/meson.build @@ -0,0 +1,9 @@ +# Target name will contain a path separator +i18n.merge_file( + input: 'test.desktop.in', + output: 'test4.desktop', + type: 'desktop', + po_dir: '../../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) diff --git a/meson/test cases/frameworks/6 gettext/data/data3/test.desktop.in b/meson/test cases/frameworks/6 gettext/data/data3/test.desktop.in new file mode 100644 index 000000000..33b9a9fd8 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/data/data3/test.desktop.in @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=Test +GenericName=Application +Comment=Test Application +Type=Application + diff --git a/meson/test cases/frameworks/6 gettext/data/meson.build b/meson/test cases/frameworks/6 gettext/data/meson.build new file mode 100644 index 000000000..1afb40370 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/data/meson.build @@ -0,0 +1,58 @@ +# Use filename substitution +i18n.merge_file( + input: 'test.desktop.in', + output: '@BASENAME@', + type: 'desktop', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) + +# Use filename substitution for another file +i18n.merge_file( + input: files('test2.desktop.in'), + output: '@BASENAME@', + type: 'desktop', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) + +i18n.merge_file( + input: 'test.desktop.in', + output: 'test3.desktop', + type: 'desktop', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) + +# Regression test when passing File object as input and '@BASENAME@' as output +# in multiple i18n.merge_file() calls. It used to make target name collision. +# https://github.com/mesonbuild/meson/issues/9022 +i18n.merge_file( + input: configure_file( + input: 'test5.desktop.in.in', + output: '@BASENAME@', + configuration: { 'NAME': 'Application' }, + ), + output: '@BASENAME@', + type: 'desktop', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) +i18n.merge_file( + input: configure_file( + input: 'test6.desktop.in.in', + output: '@BASENAME@', + configuration: { 'NAME': 'Application' }, + ), + output: '@BASENAME@', + type: 'desktop', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) + +subdir('data3') diff --git a/meson/test cases/frameworks/6 gettext/data/test.desktop.in b/meson/test cases/frameworks/6 gettext/data/test.desktop.in new file mode 100644 index 000000000..33b9a9fd8 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/data/test.desktop.in @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=Test +GenericName=Application +Comment=Test Application +Type=Application + diff --git a/meson/test cases/frameworks/6 gettext/data/test2.desktop.in b/meson/test cases/frameworks/6 gettext/data/test2.desktop.in new file mode 100644 index 000000000..41f931c36 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/data/test2.desktop.in @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=Test 2 +GenericName=Application +Comment=Test Application +Type=Application + diff --git a/meson/test cases/frameworks/6 gettext/data/test5.desktop.in.in b/meson/test cases/frameworks/6 gettext/data/test5.desktop.in.in new file mode 100644 index 000000000..c75bf7391 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/data/test5.desktop.in.in @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=Test 2 +GenericName=@NAME@ +Comment=Test Application +Type=Application + diff --git a/meson/test cases/frameworks/6 gettext/data/test6.desktop.in.in b/meson/test cases/frameworks/6 gettext/data/test6.desktop.in.in new file mode 100644 index 000000000..c75bf7391 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/data/test6.desktop.in.in @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=Test 2 +GenericName=@NAME@ +Comment=Test Application +Type=Application + diff --git a/meson/test cases/frameworks/6 gettext/data2/meson.build b/meson/test cases/frameworks/6 gettext/data2/meson.build new file mode 100644 index 000000000..b8c90a138 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/data2/meson.build @@ -0,0 +1,9 @@ +i18n.merge_file( + input: 'test.desktop.in', + output: 'test.plugin', + type: 'desktop', + po_dir: '../po', + args: ['--keyword=Description'], + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) diff --git a/meson/test cases/frameworks/6 gettext/data2/test.desktop.in b/meson/test cases/frameworks/6 gettext/data2/test.desktop.in new file mode 100644 index 000000000..5c8ea2eb7 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/data2/test.desktop.in @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=Test +GenericName=Application +Description=Test Application +Type=Application + diff --git a/meson/test cases/frameworks/6 gettext/generated/desktopgenerator.py b/meson/test cases/frameworks/6 gettext/generated/desktopgenerator.py new file mode 100644 index 000000000..e49c2d6dc --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/generated/desktopgenerator.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import os, sys, shutil + +ifile = sys.argv[1] +ofile = sys.argv[2] + +try: + os.unlink(ofile) +except FileNotFoundError: + pass + +shutil.copy(ifile, ofile) diff --git a/meson/test cases/frameworks/6 gettext/generated/meson.build b/meson/test cases/frameworks/6 gettext/generated/meson.build new file mode 100644 index 000000000..5ed9205e9 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/generated/meson.build @@ -0,0 +1,16 @@ +dgen = find_program('desktopgenerator.py') + +desktop_in_file = custom_target('something.desktop.in', + input : ['something.desktop.in.in'], + output : 'something.desktop.in', + command : [dgen, '@INPUT@', '@OUTPUT@'], +) + +i18n.merge_file( + input : desktop_in_file, + output : 'something.desktop', + type : 'desktop', + po_dir : '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications'), +) diff --git a/meson/test cases/frameworks/6 gettext/generated/something.desktop.in.in b/meson/test cases/frameworks/6 gettext/generated/something.desktop.in.in new file mode 100644 index 000000000..e2094fdc2 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/generated/something.desktop.in.in @@ -0,0 +1,15 @@ +[Desktop Entry] +Name=Something doer +Comment=Do something +# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! +Keywords=zip;tar;extract;unpack; +TryExec=file-roller +Exec=file-roller %U +StartupNotify=true +Terminal=false +Type=Application +# Translators: Do NOT translate or transliterate this text (this is an icon file name)! +Icon=something +Categories=GTK;GNOME;Utility +X-GNOME-DocPath=file-roller/file-roller.xml +X-GNOME-UsesNotifications=true diff --git a/meson/test cases/frameworks/6 gettext/meson.build b/meson/test cases/frameworks/6 gettext/meson.build new file mode 100644 index 000000000..9856341aa --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/meson.build @@ -0,0 +1,24 @@ +project('gettext example', 'c') + +gettext = find_program('gettext', required: false) +if not gettext.found() + error('MESON_SKIP_TEST gettext not found.') +endif + +xgettext = find_program('xgettext', required: false) +if not xgettext.found() + error('MESON_SKIP_TEST xgettext not found.') +endif + +intl = dependency('intl', required: false) +if not intl.found() + error('MESON_SKIP_TEST libintl/gettext functions not found.') +endif + +i18n = import('i18n') + +subdir('po') +subdir('src') +subdir('data') +subdir('data2') +subdir('generated') diff --git a/meson/test cases/frameworks/6 gettext/po/LINGUAS b/meson/test cases/frameworks/6 gettext/po/LINGUAS new file mode 100644 index 000000000..c9274bff0 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/po/LINGUAS @@ -0,0 +1,4 @@ +de +fi +ru + diff --git a/meson/test cases/frameworks/6 gettext/po/POTFILES b/meson/test cases/frameworks/6 gettext/po/POTFILES new file mode 100644 index 000000000..8ac0de5f0 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/po/POTFILES @@ -0,0 +1,2 @@ +src/intlmain.c +data/test.desktop.in diff --git a/meson/test cases/frameworks/6 gettext/po/de.po b/meson/test cases/frameworks/6 gettext/po/de.po new file mode 100644 index 000000000..8d9d6e7b6 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/po/de.po @@ -0,0 +1,22 @@ +# German translations for PACKAGE package. +# Copyright (C) 2013 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Jussi Pakkanen <jpakkane@brash>, 2013. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-09-12 18:53+0300\n" +"PO-Revision-Date: 2013-09-12 18:57+0300\n" +"Last-Translator: Jussi Pakkanen <jpakkane@brash>\n" +"Language-Team: German\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ASCII\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/intlmain.c:15 +msgid "International greeting." +msgstr "Internationale Gruss." diff --git a/meson/test cases/frameworks/6 gettext/po/fi.po b/meson/test cases/frameworks/6 gettext/po/fi.po new file mode 100644 index 000000000..114cb10c3 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/po/fi.po @@ -0,0 +1,22 @@ +# Finnish translations for PACKAGE package. +# Copyright (C) 2013 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Jussi Pakkanen <jpakkane@brash>, 2013. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-09-12 18:53+0300\n" +"PO-Revision-Date: 2013-09-12 18:57+0300\n" +"Last-Translator: Jussi Pakkanen <jpakkane@brash>\n" +"Language-Team: Finnish\n" +"Language: fi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ASCII\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/intlmain.c:15 +msgid "International greeting." +msgstr "Maailman tervehdys." diff --git a/meson/test cases/frameworks/6 gettext/po/intltest.pot b/meson/test cases/frameworks/6 gettext/po/intltest.pot new file mode 100644 index 000000000..2d0a4ccf7 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/po/intltest.pot @@ -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. +# +#, fuzzy +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: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\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 "" diff --git a/meson/test cases/frameworks/6 gettext/po/meson.build b/meson/test cases/frameworks/6 gettext/po/meson.build new file mode 100644 index 000000000..86e02f1c6 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/po/meson.build @@ -0,0 +1,3 @@ +langs = ['fi', 'de', 'ru'] + +i18n.gettext('intltest', languages : langs) diff --git a/meson/test cases/frameworks/6 gettext/po/ru.po b/meson/test cases/frameworks/6 gettext/po/ru.po new file mode 100644 index 000000000..e5867c8de --- /dev/null +++ b/meson/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 "Тестовое приложение" diff --git a/meson/test cases/frameworks/6 gettext/src/intlmain.c b/meson/test cases/frameworks/6 gettext/src/intlmain.c new file mode 100644 index 000000000..bd7af6f14 --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/src/intlmain.c @@ -0,0 +1,17 @@ +#include<libintl.h> +#include<locale.h> +#include<stdio.h> + +#define _(String) gettext (String) + +#define PACKAGE "intltest" +// WRONG, but enough for this test. +#define LOCALEDIR "/usr/share/locale" + +int main(int argc, char **argv) { + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + printf("%s\n", _("International greeting.")); + return 0; +} diff --git a/meson/test cases/frameworks/6 gettext/src/meson.build b/meson/test cases/frameworks/6 gettext/src/meson.build new file mode 100644 index 000000000..cda3ea4ac --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/src/meson.build @@ -0,0 +1,2 @@ +executable('intlprog', 'intlmain.c', install : true, + dependencies : intl) diff --git a/meson/test cases/frameworks/6 gettext/test.json b/meson/test cases/frameworks/6 gettext/test.json new file mode 100644 index 000000000..23cac0d0f --- /dev/null +++ b/meson/test cases/frameworks/6 gettext/test.json @@ -0,0 +1,16 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/intlprog"}, + {"type": "file", "file": "usr/share/locale/de/LC_MESSAGES/intltest.mo"}, + {"type": "file", "file": "usr/share/locale/fi/LC_MESSAGES/intltest.mo"}, + {"type": "file", "file": "usr/share/locale/ru/LC_MESSAGES/intltest.mo"}, + {"type": "file", "file": "usr/share/applications/something.desktop"}, + {"type": "file", "file": "usr/share/applications/test.desktop"}, + {"type": "file", "file": "usr/share/applications/test.plugin"}, + {"type": "file", "file": "usr/share/applications/test2.desktop"}, + {"type": "file", "file": "usr/share/applications/test3.desktop"}, + {"type": "file", "file": "usr/share/applications/test4.desktop"}, + {"type": "file", "file": "usr/share/applications/test5.desktop"}, + {"type": "file", "file": "usr/share/applications/test6.desktop"} + ] +} |