Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for pluralisation during gettext resource translation #10979

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions sphinx/locale/__init__.py
Expand Up @@ -221,16 +221,13 @@ def setup(app):

.. versionadded:: 1.8
"""
def gettext(message: str, *args: Any) -> str:
def gettext(message: str) -> str:
if not is_translator_registered(catalog, namespace):
# not initialized yet
return _TranslationProxy(_lazy_translate, catalog, namespace, message) # type: ignore[return-value] # noqa: E501
else:
translator = get_translator(catalog, namespace)
if len(args) <= 1:
return translator.gettext(message)
else: # support pluralization
return translator.ngettext(message, args[0], args[1])
return translator.gettext(message)

return gettext

Expand Down