Commit graph

33 commits

Author SHA1 Message Date
Shi-Hao Hong b80b432555
Move gen_l10n into flutter_tools (#65025) 2020-09-03 09:26:58 -07:00
Shi-Hao Hong fd22fc3e35
[gen_l10n] Synthetic package generation by default (#62395)
* synthetic packages by default in gen_l10n tool

* Refactor default path for synthetic package

* Remove unused import

* Code cleanup

* Further improvements to help text

* Refactor synthetic package path

* Remove newlines

* Test cleanup

* clean up logic in inputs and outputs list function

* Update l10n.yaml usage

* only add option if value is non-null

* Update stocks app as proof of concept for synthetic package usage

* Address nits

* print pubspec contents

* add print statements

* Do not allow null value for useSyntheticPackage

* +

* +

* +

* +

* Cleanup

* Add test

* Fix text

* Dont parse pubspec directly

* Test using context

* WIP: generate synthetic packages on pub get -- needs tests

* Allow null value

* Update null handling

* Refactor to properly handle null case

* Fix yamlMap condition

* Fix yaml node for real

* WIP: struggling to write tests

* WIP - take absolute path as an option

* Add tests

* Use environment project directory for synthetic package generation pathway

* Fix typo

* Improve help text

* Update defaults

* Remove unauthorized path import

* Fix pathing issues at synthetic package generation

* Fix typo in test

* Use path.join so projectDir matches up based on OS

* Fix Windows pathing in test

* Remove unnecessary replaceApp code for projectDir.path

* Use globals.fs.currentDirectory.path in resident_runner_test.dart

* Fix merge conflict

* Add test to ensure that synthetic package is generated on pub get

* Fix resident_runner_test.dart tests

* Fix tests

* Use package:file instead of dart:io

* WIP - exploration

* Remove synthetic package use from stocks example

* Update integration test to not use synthetic packages

* Remove trailing whitespace

* flutter pub get runs synth package generation

* Remove more print statements

* Add license header

* WIP - minimally working pub.get

* Use own MockBuildSystem

* Modify test and implementation to be a little cleaner

* Fix flutter pub get invocation

* Use synthetic packages in stocks app

* Revert "Use synthetic packages in stocks app"

This reverts commit 45bf24903c.

* Add environment and buildSystem params to flutter test

* Address code review feedback

* +

* Isolate codegen into its own API

* Fix imports

* Slight refactor

* Add one more test for no l10n.yaml file

* Remove unneeded mock class and import in pub_get_test.dart

* More code review feedback

* Remove unnecessary imports

* Remove `return await`s that I missed

* use arrow functions instead
2020-08-31 13:19:41 +08:00
Shi-Hao Hong 0a7c6243fa
[gen_l10n] Absolute project path parameter (#63368) 2020-08-13 05:11:05 -07:00
Shi-Hao Hong 1e6e7150f3
[gen_l10n] Update the arb filename parsing logic (#60185)
* Update the arb filename parsing to account for underscores

* Generalize the locale searching algorithm

* Update filename and @@locale behavior to require them to match
2020-06-26 12:01:59 +08:00
Per Classon 56a7dacd46
[flutter_tools] For l10n with deferred loading, use loadLibrary for non-web too (#59539)
After Dart VM change we are now required to use loadLibrary on an import whenever it is imported as deferred.

See: https://dart-review.googlesource.com/c/sdk/+/149613
2020-06-16 13:36:28 -07:00
Shi-Hao Hong eadd30eb6c
Improve arb FormatException error message (#56373) 2020-05-07 18:09:03 -07:00
Shi-Hao Hong 13501af6e6
[gen_l10n] Optionally generate list of inputs/outputs (#56490) 2020-05-07 11:46:02 -07:00
Shi-Hao Hong de4f052703
[gen_l10n] Fix unintended breaking change introduced by output-dir option (#55909)
* Fix breaking change introduced by gen_l10n output-dir option
2020-04-28 16:25:59 -07:00
Shi-Hao Hong 9d7af39a5b
[gen_l10n] Output directory option (#55792)
* Add new output-dir option for gen_l10n tool
2020-04-28 13:10:27 -07:00
Per Classon 4451ffca23
Add option for deferred loading to gen_l10n (#53824) 2020-04-09 03:57:01 -07:00
Shi-Hao Hong 5d63637e43
[gen_l10n] Fallback feature for untranslated messages (#53374)
* Generate methods using template resources if they do not exist in other locales

* Added a flag to either output of messages that have not been translated with detail into a file, or display a summary on the terminal.

* Add integration test for fallback message usage
2020-04-08 18:55:50 -07:00
gaaclarke 83a74e11d2
Started caching results from iana. (#53286) 2020-03-25 18:16:02 -07:00
Shi-Hao Hong 351457cdd0
[gen_l10n] Separate out AppLocalizations classes and subclasses by language code (#52335) 2020-03-17 08:46:02 -07:00
Shi-Hao Hong 96fd143cd7
[gen_l10n] Optional Headers (#52125)
* Expose --header and --header-file arguments for gen_l10n
2020-03-11 13:55:54 -07:00
Shi-Hao Hong c98500dea3
Update gen_l10n tool to require base locale; Stocks app refresh (#51602) 2020-02-28 22:21:01 -08:00
Hans Muller 13e1336e6c
Generate message lookup in gen_l10n (#50733) 2020-02-24 20:17:13 -08:00
Alexandre Ardhuin 7d7ac7c32b
start multiline strings with newline (#50825) 2020-02-20 10:16:28 +01:00
Alexandre Ardhuin f15c887c63
change quote to avoid escapes (#50368) 2020-02-11 20:58:27 +01:00
Shi-Hao Hong 5dfa8e9c05
Remove redundant gen_l10n tests (#50301) 2020-02-07 13:59:45 -08:00
Alexandre Ardhuin b953c3e5a8
use raw strings to avoid escaping (#50322) 2020-02-07 16:35:55 +01:00
Alexandre Ardhuin 5c28e3eeea
unnecessary escapes fixes (#50178)
* unnecessary escapes fixes

* replace some strings with raw strings

* update regexp

* address review comments
2020-02-07 06:35:50 +01:00
Alexandre Ardhuin 5a8de59a66
refactor generateString to emit simpler dart code (#49334) 2020-01-31 11:57:54 +01:00
Hans Muller 3f2c6ea724
Integration test for the gen_l10n tool (#49586) 2020-01-29 12:45:03 -08:00
Hans Muller 7539826d7b Update gen_l10n handling of plurals, numbers, and dates (#49357) 2020-01-27 16:18:02 -08:00
Hans Muller 667c38d551
gen_l10n: generated Intl.message parameter should be an ordinary string (#48929) 2020-01-16 07:20:38 -08:00
Shi-Hao Hong 47bba44920
L10n Currency Formatting, Fixes to Named vs Positional Parameters (#48445)
* Add currency formatting for l10n tool, fix positional vs named params
2020-01-10 14:19:40 -08:00
Shi-Hao Hong c525988c8c
Reorganize tests in l10n tool (#47704) 2020-01-08 12:29:18 -08:00
Shi-Hao Hong b038b40941 gen_l10n Number Format Handling (#47706) 2020-01-07 22:38:02 -08:00
Shi-Hao Hong 173322dc78
Support preferred locales for gen_l10n (#47845)
* Add preferred-supported-locales option to gen_l10n.dart executable
2019-12-30 11:22:01 -08:00
Shi-Hao Hong 88cd1135bf
Handle plural gen_l10n regular placeholders and DateTime placeholders (#47483)
* Handle simple placeholders in plurals

* Handle Date plural placeholders

* Improve variable names

* Turn assert into exceptions, add tests
2019-12-20 16:22:44 -08:00
Shi-Hao Hong c319f5f8d8
gen_l10n localizations date formatting (simple messages) (#47006)
* Implement date parsing for the gen_l10n tool
2019-12-17 14:03:43 -08:00
Shi-Hao Hong 2eed59c1d5
Add gen_l10n sorting tests (#46247)
* Add tests for sorting arbPathString, supportedLocales and supportedLanguageCodes alphabetically

* Plural arbPathStrings

* Factor out singleZhMessageArbFileString

* Make translations more accurate and generic
2019-12-13 10:03:56 -08:00
Shi-Hao Hong 37e66b2179
gen_l10n.dart tool testing (#44856)
* Add tests to gen_l10n.dart tool

* Separate out LocalizationsGenerator class to improve testability of code

* Add testing dependencies to dev/tools

* Integrate dev/tools testing to flutter CI

* Restructure dev/tools folder for testing

* Fix license headers
2019-12-06 11:35:08 -08:00