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

feat: reactive availableLocales using computed property #2058

Merged
merged 2 commits into from
Dec 31, 2024

Conversation

mnenie
Copy link
Contributor

@mnenie mnenie commented Dec 27, 2024

resolves #1893

so, I had the same problem and as a solution I implemented the idea suggested by the man who created the issue using computed in availableLocales at composer.ts
also I wrote some tests and change some things in legacy.ts to accommodate this of course
now its works great :)

@kazupon kazupon added Type: Feature Includes new features 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing labels Dec 27, 2024
})
expect(i18n.availableLocales).toEqual(['en', 'ja', 'fr'].sort())
})
test('reactive update', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is necessary to test with watch / watchEffect to see if the reaction is taking place.

Copy link
Member

@kazupon kazupon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contributing!
I've just reviewed your PR!
Please, let's check it out :)

Copy link

pkg-pr-new bot commented Dec 27, 2024

Open in Stackblitz

@intlify/core

npm i https://pkg.pr.new/@intlify/core@2058

@intlify/devtools-types

npm i https://pkg.pr.new/@intlify/devtools-types@2058

@intlify/core-base

npm i https://pkg.pr.new/@intlify/core-base@2058

petite-vue-i18n

npm i https://pkg.pr.new/petite-vue-i18n@2058

@intlify/shared

npm i https://pkg.pr.new/@intlify/shared@2058

@intlify/message-compiler

npm i https://pkg.pr.new/@intlify/message-compiler@2058

vue-i18n

npm i https://pkg.pr.new/vue-i18n@2058

@intlify/vue-i18n-core

npm i https://pkg.pr.new/@intlify/vue-i18n-core@2058

commit: 6c8fced

@mnenie
Copy link
Contributor Author

mnenie commented Dec 28, 2024

Thank you for your contributing! I've just reviewed your PR! Please, let's check it out :)

hi @kazupon !
so, I made it
I hope that's what you asked for 💯 :)

i made the new test for checking how it work with watchEffect

all tests passed

@mnenie mnenie requested a review from kazupon December 28, 2024 13:27
@BobbieGoede
Copy link
Member

Just checking, this would be a breaking change right?

@mnenie
Copy link
Contributor Author

mnenie commented Dec 28, 2024

Just checking, this would be a breaking change right?

maybe yea
so, now we have a reactive scenario with availableLocales and the type of usage will change to .value in setup

@kazupon
Copy link
Member

kazupon commented Dec 29, 2024

@BobbieGoede

Just checking, this would be a breaking change right?

Thank you for making me realize!
Yeah, This PR has breaking changes.
So, I've made v11 branch.
https://github.com/intlify/vue-i18n/tree/v11

v11 branch will be included bug fixes and backward-compatible features until vue-i18n v12
master branch is v12 develop branch.

@kazupon kazupon merged commit 44169cd into intlify:master Dec 31, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing Type: Feature Includes new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make availableLocales reactive
3 participants