1. 18 Jul, 2023 1 commit
    • Tae Hyung Kim's avatar
      Relax syntax for gen-l10n (#130736) · c6b93b2d
      Tae Hyung Kim authored
      To preserve backward compatibility with the old parser which would
      ignore syntax errors, this PR introduces a way to treat the special
      characters `{` and `}` in the following way:
      1. If we encounter a `{` which searching for a string token and this `{`
      is not followed by a valid placeholder, then we treat the `{` as a
      string and continue lexing for strings.
      2. If we encounter a `}` while not within some expression (i.e.
      placeholders, arguments, plurals, or selects), then we treat the `}` as
      a string and continue lexing for strings.
      
      This makes it so that
      ```
      "helloWorld": "{ } { placeholder }",
      "@@helloWorld": {
        "placeholders": {
          "placeholder" {}
        }
      }
      ```
      treats the `{ }` as a string while `{ placeholder } ` is treated as a
      placeholder.
      
      Fixes https://github.com/flutter/flutter/issues/122404.
      c6b93b2d
  2. 26 Apr, 2023 1 commit
    • 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
  3. 25 Apr, 2023 1 commit
    • Tae Hyung Kim's avatar
      Handle dollar signs properly when generating localizations (#125514) · 8be335f2
      Tae Hyung Kim authored
      Currently, the code doesn't properly handle strings which contain dollar signs. The return expression for the generated localization function is computed by `generateReturnExpr` which concatenates several strings, which are either interpolated placeholders, interpolated function calls, or normal strings, but we didn't properly escape dollar signs before sending normal strings to `generateReturnExpr`.
      
      Fixes #125461.
      8be335f2
  4. 22 Mar, 2023 2 commits
  5. 23 Jan, 2023 1 commit
  6. 11 Dec, 2022 1 commit
  7. 30 Nov, 2022 1 commit
    • Tae Hyung Kim's avatar
      [gen_l10n] Improvements to `gen_l10n` (#116202) · 7802c7ac
      Tae Hyung Kim authored
      * init
      
      * fix tests
      
      * fix lint
      
      * extra changes
      
      * oops missed some merge conflicts
      
      * fix lexer add tests
      
      * consistent warnings and errors
      
      * throw error at the end
      
      * improve efficiency, improve code generation
      
      * fix
      
      * nit
      
      * fix test
      
      * remove helper method class
      
      * two d's
      
      * oops
      
      * empty commit as google testing won't pass :(
      7802c7ac
  8. 29 Nov, 2022 1 commit
  9. 05 Nov, 2022 1 commit
    • Tae Hyung Kim's avatar
      ICU Message Syntax Parser (#112390) · cef4c2aa
      Tae Hyung Kim authored
      * init
      
      * code generation
      
      * improve syntax error, add tests
      
      * add tests and fix bugs
      
      * code generation fix
      
      * fix all tests :)
      
      * fix bug
      
      * init
      
      * fix all code gen issues
      
      * FIXED ALL TESTS :D
      
      * add license
      
      * remove trailing spaces
      
      * remove print
      
      * tests fix
      
      * specify type annotation
      
      * fix test
      
      * lint
      
      * fix todos
      
      * fix subclass issues
      
      * final fix; flutter gallery runs
      
      * escaping for later pr
      
      * fix comment
      
      * address PR comments
      
      * more
      
      * more descriptive errors
      
      * last fixes
      cef4c2aa
  10. 19 Aug, 2022 1 commit
  11. 24 Apr, 2022 1 commit
  12. 02 Feb, 2022 1 commit
  13. 08 Oct, 2021 3 commits
  14. 30 Jun, 2021 1 commit
  15. 28 Jun, 2021 1 commit
  16. 27 Jun, 2021 1 commit
  17. 01 Jun, 2021 1 commit
  18. 30 Mar, 2021 1 commit
  19. 24 Mar, 2021 1 commit
  20. 27 Jan, 2021 1 commit
  21. 05 Jan, 2021 1 commit
  22. 31 Oct, 2020 1 commit
  23. 26 Oct, 2020 1 commit
  24. 21 Oct, 2020 2 commits
  25. 12 Oct, 2020 1 commit
  26. 03 Sep, 2020 1 commit
  27. 08 Apr, 2020 1 commit
  28. 06 Apr, 2020 1 commit
  29. 01 Apr, 2020 1 commit
  30. 26 Mar, 2020 1 commit
  31. 17 Mar, 2020 1 commit
  32. 05 Feb, 2020 1 commit
  33. 31 Jan, 2020 2 commits
  34. 28 Jan, 2020 1 commit
  35. 24 Jan, 2020 1 commit