diff --git a/Lib/test/test_tools/i18n_data/encodings/latin2.pot b/Lib/test/test_tools/i18n_data/encodings/latin2.pot new file mode 100644 index 00000000000000..9ae83a801bb248 --- /dev/null +++ b/Lib/test/test_tools/i18n_data/encodings/latin2.pot @@ -0,0 +1,38 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2000-01-01 00:00+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: pygettext.py 1.5\n" + + +#. ascii text +#: latin2.py:7 +msgid "foo" +msgstr "" + +#. latin-2 text +#: latin2.py:10 +msgid "Ř Å™" +msgstr "" + +#. non-latin-2 text +#: latin2.py:13 +msgid "α β" +msgstr "" + +#. ascii text with non-ascii comment +#. Ř Å™ +#: latin2.py:17 +msgid "bar" +msgstr "" + diff --git a/Lib/test/test_tools/i18n_data/encodings/latin2.py b/Lib/test/test_tools/i18n_data/encodings/latin2.py new file mode 100644 index 00000000000000..bd5422d67f0dc8 --- /dev/null +++ b/Lib/test/test_tools/i18n_data/encodings/latin2.py @@ -0,0 +1,17 @@ +# -*- coding: iso-8859-2 -*- + +from gettext import gettext as _ + + +# ascii text +_('foo') + +# latin-2 text +_('Ø ø') + +# non-latin-2 text +_('\u03b1 \u03b2') + +# ascii text with non-ascii comment +# Ø ø +_('bar') diff --git a/Lib/test/test_tools/i18n_data/encodings/latin2_escaped.pot b/Lib/test/test_tools/i18n_data/encodings/latin2_escaped.pot new file mode 100644 index 00000000000000..e5621fbf6b86a3 --- /dev/null +++ b/Lib/test/test_tools/i18n_data/encodings/latin2_escaped.pot @@ -0,0 +1,38 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2000-01-01 00:00+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: pygettext.py 1.5\n" + + +#. ascii text +#: latin2.py:7 +msgid "foo" +msgstr "" + +#. latin-2 text +#: latin2.py:10 +msgid "\305\230 \305\231" +msgstr "" + +#. non-latin-2 text +#: latin2.py:13 +msgid "\316\261 \316\262" +msgstr "" + +#. ascii text with non-ascii comment +#. Ř Å™ +#: latin2.py:17 +msgid "bar" +msgstr "" + diff --git a/Lib/test/test_tools/test_i18n.py b/Lib/test/test_tools/test_i18n.py index 66c33077423229..87139807b4c516 100644 --- a/Lib/test/test_tools/test_i18n.py +++ b/Lib/test/test_tools/test_i18n.py @@ -531,6 +531,9 @@ def extract_from_snapshots(): 'escapes.py': ('--escape', '--add-comments='), # Escape only ascii and let unicode pass through: ('escapes.py', 'ascii-escapes.pot'): ('--add-comments=',), + # Test input files with various encodings: + ('encodings/latin2.py', 'encodings/latin2.pot'): ('--add-comments=',), + ('encodings/latin2.py', 'encodings/latin2_escaped.pot'): ('--add-comments=', '--escape'), } for filename, args in snapshots.items(): diff --git a/Makefile.pre.in b/Makefile.pre.in index e10c78d6403472..80f8b67b400242 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -2644,6 +2644,7 @@ TESTSUBDIRS= idlelib/idle_test \ test/test_tomllib/data/valid/multiline-basic-str \ test/test_tools \ test/test_tools/i18n_data \ + test/test_tools/i18n_data/encodings \ test/test_tools/msgfmt_data \ test/test_ttk \ test/test_unittest \