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

extendDictionary is not switching translations properly #618

Closed
Cluster2a opened this issue Mar 1, 2023 · 4 comments
Closed

extendDictionary is not switching translations properly #618

Cluster2a opened this issue Mar 1, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@Cluster2a
Copy link

Cluster2a commented Mar 1, 2023

Version

5.24.1

Describe the bug

If creating en-US as an extension of en, via extendDictionary, the locale switcher is not switching between en and en-US:

simplescreenrecorder-2023-03-01_20.19.03.mp4

Reproduction

Use the svelteKit example app (https://github.com/ivanhofer/typesafe-i18n-demo-sveltekit) and update all dependencies (ncu -u) and add en-US:

image

Logs

No response

Config

No response

Additional information

No response

@Cluster2a Cluster2a added the bug Something isn't working label Mar 1, 2023
@ivanhofer
Copy link
Owner

My bad. I assumed lodash.merge works in an immutable way. But instead it alters the orginal object. I will need to find a replacement for this line: https://github.com/ivanhofer/typesafe-i18n/blob/main/packages/utils/src/extendDictionary.mts#L24

@ivanhofer
Copy link
Owner

It seems merge({}, obj1, obj2) is the solution.

@ivanhofer
Copy link
Owner

ivanhofer commented Mar 2, 2023

Should be fixed in version 5.24.2. Thanks for reporting this issue.

@Cluster2a
Copy link
Author

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants