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

Japanese text was overwritten by default text in code at pushing bundle #449

Closed
syunyama opened this issue Mar 16, 2022 · 3 comments
Closed

Comments

@syunyama
Copy link

Is your feature request related to a problem? Please describe.
When I use Japanese text as default in package.json and try to push with command npm run push , whole ja-JP.json text was overwritten by default text in code.

Describe the solution you'd like
Removing formatjs extract when pushing. or merge existing json and text in code.

@bendvc
Copy link
Collaborator

bendvc commented Mar 16, 2022

Hi Shumpei Yamada

Thank you for pointing this out. This is a problem that is already on our radar and we have a PR that will be merged shortly that will stop this kind of error from happening.

The change is essentially locking down the locale used in the compile and extract scripts in the package.json file like below:

"compile-translations:pseudo": "formatjs compile --ast app/translations/en-US.json --out-file app/translations/compiled/en-XB.json --pseudo-locale en-XB",
"extract-default-translations": "formatjs extract 'app/**/*.{js,jsx}' --out-file app/translations/en-US.json --id-interpolation-pattern [sha512:contenthash:base64:6]",

The reason why this makes sense is because the default locale in this sense is the locale in which the code's "default messages" are written in. In the future we are going to look into being able to generate projects with defaultMessages in the users selected locale.

If you have any more questions please let me know.

Ben

@syunyama
Copy link
Author

@bendvc
Thank you.
Please attach PR to this thread and close after merge.

@bendvc
Copy link
Collaborator

bendvc commented Mar 17, 2022

@syunyama

This is a long PR that is implementing multi-site support for the retail react app. I've linked the file directly were we are fixing the scripts that previously result in having a translation file with the wrong language in it (if you are to change you default locale).

We are currently working on releasing this code. So keep an eye out.

@bendvc bendvc closed this as completed Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants