From eaabd315c963060f0122703c9006f0a75aec8852 Mon Sep 17 00:00:00 2001 From: Drakunal Date: Thu, 22 Oct 2026 16:52:29 +0530 Subject: [PATCH] Complete and fix the Bengali (bn_BD) translation --- .../locale/bn_BD/LC_MESSAGES/humanize.po | 45 +++++++++++-------- tests/test_i18n.py | 32 +++++++++++++ 2 files changed, 58 insertions(+), 19 deletions(-) diff --git a/src/humanize/locale/bn_BD/LC_MESSAGES/humanize.po b/src/humanize/locale/bn_BD/LC_MESSAGES/humanize.po index 25b4684f..0f7e6099 100644 --- a/src/humanize/locale/bn_BD/LC_MESSAGES/humanize.po +++ b/src/humanize/locale/bn_BD/LC_MESSAGES/humanize.po @@ -125,7 +125,6 @@ msgstr[0] "হাজার" msgstr[1] "হাজার" #: src/humanize/number.py:179 -#, fuzzy msgid "million" msgid_plural "million" msgstr[0] "মিলিয়ন" @@ -176,25 +175,24 @@ msgstr[1] "ওকটিলিয়ন" #: src/humanize/number.py:187 msgid "nonillion" msgid_plural "nonillion" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "ননিলিয়ন" +msgstr[1] "ননিলিয়ন" #: src/humanize/number.py:188 -#, fuzzy msgid "decillion" msgid_plural "decillion" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "ডেসিলিয়ন" +msgstr[1] "ডেসিলিয়ন" #: src/humanize/number.py:189 msgid "googol" msgid_plural "googol" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "গুগল" +msgstr[1] "গুগল" #: src/humanize/number.py:301 msgid "zero" -msgstr "শুন্য" +msgstr "শূন্য" #: src/humanize/number.py:302 msgid "one" @@ -248,7 +246,7 @@ msgstr[1] "%d মিলিসেকেন্ড" #: src/humanize/time.py:164 src/humanize/time.py:259 msgid "a moment" -msgstr "এক মুহুর্ত" +msgstr "এক মুহূর্ত" #: src/humanize/time.py:167 msgid "a second" @@ -274,14 +272,14 @@ msgstr[1] "%d মিনিট" #: src/humanize/time.py:180 msgid "an hour" -msgstr "এক ঘন্টা" +msgstr "এক ঘণ্টা" #: src/humanize/time.py:184 #, python-format msgid "%d hour" msgid_plural "%d hours" -msgstr[0] "%d ঘন্টা" -msgstr[1] "%d ঘন্টা" +msgstr[0] "%d ঘণ্টা" +msgstr[1] "%d ঘণ্টা" #: src/humanize/time.py:188 msgid "a day" @@ -313,19 +311,19 @@ msgstr "এক বছর" #, python-format msgid "1 year, %d day" msgid_plural "1 year, %d days" -msgstr[0] "%d বছর" -msgstr[1] "%d বছর" +msgstr[0] "1 বছর, %d দিন" +msgstr[1] "1 বছর, %d দিন" #: src/humanize/time.py:210 msgid "1 year, 1 month" -msgstr "১ বছর, ১ মাস" +msgstr "1 বছর, 1 মাস" #: src/humanize/time.py:213 #, python-format msgid "1 year, %d month" msgid_plural "1 year, %d months" -msgstr[0] "১ বছর, %d মাস" -msgstr[1] "১ বছর, %d মাস" +msgstr[0] "1 বছর, %d মাস" +msgstr[1] "1 বছর, %d মাস" #: src/humanize/time.py:219 #, python-format @@ -363,4 +361,13 @@ msgstr "গতকাল" #: src/humanize/time.py:600 #, python-format msgid "%s and %s" -msgstr "%s আর %s" +msgstr "%s আর %s" + +# --- filesize units (naturalsize) --- +#, python-format +msgid "%d Byte" +msgstr "%d বাইট" + +#, python-format +msgid "%d Bytes" +msgstr "%d বাইট" diff --git a/tests/test_i18n.py b/tests/test_i18n.py index 683fe3ce..53cc490b 100644 --- a/tests/test_i18n.py +++ b/tests/test_i18n.py @@ -92,6 +92,10 @@ def test_i18n() -> None: assert humanize.naturaltime(three_seconds) == "තත්පර 3කට පෙර" assert humanize.precisedelta(one_min_three_seconds) == "විනාඩි 1යි තත්පර 7ක්" + humanize.i18n.activate("bn_BD") + assert humanize.naturaltime(three_seconds) == "3 সেকেন্ড সময় আগে" + assert humanize.precisedelta(one_min_three_seconds) == "1 মিনিট আর 7 সেকেন্ড" + except FileNotFoundError: pytest.skip("Generate .mo with scripts/generate-translation-binaries.sh") @@ -180,6 +184,10 @@ def test_naturaldelta() -> None: ("lv", 2_000_000, "2,0 miljoni"), ("lv", 11_000_000, "11,0 miljoni"), ("lv", 21_000_000, "21,0 miljons"), + ("bn_BD", 2_000_000, "2.0 মিলিয়ন"), + ("bn_BD", 1_000_000_000_000_000_000_000_000_000_000, "1.0 ননিলিয়ন"), + ("bn_BD", 1_000_000_000_000_000_000_000_000_000_000_000, "1.0 ডেসিলিয়ন"), + ("bn_BD", 10**100, "1.0 গুগল"), ("fr_FR", "1_000", "1,0 mille"), ("fr_FR", "12_400", "12,4 milles"), ("fr_FR", "12_490", "12,5 milles"), @@ -241,6 +249,8 @@ def test_intword_i18n(locale: str, number: int, expected_result: str) -> None: ("fr_FR", 42, "42 octets"), ("si_LK", 1, "බයිට් 1"), ("si_LK", 42, "බයිට් 42"), + ("bn_BD", 1, "1 বাইট"), + ("bn_BD", 42, "42 বাইট"), ("fr_FR", 42_000, "42.0 Ko"), ("fr_FR", 42_000_000, "42.0 Mo"), ("fr_FR", 42_000_000_000, "42.0 Go"), @@ -269,6 +279,28 @@ def test_naturalsize_i18n_binary() -> None: humanize.i18n.deactivate() +@pytest.mark.parametrize( + "locale, days, expected_result", + [ + ("bn_BD", 365, "এক বছর"), + ("bn_BD", 370, "1 বছর, 5 দিন"), + ("bn_BD", 396, "1 বছর, 1 মাস"), + ("bn_BD", 425, "1 বছর, 2 মাস"), + ], +) +def test_naturaldelta_one_year_i18n( + locale: str, days: int, expected_result: str +) -> None: + try: + humanize.i18n.activate(locale) + except FileNotFoundError: + pytest.skip("Generate .mo with scripts/generate-translation-binaries.sh") + else: + assert humanize.naturaldelta(dt.timedelta(days=days)) == expected_result + finally: + humanize.i18n.deactivate() + + @pytest.mark.parametrize( "locale, expected_result", [