Skip to content
Discussion options

You must be logged in to vote

What I ended up doing is taking advantage of the afterBuild block in the quasar.conf.js file:

afterBuild: ({ quasarConf }) => {
  const defaultLang = 'en';
  const langs = ['en', 'fr'];
  const distDir = quasarConf.build.distDir;
  const indexContent = readFileSync(path.join(distDir, 'index.html'), 'utf-8');

  function translate (content, key, lang) {
    const messages = translations[lang];
    let message = key;
    if (messages) {
      message = messages[key] || key;
    }
    // eslint-disable-next-line @typescript-eslint/no-unsafe-return
    return content.replaceAll(key, message);
  }

  for (let i = 0; i < langs.length; i++) {
    const localisedContent = translate(indexContent, '…

Replies: 3 comments 2 replies

Comment options

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

Comment options

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

Comment options

You must be logged in to vote
0 replies
Answer selected by ajmas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants