From d019ed198d90c5dee2b5dd5f39ffa922263f50e4 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 26 Jan 2023 18:46:06 +0100 Subject: Keep @modifiers when parsing locales (#947) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Locale modifiers ("@variants") are described in the GNU gettext documentation like this: > The ‘@variant’ can denote any kind of characteristics that is not > already implied by the language ll and the country CC. […] It can also > denote a dialect of the language, … Wherein Babel previously would discard these, this patch stores the modifier information in the `Locale` objects, handling string representation accordingly. Resolves: #946 Signed-off-by: martin f. krafft Co-authored-by: Aarni Koskela --- tests/test_core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test_core.py b/tests/test_core.py index 2a7e605..0023824 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -283,10 +283,12 @@ def test_parse_locale(): assert (excinfo.value.args[0] == "'not_a_LOCALE_String' is not a valid locale identifier") - assert core.parse_locale('it_IT@euro') == ('it', 'IT', None, None) + assert core.parse_locale('it_IT@euro') == ('it', 'IT', None, None, 'euro') + assert core.parse_locale('it_IT@something') == ('it', 'IT', None, None, 'something') + assert core.parse_locale('en_US.UTF-8') == ('en', 'US', None, None) assert (core.parse_locale('de_DE.iso885915@euro') == - ('de', 'DE', None, None)) + ('de', 'DE', None, None, 'euro')) @pytest.mark.parametrize('filename', [ -- cgit v1.2.1