Skip to content

ICU Message Refactoring #112709

@thkim1011

Description

@thkim1011

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

  1. Parse each translation for a given message.
  2. Figure out how each placeholder is being used.
  3. 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.
  4. 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)toolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions