0.0.1-alpha.1 • Published 2 years ago
astrojs-i18n v0.0.1-alpha.1
astrojs-i18n
why I use ?
Usage
- 1.create
astro.i18n.config.mjs
const config = {
defaultLanguage: "en",
supportedLanguages: ['en','zh'],
localesPath:{
loadPath: "./src/locales/*.json",
},
i18n: {
debug: false
},
}
export default config;
- 2.write in astro.config.mjs
import i18n from 'astrojs-i18n'
export default defineConfig({
integrations: [i18n()]
})
- 3.use in astro components
import { t, changeLanguage } from 'i18next'
changeLanguage('en')
t('title')
Inspired by
0.0.1-alpha.1
2 years ago
0.0.1
2 years ago