Skip to content

[gen-l10n] Escaping curly braces without use-escaping #122404

@Albert221

Description

@Albert221

Hello! We have a very big Flutter project and we use a translation management service for all our terms and languages. After upgrading from Flutter 3.3 to 3.7 some of our terms started to fail on parse. Below is the minimum example for that:

➜  arb_curly_brace_escape flutter --version
Flutter 3.7.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 12cb4eb7a0 (9 days ago) • 2023-03-01 10:29:26 -0800
Engine • revision ada363ee93
Tools • Dart 2.19.3 • DevTools 2.20.1

➜  arb_curly_brace_escape cat lib/l10n/app_en.arb
{
    "test": "You shouldn't use those characters: { } in this field"
}

➜  arb_curly_brace_escape flutter gen-l10n
Because l10n.yaml exists, the options defined there will be used instead.
To use the command line arguments, delete the l10n.yaml file in the Flutter project.


[app_en.arb:test] ICU Syntax Error: Expected "identifier" but found "}".
    You shouldn't use those characters: { } in this field
                                          ^
Found syntax errors.

Right now we cannot use curly braces in our terms literally, without being parsed as placeholders.

There is the use-escaping param in l10n.yaml, but this requires changing almost every term where a ' character is used and educating (which won't always work so there's additional QA needed) our translators to escape single quotes.

For us, that is a major regression.


IMO, if a term uses the {placeholder} syntax, but has no placeholder in its @termName.placeholders defined, it shouldn't be treated and parsed (and thus fail to do so) as a placeholder. But that's just one of the solutions.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: internationalizationSupporting other languages or locales. (aka i18n)frameworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-frameworkTriaged by Framework team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions