Tae Hyung Kim
5c44b1df0f
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 .
2023-04-26 11:49:25 -07:00
Tae Hyung Kim
8be335f24c
Handle dollar signs properly when generating localizations ( #125514 )
...
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 .
2023-04-25 22:52:24 +00:00
Albert Wolszon
509c2ddef3
Add decimalPatternDigits to gen-l10n valid NumberFormats ( #122682 )
...
`intl` [0.18.0 added](https://pub.dev/packages/intl/changelog#0180 ) a
[`NumberFormat.decimalPatternDigits`](https://pub.dev/documentation/intl/latest/intl/NumberFormat/NumberFormat.decimalPatternDigits.html )
pattern that allows `decimalDigits` param.
Fixes #122785
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [ ] ~I updated/added relevant documentation (doc comments with
`///`).~
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-04-06 11:13:47 -07:00
Lioness100
26b6c1bedd
Fix typos ( #121171 )
...
* Fix typos
* lowercase animated & opacity
* Undo typo fix
---------
Co-authored-by: Michael Goderbauer <goderbauer@google.com>
2023-02-23 19:43:21 +00:00
Tae Hyung Kim
becb6bd00a
Fix message type inconsistency between locales ( #120129 )
...
* init
* fix error handling
* fix issue
* lint?
* error handling tests
* lint
2023-02-13 23:05:57 +00:00
Tae Hyung Kim
3884381415
Make gen-l10n error handling independent of logger state ( #119644 )
...
* init
* lint
* lint again
2023-01-31 15:28:27 -08:00
Tae Hyung Kim
117a83a4a7
Throw error when plural case had undefined behavior ( #116622 )
...
* init
* add comment
* make error more actionable
2022-12-08 22:29:14 +00:00
Tae Hyung Kim
21f3ce8b69
[gen_l10n] Multiline descriptions ( #116380 )
...
* init
* empty commit to start google testing
2022-12-06 19:16:23 +00:00
Ahmed Ashour
f6224f368a
[gen_l10n] keys can contain dollar sign ( #114808 )
...
* [gen_l10n] keys can contain dollar sign
Fixes #112250
* Update packages/flutter_tools/lib/src/localizations/gen_l10n.dart
Co-authored-by: Christopher Fujino <fujino@google.com>
2022-12-01 21:42:02 +00:00
Tae Hyung Kim
7802c7acd8
[gen_l10n] Improvements to gen_l10n
( #116202 )
...
* 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 :(
2022-11-30 15:07:06 -08:00
Tae Hyung Kim
215f6372c6
Refactor Message class to hold all translations ( #115506 )
...
* init
* more fixing
* finish
* fix lint
* address pr comments
* redo checks
2022-11-28 20:27:33 +00:00
Tae Hyung Kim
cef4c2aac8
ICU Message Syntax Parser ( #112390 )
...
* 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
2022-11-05 10:26:46 -07:00
Tae Hyung Kim
001c499f24
[gen_l10n] Warn users when placeholder types are converted to 'num' when using pluralization ( #108036 )
...
* init
* asdf
* fix tests
* change warning slightly
* fix test again
* fix spacing and comment
* fix lint
2022-07-26 14:13:06 -07:00
Christopher Fujino
94da724868
[flutter_tools] fix RangeError in gen-l10n by checking for empty string ( #107604 )
2022-07-15 18:56:09 +00:00
Tae Hyung Kim
2da228593f
[gen_l10n] Throw error when arb file does not exist ( #107583 )
2022-07-15 18:18:06 +00:00
Michael Goderbauer
3fa355c97d
Remove dead code in tools tests ( #104567 )
2022-05-25 12:48:17 -07:00
Alex Li
aa39fa5a88
[gen_l10n] Better blank lines in the header of generated files ( #103414 )
2022-05-12 16:04:18 -07:00
Alex Li
dca58a289b
[gen_l10n] Throw a specified exception when the language code is invalid ( #102431 )
2022-04-24 11:04:06 -07:00
Hans Muller
09d08510d0
Revert "allow full locale in .arb files ( #93401 )" ( #93806 )
...
This reverts commit 16f441188c
.
2021-11-17 11:26:16 -08:00
Taha Tesser
16f441188c
allow full locale in .arb files ( #93401 )
2021-11-17 09:35:47 -08:00
Shueh Chou Lu
e8b3fe8aa6
Use num on plural ( #93228 )
2021-11-10 08:47:25 -08:00
J-P Nurmi
550281e581
[gen_l10n] retain full output file suffix ( #88362 )
2021-11-08 13:55:19 -08:00
Ian Hickson
61a0add286
Enable avoid_redundant_argument_values lint ( #91409 ) ( #91462 )
2021-10-08 09:25:14 -07:00
Zachary Anderson
b9d2177da0
Revert "Enable avoid_redundant_argument_values lint ( #91409 )" ( #91461 )
...
This reverts commit 5fd259be24
.
2021-10-07 21:11:07 -07:00
Ian Hickson
5fd259be24
Enable avoid_redundant_argument_values lint ( #91409 )
2021-10-07 20:13:02 -07:00
Ahmed Ashour
eb185d73ce
internationalization: fix select with incorrect message ( #90096 )
2021-09-16 09:23:22 -07:00
Ahmed Ashour
5848a1620d
[gen_l10n] to handle arbitrary DateFormat patterns ( #86844 )
2021-08-12 14:34:52 -07:00
Ahmed Ashour
bf132daef3
[gen_l10n] correct variable name when the placeholder requiresFormatting ( #86842 )
2021-07-22 13:55:18 -07:00
Ahmed Ashour
f568d929db
[gen_l10n] Support plurals and selects inside string ( #86167 )
2021-07-21 12:41:06 -07:00
Shi-Hao Hong
b0bd7cf1d8
make app localizations lookup a public method ( #84732 )
2021-07-01 15:01:03 -07:00
Alexandre Ardhuin
cfc08594d9
enable lint use_test_throws_matchers ( #83943 )
2021-06-03 22:14:03 -07:00
Michael Goderbauer
ee17ebe51f
Use type:int without format in gen_l10n ( #83132 )
2021-05-24 09:54:02 -07:00
Michael Goderbauer
485c409184
import pkg:intl when DateFormat or NumberFormat is used ( #83122 )
2021-05-21 19:04:04 -07:00
Hattomo (TomohiroHattori)
08a70e7ac8
Enable avoid_escaping_inner_quotes lint ( #81153 )
2021-05-19 09:54:02 -07:00
Jenn Magder
25c10d6a1c
Replace testUsingContext with testWithoutContext in a few places ( #82498 )
2021-05-13 23:09:03 -07:00
Shi-Hao Hong
633edb649f
[gen-l10n] Cleans up formatting of the generated file ( #79517 )
2021-05-11 17:19:05 -07:00
Phil Quitslund
61c30c41b2
fix sort_directives violations ( #80817 )
2021-04-21 13:49:03 -07:00
Jenn Magder
728a193383
Migrate gen_l10n to null safety ( #80763 )
2021-04-20 11:09:03 -07:00
Jenn Magder
b4175e9b86
Refactor LocalizationsGenerator initialize instance method into factory ( #80605 )
2021-04-19 20:24:04 -07:00
Shi-Hao Hong
9077a5c69b
[gen-l10n] Remove more ignores, conditionally generate some code ( #78975 )
2021-03-31 19:54:02 -07:00
Shi-Hao Hong
134aa8e9da
[gen-l10n] Add nullable-getter
flag ( #79263 )
2021-03-29 20:59:04 -07:00
Jenn Magder
bd94007356
Migrate localizations_utils to null safety ( #78939 )
2021-03-24 16:35:16 -07:00
Shi-Hao Hong
9f49181f40
[gen-l10n] Remove need for ignoring two lints in generated code ( #78778 )
...
* Remove need for unused import for placeholder braces
* Remove need for unused intl import for when plurals aren't used in the generated code
2021-03-24 15:46:09 +08:00
Ian Hickson
f3c25fa07a
Align more closely with package:test ( #77118 ) ( #78343 )
2021-03-16 13:58:02 -07:00
Zachary Anderson
e7e1a04aa3
Revert "Align more closely with package:test ( #77118 )" ( #78329 )
...
This reverts commit 0cbe597540
.
2021-03-16 09:26:34 -07:00
Ian Hickson
0cbe597540
Align more closely with package:test ( #77118 )
2021-03-15 16:28:02 -07:00
Jonah Williams
74bd7b6f6d
[flutter_tools] opt all flutter tool libraries and tests out of null safety. ( #74832 )
...
* opt out the flutter tool
* oops EOF
* fix import
* Update tool_backend.dart
* Update daemon_client.dart
* fix more
2021-01-27 15:17:53 -08:00
Sigurd Meldgaard
178c87cc27
Avoid relative paths in .dart_tool/package_config.json when generate:true ( #73944 )
...
Instead of using package:package_config to write the .dart_tool/package_config the original json is modified and rewritten.
The .dart_tool/package_config.json file is read twice to simplify control flow.
This also avoids the issue of package:package_config writing directly to local filesystem.
2021-01-20 14:53:49 +01:00
Shi-Hao Hong
a912030982
[gen_l10n] Use l10n.yaml file instead of command line arguments if it exists ( #72950 )
...
* Reorganize files
* Use l10n.yaml instead of command line args
2021-01-05 11:50:32 +08:00
Shi-Hao Hong
4d663472e2
[gen_l10n] Improve status message when untranslated messages are still present ( #72944 )
2021-01-04 01:54:02 -08:00