A test that tests that calling gettext on a UTF-8 msgid works, and that recoding the resulting string works too. This test uses the --from-code=UTF-8 xgettext(1) argument introduced in an earlier patch. This patch only tests the shellscript portion of our gettext interface. I can't get any of these tests to fail on any of the gettext implementations I have around, even without the previous patch to gettext.c. But having exhaustive tests in this area is good regardless. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- po/is.po | 6 ++++++ t/t0200/test.c | 3 +++ t/t0204-gettext-reencode-sanity.sh | 21 +++++++++++++++++++++ 3 files changed, 30 insertions(+), 0 deletions(-) diff --git a/po/is.po b/po/is.po index 39b63b9..dfa3804 100644 --- a/po/is.po +++ b/po/is.po @@ -37,6 +37,12 @@ msgid "TEST: Old English Runes" msgstr "TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ" #. TRANSLATORS: This is a test. You don't need to translate it. +#: t/t0200/test.c:21 +#, c-format +msgid "TEST: ‘single’ and “double” quotes" +msgstr "TILRAUN: ‚einfaldar‘ og „tvöfaldar“ gæsalappir" + +#. TRANSLATORS: This is a test. You don't need to translate it. #: t/t0200/test.sh:8 msgid "TEST: A Shell test string" msgstr "TILRAUN: Skeljartilraunastrengur" diff --git a/t/t0200/test.c b/t/t0200/test.c index 82682dc..ff15c2f 100644 --- a/t/t0200/test.c +++ b/t/t0200/test.c @@ -16,4 +16,7 @@ int main(void) /* TRANSLATORS: This is a test. You don't need to translate it. */ printf(_("TEST: Old English Runes")); + + /* TRANSLATORS: This is a test. You don't need to translate it. */ + printf(_("TEST: ‘single’ and “double” quotes")); } diff --git a/t/t0204-gettext-reencode-sanity.sh b/t/t0204-gettext-reencode-sanity.sh index 3222e37..1a7ea37 100755 --- a/t/t0204-gettext-reencode-sanity.sh +++ b/t/t0204-gettext-reencode-sanity.sh @@ -40,4 +40,25 @@ test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UT fi ' +test_expect_success GETTEXT_LOCALE 'gettext: Fetching a UTF-8 msgid -> UTF-8' ' + printf "TILRAUN: ‚einfaldar‘ og „tvöfaldar“ gæsalappir" >expect && + LANGUAGE=is LC_ALL="$is_IS_locale" gettext "TEST: ‘single’ and “double” quotes" >actual && + test_cmp expect actual +' + +# How these quotes get transliterated depends on the gettext implementation: +# +# Debian: ,einfaldar' og ,,tvöfaldar" [GNU libintl] +# FreeBSD: `einfaldar` og "tvöfaldar" [GNU libintl] +# Solaris: ?einfaldar? og ?tvöfaldar? [Solaris libintl] +# +# Just make sure the contents are transliterated, and don't use grep -q +# so that these differences are emitted under --verbose for curious +# eyes. +test_expect_success GETTEXT_ISO_LOCALE 'gettext: Fetching a UTF-8 msgid -> ISO-8859-1' ' + LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: ‘single’ and “double” quotes" >actual && + grep "einfaldar" actual && + grep "$(echo tvöfaldar | iconv -f UTF-8 -t ISO8859-1)" actual +' + test_done -- 1.7.2.2.536.g3f548 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html