Skip to content

How to use pug-plugin with i18next #43

Answered by webdiscus
microlabig asked this question in Q&A
Discussion options

You must be logged in to vote

@microlabig

Please update pug-plugin to v4.3.3.

To create multi-language pages you can pass into Pug a variable, e.g. lang to set language in template.
To create file structure, define file path as key in entry:

webpack config

entry: {
  // en pages
  'en_US/index': 'src/views/pages/home/index.pug?lang=en',  // => dist/en_US/index.html
  'en_US/about': 'src/views/pages/about/index.pug?lang=en', // => dist/en_US/about.html

  // de pages
  'de_DE/index': 'src/views/pages/home/index.pug?lang=de',  // => dist/de_DE/index.html
  'de_DE/about': 'src/views/pages/about/index.pug?lang=de', // => dist/de_DE/about.html
},

In pug template are available passed data via PugPlugin.loader option data an…

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@microlabig
Comment options

Comment options

You must be logged in to vote
1 reply
@microlabig
Comment options

Answer selected by microlabig
Comment options

You must be logged in to vote
2 replies
@webdiscus
Comment options

@microlabig
Comment options

Comment options

You must be logged in to vote
1 reply
@microlabig
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants