Skip to content

[gen_l10n] Escape quote characters in ARB files#51952

Merged
fluttergithubbot merged 10 commits into
flutter:masterfrom
shihaohong:l10n-escaping
Mar 5, 2020
Merged

[gen_l10n] Escape quote characters in ARB files#51952
fluttergithubbot merged 10 commits into
flutter:masterfrom
shihaohong:l10n-escaping

Conversation

@shihaohong

Copy link
Copy Markdown
Contributor

Description

When using the l10n tool, the following issue has surfaced:

Arb file:

  "rallyLoginNoAccount": "Het jy nie 'n rekening nie?",

Generated getter:

  @override
  String get rallyLoginNoAccount => 'Het jy nie 'n rekening nie?'; // causes error

This PR introduced proper escaping of quote characters. There was also a small change to the stocks app example to make sure to use en.arb as the template instead of en_US.arb

Related Issues

Fixes #51787

Tests

I added the following tests:

  • Additions to the integration test ensuring that double and single quote characters are properly generated by the tool.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.

@shihaohong shihaohong added c: regression It was better in the past than it is now a: internationalization Supporting other languages or locales. (aka i18n) labels Mar 4, 2020
@shihaohong
shihaohong requested a review from HansMuller March 4, 2020 18:19
@fluttergithubbot fluttergithubbot added c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels. labels Mar 4, 2020
Comment thread dev/tools/localization/gen_l10n.dart

"singleQuote": "Flutter's amazing!",
"@singleQuote": {
"description": "Love Flutter!"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most of the rest of this file, the message descriptions briefly describe what we're checking.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified it to describe the test

@fluttergithubbot
fluttergithubbot merged commit 9c5009b into flutter:master Mar 5, 2020
@shihaohong
shihaohong deleted the l10n-escaping branch April 3, 2020 19:05
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: internationalization Supporting other languages or locales. (aka i18n) c: contributor-productivity Team-specific productivity, code health, technical debt. c: regression It was better in the past than it is now tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[gen_l10n] Does not escape single or double quotes properly.

4 participants