Skip to content

Migration to Localized messages generated into source break CI pipeline #167982

@Gustl22

Description

@Gustl22

Option 1 breaks dart format . --set-exit-if-changed checks (as commonly used in pipelines), as the generated file does not comply the dart format rules. We should format the the generated files by default.
It's independent from if the files are checked into git or not.
Providing format: true in l10n.yaml wouldn't solve this in all scenarios, as users might have custom project formatting with dart format . -l 120 option, which the generation tool not knows about.

See: #102983 (comment)
See: Dart-Code/Dart-Code#4482 (comment)

Steps to reproduce

Scenario 1

  1. Checkout example: https://github.com/flutter/flutter/tree/master/dev/benchmarks/test_apps/stocks
  2. Remove the format: true option in l10n.yaml, which would be the default after following the migration guide
  3. Run [path/to/]flutter pub get (commonly done in ci pipelines)
  4. [path/to/]dart format . --set-exit-if-changed returns 1 (commonly done in ci pipelines)

Workarounds:

  • Add the format: true option in l10n.yaml (should be added to the migration guide)

Solutions:

Scenario 2

  1. Checkout example: https://github.com/flutter/flutter/tree/master/dev/benchmarks/test_apps/stocks
  2. Keep the format: true option in l10n.yaml
  3. Format your code with dart format . -l 120 (as preferred option in some projects)
  4. Run [path/to/]flutter pub get (commonly done in ci pipelines)
  5. [path/to/]dart format . --set-exit-if-changed -l 120 returns 1 (commonly done in ci pipelines), as some lines might can take advantage of arbitrary format options

Workarounds:

  • Run dart format [path/to/localizations] -l 120 before running dart format . --set-exit-if-changed -l 120

Solutions:

Expected results

Scenario 1: format localization by default
Scenario 2: provide arbitrary format options for localization generation

Actual results

Scenario 1: The format option is not enabled by default
Scenario 2: No additional / arbitrary format options for localization generation exist

Code sample

Code sample

See: https://github.com/flutter/flutter/tree/master/dev/benchmarks/test_apps/stocks

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[!] Flutter (Channel main, 3.32.0-1.0.pre.73, on Microsoft Windows [Version 10.0.22631.5039], locale de-DE) [2,8s]                 
    • Flutter version 3.32.0-1.0.pre.73 on channel main at D:\Tmp\Coding\git\flutter\flutter
    ! Warning: `flutter` on your path resolves to C:\src\flutter\bin\flutter, which is not inside your current Flutter SDK checkout
      at D:\Tmp\Coding\git\flutter\flutter. Consider adding D:\Tmp\Coding\git\flutter\flutter\bin to the front of your path.       
    ! Warning: `dart` on your path resolves to C:\src\flutter\bin\dart, which is not inside your current Flutter SDK checkout at   
      D:\Tmp\Coding\git\flutter\flutter. Consider adding D:\Tmp\Coding\git\flutter\flutter\bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a7f820163c (2 weeks ago), 2025-04-11 18:24:16 -0700
    • Engine revision a7f820163c
    • Dart version 3.8.0 (build 3.8.0-265.0.dev)
    • DevTools version 2.45.0-dev.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform  
      update checks and upgrades.

[√] Windows Version (11 Home 64-bit, 23H2, 2009) [5,8s]

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [8,2s]
    • Android SDK at C:\src\android\Sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = C:\src\android\Sdk
    • Java binary at: C:\Program Files\Java\jdk-17.0.1\bin\java
      This JDK is specified by the JAVA_HOME environment variable.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
    • All Android licenses accepted.

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

[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.5.3) [463ms]
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
    • Visual Studio Build Tools 2022 version 17.5.33516.290
    • Windows 10 SDK version 10.0.22621.0

[!] Android Studio (not installed) [270ms]
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/to/windows-android-setup for detailed instructions).

[√] IntelliJ IDEA Ultimate Edition (version 2025.1) [270ms]
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.1
    • Flutter plugin version 85.2.4
    • Dart plugin version 251.25267.1

[√] VS Code (version 1.96.4) [28ms]
    • VS Code at C:\Users\Gustl\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.102.0

[√] Connected device (3 available) [479ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.5039]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 135.0.7049.85
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 135.0.3179.98

[√] Network resources [519ms]
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Labels

P1High-priority issues at the top of the work lista: annoyanceRepeatedly frustrating issues with non-experimental functionalitya: internationalizationSupporting other languages or locales. (aka i18n)found in release: 3.29Found to occur in 3.29found in release: 3.32Found to occur in 3.32has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions