Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[question] Integration with webpack #207

Open
marcinn opened this issue Sep 10, 2020 · 1 comment
Open

[question] Integration with webpack #207

marcinn opened this issue Sep 10, 2020 · 1 comment
Labels

Comments

@marcinn
Copy link

marcinn commented Sep 10, 2020

Hi.

Ttag seems to be best i18n solution. Usage is simple and readable, gettext behind the scenes, but I have trouble integrating ttag with webpack.

I'm using html-webpack-plugin and ttag-webpack-plugin. I'd like to automatically inject precompiled javascripts (bundles / chunks) in language related entrypoints (index-[lang].html). So as a result I'd like to generate index files for each language, with chunks included automatically, to wrap them with nginx in production environment. For a devserver (webpack's watch mode) I would like to have possibility to serve selected language or enable runtime translations. I asked about this on https://stackoverflow.com/questions/63827008/how-to-use-ttag-i18n-with-webpack, where I posted my webpack.config.js.

Would you mind to suggest me (and maybe others) how to configure webpack to work with html-webpack-plugin? If babel-plugin-ttag should be used, could you suggest how to integrate it with html-webpack-plugin?

I'm not using CRA, I have own npm/webpack/babel config.

@AlexMost
Copy link
Member

Hi @marcinn! Thanks for the good words.
ttag-webpack-plugin is still experimental. Haven't tried it with html-webpack-plugin. Need to check that. I can suggest you to use babel-plugin-ttag without ttag-webpack-plugin. Here is a doc tat describes both approaches (precompile and runtime translations) - https://ttag.js.org/blog/2018/09/05/hardcore-webpack-setup.html

@AlexMost AlexMost added the doc label Nov 9, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants