AlertToast icon indicating copy to clipboard operation
AlertToast copied to clipboard

Need an interface to feed in a localized string to title/subtitle

Open koromiko opened this issue 11 months ago • 0 comments

Is your feature request related to a problem? Please describe.

At this moment, the title/subtitle of an AlertToast is a String, and it will be wrapped with a LocalizedString to get a translation.

This causes an issue where we need to parameterize the translation (e.g, (10) drinks, (4) people)) but the string will be wrapped by a LocalizedString again and treated as a localization key.

Describe the solution you'd like

It would be nice to have two interfaces with different types of input parameters. One is the plain string that is supposed to be translated. To support existing usage, add another parameter that is typed LocalizedKey.

Describe alternatives you've considered

Support parameterized localization under the hood, such as providing args for injecting numbers to the localized string.

But I don't think this is a good encapsulation.

Additional context

Hope the description is clear. Thank you!

koromiko avatar Mar 07 '24 01:03 koromiko