Skip to content

i18n support #6

Answered by ElMassimo
enricobasso asked this question in Q&A
Oct 14, 2021 · 3 comments · 7 replies
Discussion options

You must be logged in to vote

Hi Enrico!

An @islands/i18n plugin is in the roadmap. In the meantime:

Generate a different site per locale

This is common in documentation sites.

You would run the build once per language, passing the language in an environment variable or a different mean. In src/app.ts:

import { defineApp } from 'iles'
import { createI18n } from '~/logic/i18n'

export default defineApp({
  enhanceApp ({ app }) {
    const i18n = createI18n()
    app.use(i18n)
    i18n.global.locale = import.meta.env.VITE_LOCALE
  },
})

Single-site with all locales

At the moment, it's a very manual process, which is why I plan to create a plugin.

Currently, you would create a copy of each route per language using the pa…

Replies: 3 comments 7 replies

Comment options

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

@bitsnaps
Comment options

Answer selected by ElMassimo
Comment options

You must be logged in to vote
4 replies
@ElMassimo
Comment options

@bitsnaps
Comment options

@ElMassimo
Comment options

@bitsnaps
Comment options

Comment options

You must be logged in to vote
1 reply
@ElMassimo
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
6 participants