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.
See #112390 for more context. Essentially, we need to refactor the
Messageclass ingen_l10n_types.dartif we want to support proper placeholder type inference. The high level idea is that we need toTo do step 1, we need the
Messageclass to own all of the translations for the message. We should be able to do this by changingLocalizationsGenerator.loadResources. Then we can also deprecate the old behavior for inferring placeholder types which doesn't work properly.