You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for the existing localizations protocol to be easily used anywhere user visible text appears.
What is the feature request for?
The core library
The Problem
Currently, the library only provides means to handle localizations automatically for descriptions and parameters of application commands. The localizations protocol is exposed as a part of the API, but the use of it is cumbersome. Additionally, it does not natively support strings where substitution/formatting with dynamic values needs to occur.
The Ideal Solution
Allow for the use of Localized anywhere text is rendered on the user's end: content param of .send methods; Embed's title, description and fields; labels, placeholders etc. of components.
As an extension of current functionality, a way to provide values for a supposed template string could be added, since unlike app command descriptions and params, many strings are bound to have dynamic values.
This could be done possibly by adding a keyword to Localized's constructor, or a method like .format:
locs=inter.bot.i18n.get("EXAMPLE_RESPONSE") or {}
awaitinter.response.send_message(locs.get(str(inter.locale), "Example text."))
or write some sort of wrapper function, which would always need to be passed the i18n store, as well as the current locale.
The upside of this way is it natively supports template strings, since we directly access said string and can format it afterwards.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Summary
Add support for the existing localizations protocol to be easily used anywhere user visible text appears.
What is the feature request for?
The core library
The Problem
Currently, the library only provides means to handle localizations automatically for descriptions and parameters of application commands. The localizations protocol is exposed as a part of the API, but the use of it is cumbersome. Additionally, it does not natively support strings where substitution/formatting with dynamic values needs to occur.
The Ideal Solution
Allow for the use of
Localized
anywhere text is rendered on the user's end:content
param of.send
methods;Embed
's title, description and fields; labels, placeholders etc. of components.As an extension of current functionality, a way to provide values for a supposed template string could be added, since unlike app command descriptions and params, many strings are bound to have dynamic values.
This could be done possibly by adding a keyword to
Localized
's constructor, or a method like.format
:The Current Solution
One has to write boilerplate code like this
or write some sort of wrapper function, which would always need to be passed the
i18n
store, as well as the current locale.The upside of this way is it natively supports template strings, since we directly access said string and can format it afterwards.
Additional Context
No response
The text was updated successfully, but these errors were encountered: