flutter / flutter/flutter

[flutter_localizations] gen_missing_localizations tool does not work for language-specific ones

Open
#175,836 0 comments 0 reactions 0 assignees View on GitHub
a: internationalization framework P2 team-framework triaged-framework
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

1. Follow guideline in flutter_localizations to [add a new string to localizations](https://github.com/flutter/flutter/tree/master/packages/flutter_localizations#adding-a-new-string-to-localizations)
2. Follow [this](https://github.com/flutter/flutter/blob/master/packages/flutter_localizations/lib/src/l10n/README.md#generated__localizationsdart-all-of-the-localizations) to generate strings for all localizations
3. Now, let's remove those new strings:
3.1. Remove string getter at `packages/flutter/lib/src/material/material_localizations.dart`
3.2. Re-run `gen_missing_localizations` with params `--overwrite --remove-undefined`:

```console
dart dev/tools/localization/bin/gen_missing_localizations.dart --overwrite --remove-undefined
Updating packages/flutter_localizations/lib/src/l10n/material_es.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_et.arb by removing extra entries for {radioButtonSelectedLabel}
...
```

### Expected results

the tool should work for language-specific ones too.

### Actual results

the tool only work for main-languages `material_**.arb`, like: `material_es.arb`/`material_et.arb`, but not work for language-specific ones `material_**_**.arb`, like: `material_en_AU.arb`/`material_en_GB.arb`...as the new string persists there.

### Code sample

Code sample

```dart
[Paste your code here]
```

### Screenshots or Video

Screenshots / Video demonstration

Image

### Logs

Logs

```console
dartpr dev/tools/localization/bin/gen_missing_localizations.dart --overwrite --remove-undefined
Updating packages/flutter_localizations/lib/src/l10n/material_es.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_et.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_eu.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_fa.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_fi.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_fil.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_fr.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ga.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_gl.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_gsw.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_gu.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_he.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_hi.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_hr.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_hu.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_hy.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_id.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_is.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_it.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ja.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ka.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_kk.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_km.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_kn.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ko.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ky.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_lo.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_lt.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_lv.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_mk.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ml.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_mn.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_mr.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ms.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_my.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_nb.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ne.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_nl.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_no.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_or.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_pa.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_pl.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ps.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_pt.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ro.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ru.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_si.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_sk.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_sl.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_sq.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_sr.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_sv.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_sw.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ta.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_te.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_th.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_tl.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_tr.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ug.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_uk.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_ur.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_uz.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_vi.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_zh.arb by removing extra entries for {radioButtonSelectedLabel}
Updating packages/flutter_localizations/lib/src/l10n/material_zu.arb by removing extra entries for {radioButtonSelectedLabel}
```

### Flutter Doctor output

Doctor output

```console
[!] Flutter (Channel [user-branch], 3.37.0-1.0.pre-228, on macOS 15.5 24F74 darwin-arm64, locale en-US) [4.8s]
! Flutter version 3.37.0-1.0.pre-228 on channel [user-branch] at /Users/huym4/Documents/WORKING/SDK/flutter_pr
Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
! Warning: `flutter` on your path resolves to /Users/huym4/Documents/WORKING/SDK/flutter/bin/flutter, which is not inside your current
Flutter SDK checkout at /Users/huym4/Documents/WORKING/SDK/flutter_pr. Consider adding
/Users/huym4/Documents/WORKING/SDK/flutter_pr/bin to the front of your path.
! Warning: `dart` on your path resolves to /Users/huym4/Documents/WORKING/SDK/flutter/bin/dart, which is not inside your current
Flutter SDK checkout at /Users/huym4/Documents/WORKING/SDK/flutter_pr. Consider adding
/Users/huym4/Documents/WORKING/SDK/flutter_pr/bin to the front of your path.
! Upstream repository unknown source is not a standard remote.
Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
• Framework revision 4ab132f0f2 (8 hours ago), 2025-09-23 08:51:26 +0800
• Engine revision c0e7d716c5
• Dart version 3.10.0 (build 3.10.0-227.0.dev)
• DevTools version 2.50.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios,
cli-animations, enable-native-assets, omit-legacy-version-file, enable-lldb-debugging
• 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 36.0.0) [5.7s]
• Android SDK at /Users/huym4/Library/Android/sdk
• Emulator version 35.5.10.0 (build_id 13402964) (CL:N/A)
• Platform android-36, build-tools 36.0.0
• ANDROID_HOME = /Users/huym4/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [4.9s]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16C5032a
• CocoaPods version 1.16.2

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

[✓] Connected device (3 available) [6.0s]
• RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64 • Android 11 (API 30)
• macOS (desktop) • macos • darwin-arm64 • macOS 15.5 24F74 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 140.0.7339.185

[✓] Network resources [335ms]
• All expected network resources are available.

! Doctor found issues in 1 category.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.