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

Make availableLocales reactive #1893

Open
3 tasks done
markusand opened this issue Jul 16, 2024 · 2 comments
Open
3 tasks done

Make availableLocales reactive #1893

markusand opened this issue Jul 16, 2024 · 2 comments
Labels
good first issue Good for newcomers Status: PR Welcome Welcome to Pull Request Status: Proposal Request for comments Type: Feature Includes new features

Comments

@markusand
Copy link

markusand commented Jul 16, 2024

Clear and concise description of the problem

Using availableLocales in a component is a list of strings that doesn't update reactively when adding new messages.

const { availableLocales } = useI18n();  // string[]

i18n.global.setLocaleMessage('ca', messages); // Does not trigger an update to availableLocales 

Suggested solution

Would be useful if availableLocales was a computed list so any list or selector or whatever that is using it can update automatically

const { availableLocales } = useI18n(); // ComputedRef<string[]>

Not sure if changing line

return Object.keys(_messages.value).sort()
to something like the following would do the trick.

return computed(() => Object.keys(_messages.value).sort());

Alternative

No response

Additional context

No response

Validations

@markusand markusand added the Status: Proposal Request for comments label Jul 16, 2024
@kazupon kazupon added Type: Feature Includes new features good first issue Good for newcomers Status: PR Welcome Welcome to Pull Request labels Jul 16, 2024
@kazupon
Copy link
Member

kazupon commented Jul 16, 2024

Thank you for your feedback!
You can contribute it!
We are waiting for your PR :)

@markusand
Copy link
Author

Thanks for your answer. I'd love to be a contributor, but I'm afraid I don't know the code so deep to be confident. Moreover, the proposed change would be a breaking change and I'm sure there are plenty of procedures for how you want to handle this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Status: PR Welcome Welcome to Pull Request Status: Proposal Request for comments Type: Feature Includes new features
Projects
None yet
Development

No branches or pull requests

2 participants