Michael Goderbauer
5491c8c146
Auto-format Framework ( #160545 )
...
This auto-formats all *.dart files in the repository outside of the
`engine` subdirectory and enforces that these files stay formatted with
a presubmit check.
**Reviewers:** Please carefully review all the commits except for the
one titled "formatted". The "formatted" commit was auto-generated by
running `dev/tools/format.sh -a -f`. The other commits were hand-crafted
to prepare the repo for the formatting change. I recommend reviewing the
commits one-by-one via the "Commits" tab and avoiding Github's "Files
changed" tab as it will likely slow down your browser because of the
size of this PR.
---------
Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
2024-12-19 20:06:21 +00:00
Albert Wolszon
da188452a6
Allow add_format() in flutter gen-l10n DateTime format ( #156297 )
...
This Pull Request extends the functionality of the `flutter gen-l10n`
command (and its behavior during hot restart/reload) related to
`DateFormat` type placeholders and their `format`. Until now, it was
impossible to take advantage of `intl`'s
`DateFormat.something().add_somethingElse()`. The `.add_x()` part was
impossible to achieve. This PR adds the ability to take advantage of
these methods over `DateFormat`, by adding the `add_` formats after the
`+` character in the `format` in placeholder configuration. You can even
have multiple added format parts if needed. All within a single
placeholder.
<table>
<tr>
<th>Before the PR</th>
<th>After the PR</th>
</tr>
<tr>
<td>
```json
{
"bookingsPage_camo_dataLoaded": "CAMO data from {date} {time}.",
"@bookingsPage_camo_dataLoaded": {
"placeholders": {
"date": {
"type": "DateTime",
"format": "yMMMd"
},
"time": {
"type": "DateTime",
"format": "jm"
}
}
},
}
```
</td>
<td>
```json
{
"bookingsPage_camo_dataLoaded": "CAMO data from {date}.",
"@bookingsPage_camo_dataLoaded": {
"placeholders": {
"date": {
"type": "DateTime",
"format": "yMMMd+jm"
}
}
},
}
```
</td>
</tr>
</table>
Resolves #155817 .
## Next steps
After this PR is merged, an update to [i18n | Flutter > Messages with
dates](https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization#messages-with-dates )
([source](https://github.com/flutter/website/blob/main/src/content/ui/accessibility-and-internationalization/internationalization.md ))
shall be made to include a mention of this new addition.
## 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.
- [x] 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] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#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/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
---------
Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-11-23 18:55:24 +00:00
Matan Lurey
3a17b67353
Add a tag and assert some state in FlutterTestDriver tests. ( #159099 )
...
Towards https://github.com/flutter/flutter/issues/51421 .
Asserts some state we would not like to be hit by in integration tests
using `Flutter*TestDriver`.
In addition, adds a tag that can be used to run all tests that currently
use this pattern:
```sh
flutter test --tags flutter-test-driver
```
This showcases processes leaking quite a bit:
<https://gist.github.com/matanlurey/190d9084d3a45bc5737b8406bc05b4cd >.
2024-11-18 23:37:05 +00:00
TabooSun
e8436970e6
Gen l10n add named argument option ( #138663 )
...
Add an option to use named argument for generated method.
Fix #116308
2024-01-05 21:28:08 +00:00
Tae Hyung Kim
ff838bca89
Add locale-specific DateTime formatting syntax ( #129573 )
...
Based on the [message format
syntax](https://unicode-org.github.io/icu/userguide/format_parse/messages/#examples )
for
[ICU4J](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/MessageFormat.html ).
This adds new syntax to the current Flutter messageFormat parser which
should allow developers to add locale-specific date formatting.
## Usage example
```
"datetimeTest": "Today is {today, date, ::yMd}",
"@datetimeTest": {
"placeholders": {
"today": {
"description": "The date placeholder",
"type": "DateTime"
}
}
}
```
compiles to
```
String datetimeTest(DateTime today) {
String _temp0 = intl.DateFormat.yMd(localeName).format(today);
return 'Today is $_temp0';
}
```
Fixes https://github.com/flutter/flutter/issues/127304 .
2023-06-29 09:23:34 -07: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
Jonah Williams
9f28b83c19
[flutter_tools] migrate some integration tests to null safety ( #103560 )
2022-05-13 09:39:10 -07:00
Tarekk Mohamed Abdalla
fae84f6714
[gen_l10n] Add support for adding placeholders inside select ( #92753 )
2021-11-22 20:08:03 -08:00
Ahmed Ashour
f568d929db
[gen_l10n] Support plurals and selects inside string ( #86167 )
2021-07-21 12:41:06 -07:00
Hattomo (TomohiroHattori)
08a70e7ac8
Enable avoid_escaping_inner_quotes lint ( #81153 )
2021-05-19 09:54:02 -07:00
Shi-Hao Hong
16913b07e8
Relands "[gen-l10n] Fixes named and positional parameter issue with NumberFormat when type is specified" ( #75346 )
...
* ➕ Added a new template for [NumberFo
rmat] with positional parameter(s)
* 🔨 Renamed [numberFormatTemplate] to [numberFormatNamedTemplate]
* [gen-l10n] Fixed generation error for namedParameters and optionalParameters
* [gen-l10n] Fixed string value generation for optional parameter
* [gen-l10n-test] Added new tests for `decimalPattern`, `percentPattern`, `scientificPattern` and formats with optional parameters.
* 🔨 Removed trailing whitespaces
* 🔨 replaced [_generateStringParameterValue] with [generateString]
* 🔨 Specified variable types in NumberFormat templates.
* ➕ Added a new template for [NumberFo
rmat] with positional parameter(s)
* 🔨 Renamed [numberFormatTemplate] to [numberFormatNamedTemplate]
* [gen-l10n] Fixed generation error for namedParameters and optionalParameters
* [gen-l10n] Fixed string value generation for optional parameter
* [gen-l10n-test] Added new tests for `decimalPattern`, `percentPattern`, `scientificPattern` and formats with optional parameters.
* 🔨 Removed trailing whitespaces
* 🔨 replaced [_generateStringParameterValue] with [generateString]
* 🔨 Specified variable types in NumberFormat templates.
* [gen-l10n] ✅ added test for parameter having special characters in string value.
* Accidental tab added to integration test
Co-authored-by: arish <arishsultan104@gmail.com>
2021-02-04 03:31:22 +08:00
Shi-Hao Hong
c12b53e073
Revert "[gen-l10n] Fixes named and positional parameter issue with NumberFormat when type is specified ( #75209 )" ( #75306 )
...
This reverts commit 917577b808
.
2021-02-03 10:32:01 +08:00
Shi-Hao Hong
917577b808
[gen-l10n] Fixes named and positional parameter issue with NumberFormat when type is specified ( #75209 )
2021-02-02 17:06:05 -08: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
Shi-Hao Hong
4996f60b20
[gen_l10n] Fix unintended use of raw string in generateString ( #69382 )
...
* Fix failing tests from introducing raw string generation in gen_l10n tool
2020-10-31 19:24:53 +08:00
Shi-Hao Hong
7b0f38b117
Remove intl_translation from tool integration test ( #69155 )
2020-10-29 14:05:39 -07:00
Jonah Williams
6b444c4dd7
[flutter_tools] standardize patterns for integration.shard ( #64980 )
...
Integration tests must only go through the real file system/process manager/platform. The global indirection makes this code harder to understand than if it directly referred to the concrete instances that are being used.
Update the integration shard to use a const instance of a LocalFIleSystem, LocalProcessManager, and LocalPlatform. Remove global usage and apply testWithoutContext.
2020-09-08 15:56:00 -07:00
Jason Simmons
b3f0f092ec
Disable the deferred loading variant of gen_l10n_test ( #61912 )
2020-07-21 02:18:29 -07:00
Jonah Williams
70b889a9a3
[flutter_tools] reland: integrate l10n tool into hot reload/restart/build ( #57510 )
...
Reland: #56167
2020-05-18 12:47:18 -07:00
Jonah Williams
d70d0913b2
Revert "[flutter_tools] integrate l10n tool into build/run ( #56167 )" ( #56800 )
...
This reverts commit f865ac7e25
.
2020-05-09 17:50:46 -07:00
Jonah Williams
f865ac7e25
[flutter_tools] integrate l10n tool into build/run ( #56167 )
...
* [flutter_tools] integration l10n tool
* add runtime skip to build system
* Update build_system.dart
* add links to issues, comments
* Update packages/flutter_tools/test/general.shard/build_system/build_system_test.dart
Co-authored-by: Shi-Hao Hong <shihaohong@google.com>
* Update packages/flutter_tools/lib/src/build_system/targets/localizations.dart
Co-authored-by: Shi-Hao Hong <shihaohong@google.com>
* Update localizations.dart
* switch to gen_l10n localizations
* fix tests
Co-authored-by: Shi-Hao Hong <shihaohong@google.com>
2020-05-08 12:06:15 -07:00
Shi-Hao Hong
c16c3b0443
[gen_l10n] Expand integration tests ( #54314 )
2020-04-10 10:25:03 -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
Per Classon
e8d2907595
[gen_l10n] Handle single, double quotes, and dollar signs in strings ( #54185 )
2020-04-07 12:21:02 -07:00
Shi-Hao Hong
4e811d2819
[gen_l10n] Fix plural parsing for translated messages ( #53954 )
2020-04-03 15:46:01 -07:00
Shi-Hao Hong
6837b0e353
[gen_l10n] Add scriptCode handling ( #53868 )
...
* [gen_l10n] Add scriptCode handling
2020-04-03 09:46:01 -07:00
Shi-Hao Hong
19e7db585d
[gen_l10n] Escape special JSON characters in generateString utility function ( #53605 )
2020-04-01 11:16:01 -07:00
Shi-Hao Hong
183da8f837
[gen_l10n] Fix suppportedLocales list ( #52448 )
...
* Fix suppportedLocales list
* Refactor integration tests for gen_l10n tool to catch exceptions
2020-03-12 12:58:13 -07:00
Flutter GitHub Bot
9c5009b251
[gen_l10n] Escape quote characters in ARB files ( #51952 )
2020-03-04 20:41:03 -08:00
Hans Muller
9b3754d56f
Extend the gen_l10n integration test ( #51375 )
2020-02-24 16:42:30 -08:00
Hans Muller
3f2c6ea724
Integration test for the gen_l10n tool ( #49586 )
2020-01-29 12:45:03 -08:00