diff --git a/src/humanize/i18n.py b/src/humanize/i18n.py index 42447b0..38307ea 100644 --- a/src/humanize/i18n.py +++ b/src/humanize/i18n.py @@ -71,6 +71,9 @@ def activate( Raises: Exception: If humanize cannot find the locale folder. """ + if locale == "en_GB" or locale == "en_US": + locale = None + if path is None: path = _get_default_locale_path() diff --git a/tests/test_i18n.py b/tests/test_i18n.py index f3721c9..908c8fc 100644 --- a/tests/test_i18n.py +++ b/tests/test_i18n.py @@ -39,6 +39,21 @@ def test_i18n() -> None: assert humanize.precisedelta(one_min_three_seconds) == "1 minute and 7 seconds" +def test_en_locale() -> None: + three_seconds = NOW - dt.timedelta(seconds=3) + + humanize.i18n.activate(None) + test_str = humanize.naturaltime(three_seconds) + + humanize.i18n.activate("en_US") + assert test_str == humanize.naturaltime(three_seconds) + + humanize.i18n.activate("en_GB") + assert test_str == humanize.naturaltime(three_seconds) + + humanize.i18n.deactivate() + + def test_intcomma() -> None: number = 10_000_000