-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
a: internationalizationSupporting other languages or locales. (aka i18n)Supporting other languages or locales. (aka i18n)toolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Description
See #112390 for more context. Essentially, we need to refactor the Message class in gen_l10n_types.dart if we want to support proper placeholder type inference. The high level idea is that we need to
- Parse each translation for a given message.
- Figure out how each placeholder is being used.
- If there is a conflict (i.e. placeholder is used for both plural (which must be type 'num') and select (which must be type 'String'), then throw an error.
- Otherwise if type is not explicitly defined, then set it to 'num' if only used in plurals and placeholders or set it to 'String' if only used in selects and placeholders.
To do step 1, we need the Message class to own all of the translations for the message. We should be able to do this by changing LocalizationsGenerator.loadResources. Then we can also deprecate the old behavior for inferring placeholder types which doesn't work properly.
Metadata
Metadata
Assignees
Labels
a: internationalizationSupporting other languages or locales. (aka i18n)Supporting other languages or locales. (aka i18n)toolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.