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

feature request - actions to add phrases #104

Open
gotrecillo opened this issue Aug 6, 2018 · 2 comments
Open

feature request - actions to add phrases #104

gotrecillo opened this issue Aug 6, 2018 · 2 comments
Assignees
Labels

Comments

@gotrecillo
Copy link

It can be nice to dynamically add phrases without removing the old ones, for example when using code splitting it can be nice to be able to do it.

Are you open to a pull request with this?

@guillaumearm
Copy link
Collaborator

Hi @gotrecillo

Sure, PRs are welcome 👍


How do you see the implementation ?

a @@polyglot/ADD_PHRASES action ?

const addPhrases = (locale, phrases) => ({
  type: '@@polyglot/ADD_PHRASES',
  payload: { locale, phrases },
});

Wrong locale edge case

In your case, if you want to add phrases, you have to be aware of your current locale in your own code (you can use getLocale selector).

dispatch a ADD_PHRASES with wrong locale won't do anything.


Cache phrases

Regarding #15, we would make a cache of phrases, ADD_PHRASES should be take in consideration too.

Actually, there is no way to make a cache of phrases, so it's not the scope of this issue.


Anyway, thank you for taking the time to make an issue :-)

@gotrecillo
Copy link
Author

I will make it this weekend 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants