Skip to content

[gen-l10n] Localization files are auto-generated when running the project #120023

Closed

Description

@kwado-tech

Steps to Reproduce

  • Create a new flutter project
  • Setup localization using flutter_localizations package from sdk
flutter_localizations:
    sdk: flutter
  • Setup l10n.yaml configuration
  • Generate app-localization by running flutter gen-l10n in terminal or running the project
  • Try disabling auto generation by setting generate: false and not specifying it in pubspec.yaml

Expected results: Localization files should not be auto-generated on running a flutter project

Actual results: Localization files are auto-generated even after setting generate: false in pubspec.yaml.

Code sample
dependencies:
 ...
  flutter:
    sdk: flutter

  flutter_localizations:
    sdk: flutter

...

flutter:
  generate: false
  uses-material-design: true
Logs
 Flutter (Channel stable, 3.7.1, on macOS 13.1 22C65 darwin-arm64, locale en-EE)
    • Flutter version 3.7.1 on channel stable at /Users/christian.onwe/source/flutter
    ! Warning: `dart` on your path resolves to
      /opt/homebrew/Cellar/dart/2.19.0/libexec/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/christian.onwe/source/flutter. Consider
      adding /Users/christian.onwe/source/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7048ed95a5 (3 days ago), 2023-02-01 09:07:31 -0800
    • Engine revision 800594f1f4
    • Dart version 2.19.1
    • 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.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/christian.onwe/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.75.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.58.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.1 22C65 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 109.0.5414.119

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

! Doctor found issues in 1 category.

Activity

  1. changed the title [-]Unable to disable auto-generation[/-] [+][BUG]Unable to disable auto-generation[/+] on Feb 5, 2023
  2. andbitty commented on Feb 5, 2023

    @andbitty

    Hi,

    does the trick

    flutter_intl: 
      enabled: false
    
  3. kwado-tech commented on Feb 5, 2023

    @kwado-tech
    Author

    Hey @superciccio thanks for your suggestion but I'm currently not using flutter_intl package. Can you provide me with a context on where this is applicable.

  4. andbitty commented on Feb 5, 2023

    @andbitty

    Hi,

    see this pubspec

    name: example
    description: A new Flutter project.
    # The following line prevents the package from being accidentally published to
    # pub.dev using `flutter pub publish`. This is preferred for private packages.
    publish_to: 'none' # Remove this line if you wish to publish to pub.dev
    
    
    version: 1.0.0+1
    
    environment:
      sdk: '>=2.19.1 <3.0.0'
    
    
    dependencies:
      flutter:
        sdk: flutter
      flutter_localizations:
        sdk: flutter
      intl: ^0.17.0
    
      cupertino_icons: ^1.0.2
    
    dev_dependencies:
      flutter_test:
        sdk: flutter
    
      flutter_lints: ^2.0.0
    
    flutter:
      uses-material-design: true
    
    flutter_intl: 
      enabled: false
    
    
  5. kwado-tech commented on Feb 5, 2023

    @kwado-tech
    Author

    Hey, unfortunately, I couldnt get this working by specifying

    flutter_intl: 
      enabled: false

    What version of flutter was this tested on? @superciccio

  6. added
    in triagePresently being triaged by the triage team
    on Feb 6, 2023
  7. huycozy commented on Feb 6, 2023

    @huycozy
    Member

    @kwado-tech I do some tests on Flutter stable 3.7.1, master 3.8.0-4.0.pre.25, 3.3.10 and see there is the change:

    ❌ Flutter stable 3.7.1, master 3.8.0-4.0.pre.25

    • Strings are auto-generated when running the project no matter generate flag is true or false.

    ✅ 3.3.10

    • Strings are not auto-generated when running the project whether generate flag is true or false. It's only generated when executing gen-l10n.

    ✅: No Issue ❌: Issue reproduced

    Labeling this as a regression issue for further investigation. Thanks for your report.

    flutter doctor -v (stable and master)
    [✓] Flutter (Channel stable, 3.7.1, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
        • Flutter version 3.7.1 on channel stable at /Users/huynq/Documents/GitHub/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 7048ed95a5 (11 hours ago), 2023-02-01 09:07:31 -0800
        • Engine revision 800594f1f4
        • Dart version 2.19.1
        • DevTools version 2.20.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/huynq/Library/Android/sdk
        • Platform android-33, build-tools 31.0.0
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Applications/Android Studio Dolphin 2021.3.1.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 14B47b
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2021.3)
        • Android Studio at /Applications/Android Studio Dolphin 2021.3.1.app/Contents
        • 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
        • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    
    [!] Android Studio (version 2022.1)
        • Android Studio at /Applications/Android Studio.app/Contents
        • 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
        ✗ Unable to find bundled Java version.
        • Try updating or re-installing Android Studio.
    
    [✓] IntelliJ IDEA Community Edition (version 2022.1.1)
        • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
        • 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
    
    [✓] VS Code (version 1.74.3)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.58.0
    
    [✓] Connected device (4 available)
        • RMX2001 (mobile) • EUYTFEUSQSRGDA6D                         • android-arm64  • Android 11 (API 30)
        • iPhone (mobile)  • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios            • iOS 15.7.2 19H218
        • macOS (desktop)  • macos                                    • darwin-x64     • macOS 13.0.1 22A400 darwin-x64
        • Chrome (web)     • chrome                                   • web-javascript • Google Chrome 109.0.5414.119
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    [!] Flutter (Channel master, 3.8.0-4.0.pre.25, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
        • Flutter version 3.8.0-4.0.pre.25 on channel master at /Users/huynq/Documents/GitHub/flutter_master
        ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision b8f5394a5c (19 hours ago), 2023-02-04 23:06:19 -0800
        • Engine revision 2a104cdfcd
        • Dart version 3.0.0 (build 3.0.0-204.0.dev)
        • DevTools version 2.21.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.
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/huynq/Library/Android/sdk
        • Platform android-33, build-tools 31.0.0
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Users/huynq/Library/Java/JavaVirtualMachines/corretto-1.8.0_302/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment Corretto-8.302.08.1 (build 1.8.0_302-b08)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 14B47b
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [!] Android Studio (version 2022.1)
        • Android Studio at /Applications/Android Studio.app/Contents
        • 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
        ✗ Unable to find bundled Java version.
        • Try updating or re-installing Android Studio.
    
    [✓] IntelliJ IDEA Community Edition (version 2022.1.1)
        • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
        • 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
    
    [✓] VS Code (version 1.75.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.58.0
    
    [✓] Connected device (3 available)
        • SM T225 (mobile) • R9JT3004VRJ • android-arm64  • Android 13 (API 33)
        • macOS (desktop)  • macos       • darwin-x64     • macOS 13.0.1 22A400 darwin-x64
        • Chrome (web)     • chrome      • web-javascript • Google Chrome 109.0.5414.119
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 2 categories.
  8. added
    c: regressionIt was better in the past than it is now
    toolAffects the "flutter" command-line tool. See also t: labels.
    a: internationalizationSupporting other languages or locales. (aka i18n)
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    and removed
    in triagePresently being triaged by the triage team
    on Feb 6, 2023
  9. changed the title [-][BUG]Unable to disable auto-generation[/-] [+][gen-l10n] Localization files are auto-generated when running the project[/+] on Feb 6, 2023
  10. huycozy commented on Feb 6, 2023

    @huycozy
    Member

    @kwado-tech I updated the issue title even though it's not mentioned the way to disable auto-generation. Please let me know if it's applicable to you.

  11. kwado-tech commented on Feb 6, 2023

    @kwado-tech
    Author

    @huycozy thanks for the feedback. Yes the title is okay and applicable to my situation.

  12. christopherfujino commented on Feb 7, 2023

    @christopherfujino
    Contributor

    @thkim1011 do you by any chance know if this is working as intended or a bug?

  13. thkim1011 commented on Feb 7, 2023

    @thkim1011
    Contributor

    generate: false only affects whether synthetic packages are allowed or not, not whether localization files are generated on flutter run. That said, expected behavior is for generate: false to throw an error if set up as a synthetic package, so I'll take a look at this.

  14. self-assigned this
    on Feb 7, 2023
  15. added
    P1High-priority issues at the top of the work list
    on Feb 14, 2023
  16. christopherfujino commented on Feb 14, 2023

    @christopherfujino
    Contributor

    @thkim1011 marking this p3 as you're working on it, feel free to re-prioritize as appropriate

  17. added
    P2Important issues not at the top of the work list
    and removed
    P1High-priority issues at the top of the work list
    on Feb 14, 2023
  18. github-actions commented on May 10, 2023

    @github-actions

    This 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 -v and a minimal reproduction of the issue.

  19. locked as resolved and limited conversation to collaborators on May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: internationalizationSupporting other languages or locales. (aka i18n)c: regressionIt was better in the past than it is nowfound in release: 3.7Found to occur in 3.7found in release: 3.8Found to occur in 3.8has reproducible stepsThe issue has been confirmed reproducible and is ready to work ontoolAffects 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