Skip to content

Commit 0944a90

Browse files
docs: correct locale activation return type and thread scope
Document the translation object returned by activate() and clarify that activation and deactivation apply to the calling thread. Prepared with AI assistance (OpenAI Codex).
1 parent 6ed367f commit 0944a90

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎src/humanize/i18n.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,16 @@ def activate(
5959
) -> gettext_module.NullTranslations:
6060
"""Activate internationalisation.
6161
62-
Set `locale` as current locale. Search for locale in directory `path`.
62+
Set `locale` as the current locale for the calling thread. Search for locale
63+
in directory `path`.
6364
6465
Args:
6566
locale (str | None): Language name, e.g. `en_GB`. If `None`, defaults to no
6667
translation. Similar to calling ``deactivate()``.
6768
path (str | pathlib.Path): Path to search for locales.
6869
6970
Returns:
70-
dict: Translations.
71+
gettext.NullTranslations: Translation object for the selected locale.
7172
7273
Raises:
7374
FileNotFoundError: If humanize cannot find the locale folder.
@@ -93,7 +94,7 @@ def activate(
9394

9495

9596
def deactivate() -> None:
96-
"""Deactivate internationalisation."""
97+
"""Deactivate internationalisation for the calling thread."""
9798
_CURRENT.locale = None
9899

99100

0 commit comments

Comments
 (0)