• Tae Hyung Kim's avatar
    Refactor "gen-l10n" command to use same code path when "l10n.yaml" is present... · 5c44b1df
    Tae Hyung Kim authored
    Refactor "gen-l10n" command to use same code path when "l10n.yaml" is present or not present (#125429)
    
    I think this is a long needed change to the `gen-l10n` command.
    Essentially, the arguments to `flutter gen-l10n` can be provided by two
    different methods: via command line arguments or via the `l10n.yaml`
    file. The existence of a `l10n.yaml` file causes the latter approach to
    take precedence.
    
    However, currently, there's several differences in how the two
    approaches are handled, and most of the default arguments are all over
    the place, causing unexpected issues such as #120457 or #120023.
    
    This PR refactors the command so that
    * `LocalizationOptions` are more consistent with the actual argument
    names/yaml options.
    * All default values are determined in `LocalizationOptions`'s
    constructor (or in `argParser.addOption(...)` in the case a boolean
    value needs to be explicitly true).
    * New `parseLocalizationsOptionsFromCommand` function to parse
    arguments.
    * Parse `LocalizationOptions` at the beginning of `runCommand()` and
    pass it to `generateLocalizations`.
    
    Fixes #120023.
    5c44b1df
gen_l10n.dart 53.9 KB