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

Localizations not getting applied #5

Open
chocolatkey opened this issue Nov 24, 2019 · 3 comments
Open

Localizations not getting applied #5

chocolatkey opened this issue Nov 24, 2019 · 3 comments

Comments

@chocolatkey
Copy link

I believe I have set up things properly according to the online documentation, however the translations are not getting applied to the built javascript files. Is there something I'm doing that's obviously wrong?
Configuration is here: https://github.com/chocolatkey/xbreader/blob/master/webpack.prod.js#L133

Example built file is here: https://unpkg.com/[email protected]/dist/xbreader-fr.js which should have French. But I can see it's still English Object(s.__makeTemplateObject)(["Settings saved!"],["Settings saved!"]))

@chocolatkey
Copy link
Author

Any update regarding this matter?

@arananegra
Copy link

arananegra commented Jun 25, 2020

I'm trying to figure out how to make work this plugin with webpack encore and although everything seems to run/build without even warnings I'm facing the same problem. It outputs multiple js per localization file but it always show the English message id... 😞 Did you figured out something @chocolatkey ?

@AlexMost
Copy link
Member

AlexMost commented Jun 26, 2020

Hi @chocolatkey! this plugin is an experimental one. As an alternative, you can setup the localization process with babel-plugin-ttag. Here is an example of how this can be done - https://ttag.js.org/blog/2018/09/05/hardcore-webpack-setup.html. As for your example seems like tag literals are transformed before babel-plugin-ttag parses the sources. Need to figure out how to fix that. One thing that came to my mind while looking at your webpack config is that you are using ts-loader - https://github.com/chocolatkey/xbreader/blob/master/webpack.prod.js#L38, so all tagged literals are transpiled before babel-plugin-ttag encounters the file.

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

3 participants