Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

intl_translation package, provide a list that contains all the locales name from ARB files that can be used to supported locales for APP. #790

Open
codelovercc opened this issue Feb 3, 2024 · 0 comments
Labels
type-enhancement A request for a change that isn't a bug

Comments

@codelovercc
Copy link

I noticed that in the generated code file messages_all_locales.dart has some code:

Map<String, LibraryLoader> _deferredLibraries = {
  'en': messages_en.loadLibrary,
  'zh': messages_zh.loadLibrary,
};

It's a map that use the exists locale name as the key, I want use these keys as my application supported locales, so I don't need to hardcode or maintain a supported locale list by my hand. _deferredLibraries is a private global field so I can't access it.

Describe the solution you'd like
Provide a list of the existing locale when the codes have been generated, so we can use it as the application supported locale list.

Describe alternatives you've considered
Generate a global field in file messages_all_locales.dart and export it in messages_all.dart:

final List<String> existsLocales = [
    'en',
    'zh',
    'zh-CN',
    ...etc
];
@codelovercc codelovercc added the type-enhancement A request for a change that isn't a bug label Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

1 participant