You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[gen_l10n] Flat inheritance model for subclasses leads to incorrect runtime fallbacks for multi-level locales #187948
The gen_l10n tool in Flutter currently generates a flat inheritance model for subclasses (regional and script variants of a language). All subclasses for a given language code extend the base language class directly, rather than forming a hierarchical chain.
This leads to incorrect runtime fallback behavior for multi-level locales (e.g., Language + Script + Region).
Reproduction Steps
Consider the following ARB files in a project:
app_zh.arb (Base Simplified Chinese):
{
"@@locale": "zh",
"dry": "干"
}
app_zh_Hant.arb (Traditional Chinese):
{
"@@locale": "zh_Hant",
"dry": "乾"
}
app_zh_Hant_HK.arb (Hong Kong Traditional Chinese - empty, expecting to inherit everything from zh_Hant):
{
"@@locale": "zh_Hant_HK"
}
Expected Behavior:
At runtime, if the app is run in zh_Hant_HK locale, looking up the dry key should return "乾" (inherited from zh_Hant).
Actual Behavior:
The app returns "干" (inherited from zh).
Technical Details
In packages/flutter_tools/lib/src/localizations/gen_l10n.dart, the generator determines the base class for all subclasses using only the languageCode:
final baseClassName ='$className${LocaleInfo.fromString(locale.languageCode).camelCase()}';
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.
Activity
[gen_l10n] Preserve script locale inheritance for regional subclasses (…
github-actions commentedon Sep 2, 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.