Skip to content

Commit

Permalink
feat: add i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
medusiora committed Mar 31, 2024
1 parent cd4b8ed commit abc8572
Show file tree
Hide file tree
Showing 6 changed files with 302 additions and 53 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Nuxt 3 frontend template for third-party API integrations.
- [ ] 🍍 [State & Store Management (Pinia)](https://pinia.vuejs.org/)
- [ ] 🍍 [Subscribing to the state](https://pinia.vuejs.org/core-concepts/state.html#Subscribing-to-the-state)
- [x] 🍀 [Vue Composition Collection (Vueuse)](https://vueuse.org/)
- [ ] 🆎 [Internationalization (i18n)](https://v8.i18n.nuxtjs.org/)

## Setup

Expand Down
3 changes: 3 additions & 0 deletions lang/en-US.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"hello": "Hello"
}
3 changes: 3 additions & 0 deletions lang/th-TH.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"hello": "สวัสดี"
}
23 changes: 22 additions & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,28 @@
export default defineNuxtConfig({
devtools: { enabled: true },

modules: ["@nuxtjs/tailwindcss", "@nuxtjs/eslint-module", "@vueuse/nuxt"],
modules: [
"@nuxtjs/tailwindcss",
"@nuxtjs/eslint-module",
"@vueuse/nuxt",
"@nuxtjs/i18n",
],

i18n: {
locales: [
{
code: "en",
file: "en-US.json",
},
{
code: "th",
file: "th-TH.json",
},
],
lazy: true,
langDir: "lang",
defaultLocale: "en",
},

postcss: {
plugins: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"devDependencies": {
"@nuxtjs/eslint-config-typescript": "^12.1.0",
"@nuxtjs/eslint-module": "^4.1.0",
"@nuxtjs/i18n": "^8.2.0",
"@nuxtjs/tailwindcss": "^6.11.4",
"@vueuse/core": "^10.9.0",
"@vueuse/nuxt": "^10.9.0",
Expand Down
Loading

0 comments on commit abc8572

Please sign in to comment.