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

Can we change _allValues? #27

Closed
chang-ran opened this issue Sep 18, 2020 · 5 comments · Fixed by #30
Closed

Can we change _allValues? #27

chang-ran opened this issue Sep 18, 2020 · 5 comments · Fixed by #30
Labels
enhancement New feature or request low priority

Comments

@chang-ran
Copy link

change: static Map<String, Map<String, String>> _allValues ---> static final Map<String, Map<String, String>> allValues
so that we can get strings in any locale from allValues.

@defuncart
Copy link
Collaborator

@chang-ran This is planned for version 2.0. In the meantime, there is a proof of concept on this branch.

The following option

flappy_translator:
  exposeLocalizedValues: true

will generate

static Map<String, String> get localizedValues => _localizedValues;

You can add git dependencies to pubspec as follows:

flappy_translator:
   git:
        url: https://github.com/defuncart/flappy_translator
        ref: feature/localized-values-option

@defuncart defuncart added the enhancement New feature or request label Sep 18, 2020
@chang-ran
Copy link
Author

I mean exposing the whole map, which inlcludes all locales , not a certain map

@chang-ran
Copy link
Author

For example, I want to get strings in Chinese when I am using English as default language.

@defuncart
Copy link
Collaborator

@chang-ran Sorry, now I understand the feature request :) This sounds like a good idea, if I get some time over the weekend, I'll try and whip up a solution.

@chang-ran
Copy link
Author

ok thx

defuncart added a commit that referenced this issue Sep 20, 2020
Adds the options for expose_loca_strings and expose_locale_maps. Resolves #27.

Commits:
* Add templateLocalizedValues.
* Add exposeLocalizedValues.
* Update example.
* Update README.
* Rename exposeLocalizedValues to exposeLocaStrings.
* Add exposeLocaleMaps.
* Update exposeLocaStrings, exposeLocaleMaps to depend on context.
* Tidy up templateGetString.
* Update README.md
* Update example.
* Ensure locaStrings and localeMaps are copies of original data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants