Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After flutter 3.7 upgrade intl throws error on numeric codes in select statement #464

Closed
under3415 opened this issue Jan 25, 2023 · 3 comments · Fixed by flutter/flutter#119190

Comments

@under3415
Copy link

under3415 commented Jan 25, 2023

Since upgrading to flutter 3.7.0 I am getting this error in app_xx_arb files:

ICU Syntax Error: Expected "}" but found "1".

If I replace "1" with "a1" it is no longer a problem.

This is on intl 0.17.0

"praiseFrases": "{praise, select, 1{Good} 2{Well done} 3{Great} 4{Amazing} 5{Awesome} other{Unknown}}",
    "@praiseFrases":{
        "placeholders": {
            "praise": {}
        }
    },

Flutter doctor

[√] Flutter (Channel stable, 3.7.0, on Microsoft Windows [Version 10.0.19045.2486], locale en-US)
    • Flutter version 3.7.0 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b06b8b2710 (26 hours ago), 2023-01-23 16:55:55 -0800
    • Engine revision b24591ed32
    • Dart version 2.19.0
    • DevTools version 2.20.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at C:\Users\AppData\Local\Android\sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin\java.exe
    • Java version OpenJDK Runtime Environment Microsoft-25199 (build 11.0.12+7)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.4.33213.308
    • Windows 10 SDK version 10.0.22621.0
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK

[!] Android Studio (version 2022.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    X Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[√] VS Code (version 1.74.3)
    • VS Code at C:\Users\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.56.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.2486]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 109.0.5414.75
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 109.0.1518.61

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.
@mosuem
Copy link
Member

mosuem commented Jan 25, 2023

@thkim1011, this might be an issue with the parser? I also noticed that in select statements, the argument cannot start with select, e.g.

"praiseFrases": "{selectPraise, select, 1{Good} 2{Well done} 3{Great} 4{Amazing} 5{Awesome} other{Unknown}}",

Would also give an error.

@sbatezat
Copy link

sbatezat commented Jan 25, 2023

On my side, since flutter update to 3.7, every placeholder are generating this error.

Output sample:

[app_en.arb:sentence] ICU Lexing Error: Unexpected character. Estimated profit: {POSSIBLE_PROFIT}!

EDIT: I found two breaking changes regarding placeholders.

  1. Placeholders cannot contains underscore anymore. All my placeholders was uppercase with "_", that's why everything was broken.
  2. Placeholders cannot starts with the keyword "other". This one was hard to find... Otherwise, I've got the error "Expected "identifier" but found "other"."

Having these issues in mind, I was finally able to upgrade to Flutter 3.7.0 👍

@mosuem
Copy link
Member

mosuem commented Jan 31, 2023

This should be fixed, closing this now.

@mosuem mosuem closed this as completed Jan 31, 2023
@mosuem mosuem transferred this issue from dart-archive/intl Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants