Repository navigation
ICU Lexing Error: Unexpected character #119375
Description
Activity
Its seems it is now checking some errors at runtime. Just check this line where it shows you and check if you have everything correct.
And its seems it now has some issue with placeholder with camelCase
for example.
selectedItemsReacted by Syahid M Haidar and Deczaloth@BetterB0y, the problem is the curly brackets. They are part of the syntax to declare variables inside a string in an arb file. I tried a few things to escape the curly brackets to be able to show them in text in my App, but all i tried failed included simple quotes, double quotes, backslash...
I already oppened two related questions in SO, but i am affraid it is a but in the parser...
https://stackoverflow.com/questions/75263861/how-to-fix-icu-lexing-error-unexpected-character-in-flutter
https://stackoverflow.com/questions/75235288/how-to-fix-icu-syntax-error-expected-identifier-but-found-0-error-in-f- addedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Jan 30, 2023 Thanks for the report.
I followed the steps mentioned to add localization in the document and then ranflutter gen-l10nwhich resulted in below:[app_es.arb:helloWorld] ICU Syntax Error: Expected "identifier" but found no tokens. This character { ^ Found syntax errors. dhs@Dhss-MacBook-Pro test_app %Keeping this issue open for team's insights on expected behavior.
stable, master flutter doctor -v
[!] Flutter (Channel stable, 3.7.0, on macOS 12.2.1 21D62 darwin-x64, locale en-GB) • Flutter version 3.7.0 on channel stable at /Users/dhs/documents/fluttersdk/flutter ! Warning: `flutter` on your path resolves to /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter. Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path. ! Warning: `dart` on your path resolves to /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter. Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision b06b8b2710 (28 hours ago), 2023-01-23 16:55:55 -0800 • Engine revision b24591ed32 • Dart version 2.19.0 • DevTools version 2.20.1 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [!] Xcode - develop for iOS and macOS (Xcode 12.3) • Xcode at /Applications/Xcode.app/Contents/Developer ! Flutter recommends a minimum Xcode version of 13. Download the latest version or update via the Mac App Store. • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] VS Code (version 1.62.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.21.0 [✓] Connected device (5 available) • SM G975F (mobile) • RZ8M802WY0X • android-arm64 • Android 11 (API 30) • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios • iOS 14.4.1 18D61 • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator) • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E2269 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80 [✓] HTTP Host Availability • All required HTTP hosts are available ! Doctor found issues in 1 category. [!] Flutter (Channel master, 3.7.0-29.0.pre.26, on macOS 12.2.1 21D62 darwin-x64, locale en-GB) • Flutter version 3.7.0-29.0.pre.26 on channel master at /Users/dhs/documents/fluttersdk/flutter ! Warning: `flutter` on your path resolves to /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter. Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path. ! Warning: `dart` on your path resolves to /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter. Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision 15cd00f1ed (2 hours ago), 2023-01-29 21:58:05 -0500 • Engine revision a7bb0e4108 • Dart version 3.0.0 (build 3.0.0-179.0.dev) • DevTools version 2.20.1 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [!] Xcode - develop for iOS and macOS (Xcode 12.3) • Xcode at /Applications/Xcode.app/Contents/Developer ! Flutter recommends a minimum Xcode version of 13. Download the latest version or update via the Mac App Store. • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] VS Code (version 1.62.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.21.0 [✓] Connected device (5 available) • SM G975F (mobile) • RZ8M802WY0X • android-arm64 • Android 11 (API 30) • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios • iOS 14.4.1 18D61 • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator) • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E2269 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80 [✓] HTTP Host Availability • All required HTTP hosts are available ! Doctor found issues in 1 category.Reacted by Deczaloth- addedframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.a: internationalizationSupporting other languages or locales. (aka i18n)Supporting other languages or locales. (aka i18n)has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onfound in release: 3.7Found to occur in 3.7Found to occur in 3.7and removedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Jan 30, 2023 /cc @thkim1011
Reacted by DeczalothHelllo! There is an escaping syntax that is implemented but not enabled by default as it is a new feature that wasn't completely backward compatible with existing ICU message strings.
First, add the following to your l10n.yaml file:
use-escaping: trueThen, this will allow you to wrap parts of your strings in single quotes to ignore any syntax within the single quotes; to use a single quote normally as a character and not an escape, use a double single quote. For example,
{ message: "This '{isn''t}' obvious" }becomes
String get message => "This {isn't} obvious";See here for information on the syntax. I'll add this to the documentation later.
See here for the PR in which this was introduced.
By the way the documentation has been updated to include how to escape parts of the syntax. See here: https://docs.flutter.dev/development/accessibility-and-localization/internationalization#escaping-syntax.
Reacted by El and André BlumenthalThis thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Mar 3, 2023
Steps to Reproduce
Expected results:
I was expecting to be able to use the localization string to get that string in my app.
Actual results:
Error is thrown:
Logs