diff --git a/src/humanize/locale/ar_SA/LC_MESSAGES/humanize.po b/src/humanize/locale/ar/LC_MESSAGES/humanize.po similarity index 100% rename from src/humanize/locale/ar_SA/LC_MESSAGES/humanize.po rename to src/humanize/locale/ar/LC_MESSAGES/humanize.po diff --git a/tests/test_i18n.py b/tests/test_i18n.py index e4f30f0..87ce3bb 100644 --- a/tests/test_i18n.py +++ b/tests/test_i18n.py @@ -94,6 +94,29 @@ def test_intword_plurals(locale: str, number: int, expected_result: str) -> None humanize.i18n.deactivate() +@pytest.mark.parametrize( + ("locale", "expected_result"), + ( + ("ar", "5خامس"), + ("ar_SA", "5خامس"), + ("fr", "5e"), + ("fr_FR", "5e"), + ("pt", "5º"), + ("pt_BR", "5º"), + ("pt_PT", "5º"), + ), +) +def test_langauge_codes(locale: str, expected_result: str) -> None: + try: + humanize.i18n.activate(locale) + except FileNotFoundError: + pytest.skip("Generate .mo with scripts/generate-translation-binaries.sh") + else: + assert humanize.ordinal(5) == expected_result + finally: + humanize.i18n.deactivate() + + @pytest.mark.parametrize( ("locale", "number", "gender", "expected_result"), (