Repository navigation
Description
Use case
When using Flutter's gen_l10n with a base locale (for example en) and a region-specific locale (for example en_US), the generated Dart classes correctly inherit missing keys from the base locale. However, untranslated-messages-file still lists keys that are absent from the region-specific ARB but present in the base ARB. Those keys are intentionally inherited and not missing translations, so they should not appear in untranslated-messages-file (or there should be a config option to exclude them).
Projects commonly keep region-specific ARB files minimal: they include only keys that need to be overridden for that region; everything else should be inherited from the base locale. Treating inherited keys as "untranslated" produces false positives in untranslated-messages-file, cluttering review workflows and causing unnecessary attention to keys that are intentionally absent.
Reproduction
- Files:
app_en.arb
{
"@@locale": "en",
"hello": "Hello",
"greet": "Greetings"
}app_en_US.arb
{
"@@locale": "en_US",
"greet": "Howdy"
}l10n.yaml
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-class: AppLocalizations
untranslated-messages-file: untranslated_messages.txt- Run flutter
gen-l10n(or the regular build that triggersgen_l10n). - Observed result:
- Generated Dart code:
en_USlocale correctly inherits"hello"from the baseenlocale. untranslated_messages.txtcontains the keyhello(because it is absent inapp_en_US.arb), which suggests it's "untranslated"
Proposal
Two reasonable approaches:
-
Default behavior change: When building
untranslated-messages-file, consider inherited keys as translated for the child locale — exclude keys that exist in an ancestor (base) locale. -
Opt-in configuration: Add a new
l10nsetting, for example
exclude-inherited-keys-from-untranslated: true
# or
untranslated-messages-filter: exclude-inheritedWhen set, gen_l10n would not list keys in untranslated-messages-file that are present in a parent/base ARB file.
Activity
[gen_l10n] Exclude inherited keys from untranslated-messages-file (fl…
[gen_l10n] Exclude inherited keys from untranslated-messages-file (fl…
github-actions commentedon Jul 14, 2026
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 -vand a minimal reproduction of the issue.