Skip to content

Commit 6f5076d

Browse files
raghav-sharma-aihugovk
authored andcommitted
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 418a6ae commit 6f5076d

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
@@ -61,15 +61,16 @@ def activate(
6161
) -> gettext_module.NullTranslations:
6262
"""Activate internationalisation.
6363
64-
Set `locale` as current locale. Search for locale in directory `path`.
64+
Set `locale` as the current locale for the calling thread. Search for locale
65+
in directory `path`.
6566
6667
Args:
6768
locale (str | None): Language name, e.g. `en_GB`. If `None`, defaults to no
6869
translation. Similar to calling ``deactivate()``.
6970
path (str | pathlib.Path): Path to search for locales.
7071
7172
Returns:
72-
dict: Translations.
73+
gettext.NullTranslations: Translation object for the selected locale.
7374
7475
Raises:
7576
FileNotFoundError: If humanize cannot find the locale folder.
@@ -95,7 +96,7 @@ def activate(
9596

9697

9798
def deactivate() -> None:
98-
"""Deactivate internationalisation."""
99+
"""Deactivate internationalisation for the calling thread."""
99100
_CURRENT.locale = None
100101

101102

0 commit comments

Comments
 (0)