Skip to content

[gen_l10n] untranslated-messages-file lists keys that are intentionally inherited from base locale (e.g. en -> en_US) #176020

Closed

Description

@radomir9720

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

  1. 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
  1. Run flutter gen-l10n (or the regular build that triggers gen_l10n).
  2. Observed result:
  • Generated Dart code: en_US locale correctly inherits "hello" from the base en locale.
  • untranslated_messages.txt contains the key hello (because it is absent in app_en_US.arb), which suggests it's "untranslated"

Proposal

Two reasonable approaches:

  1. 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.

  2. Opt-in configuration: Add a new l10n setting, for example

exclude-inherited-keys-from-untranslated: true
# or
untranslated-messages-filter: exclude-inherited

When set, gen_l10n would not list keys in untranslated-messages-file that are present in a parent/base ARB file.

Activity

  1. added
    in triagePresently being triaged by the triage team
    c: proposalA detailed proposal for a change to Flutter
    c: new featureNothing broken; request for a new capability
    a: internationalizationSupporting other languages or locales. (aka i18n)
    frameworkflutter/packages/flutter repository. See also f: labels.
    toolAffects the "flutter" command-line tool. See also t: labels.
    team-toolOwned by Flutter Tool team
    and removed
    in triagePresently being triaged by the triage team
    on Sep 26, 2025
  2. added
    P2Important issues not at the top of the work list
    triaged-toolTriaged by Flutter Tool team
    on Jun 12, 2026
  3. github-actions commented on Jul 14, 2026

    @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.

  4. locked as resolved and limited conversation to collaborators on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: internationalizationSupporting other languages or locales. (aka i18n)c: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions