Skip to content

Conversation

@cswimr
Copy link
Contributor

@cswimr cswimr commented Dec 24, 2025

Description of the changes

This PR changes the signature of redbot.core.i18n.Translator.__call__() from self, untranslated: str to self, untranslated: str, /, making untranslated a positional-only argument.

This works around an issue in redgettext, where using _("text") works fine, but _(untranslated="text") causes untranslated= to be detected as an unexpected token. Considering this function is a single-argument function, and nothing would be gained from using the keyword argument, I believe marking it as positional-only is the correct solution, rather than making a change in redgettext. This is technically a breaking change though.

This also has the small but notable side effect of removing untranslated= from calls in editors that show inline keyword arguments, such as basedpyright's basedpyright.analysis.inlayHints.callArgumentNames VSCode setting, or similar settings in other extensions. This cuts down on wasted space in the editor without disabling an otherwise useful feature.

image

See the related discussion in #coding.

Have the changes in this PR been tested?

Yes

@github-actions github-actions bot added the Category: Core - i18n This is related to the i18n core API or locale files. label Dec 24, 2025
This commit changes the signature of
`redbot.core.i18n.Translator.__call__()` from `self, untranslated: str`
to `self, untranslated: str, /`, making `untranslated` a positional-only
argument.

This works around an issue in `redgettext`, where using `_("text")`
works fine, but `_(untranslated="text")` causes `untranslated=` to be
detected as an unexpected token. Considering this function is a
single-argument function, and nothing would be gained from using the
keyword argument, I believe marking it as positional-only is the correct
solution, rather than making a change in `redgettext`. This is
technically a breaking change though.

This also has the small but notable side effect of removing
`untranslated=` from calls in editors that show inline keyword
arguments, such as basedpyright's
`basedpyright.analysis.inlayHints.callArgumentNames` VSCode setting, or
similar settings in other extensions. This cuts down on wasted space in
the editor without disabling an otherwise useful feature.

See the related discussion in
[`#coding`](https://discord.com/channels/133049272517001216/160386989819035648/1453030635756191866).
@Jackenmen Jackenmen added this to the 3.6.0 milestone Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Core - i18n This is related to the i18n core API or locale files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants