Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/humanize/locale/fa_IR/LC_MESSAGES/humanize.po
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# German translation for humanize.
# Persian translation for humanize.
# Copyright (C) 2016 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the humanize package.
# Christian Klein <chris@5711.org>, 2016.
Expand All @@ -10,8 +10,8 @@ msgstr ""
"POT-Creation-Date: 2023-01-08 19:22+0200\n"
"PO-Revision-Date: 2017-01-10 02:44+0330\n"
"Last-Translator: Christian Klein <chris@5711.org>\n"
"Language-Team: German\n"
"Language: de\n"
"Language-Team: Persian\n"
"Language: fa_IR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -336,7 +336,7 @@ msgstr[1] "%d سال"
#: src/humanize/time.py:256
#, python-format
msgid "%s from now"
msgstr "%s تا به اکنون"
msgstr "%s دیگر"

#: src/humanize/time.py:256
#, python-format
Expand Down
21 changes: 21 additions & 0 deletions tests/test_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,27 @@ def test_i18n() -> None:
assert humanize.precisedelta(one_min_three_seconds) == "1 minute and 7 seconds"


@pytest.mark.parametrize(
"seconds, expected",
[
(-60, "یک دقیقه پیش"),
(-3, "3 ثانیه پیش"),
(0, "اکنون"),
(3, "3 ثانیه دیگر"),
(60, "یک دقیقه دیگر"),
],
)
def test_naturaltime_persian(seconds: int, expected: str) -> None:
try:
humanize.activate("fa_IR")
value = NOW + dt.timedelta(seconds=seconds)
assert humanize.naturaltime(value, when=NOW) == expected
except FileNotFoundError:
pytest.skip("Generate .mo with scripts/generate-translation-binaries.sh")
finally:
humanize.deactivate()


def test_intcomma() -> None:
number = 10_000_000

Expand Down
Loading