├── .npmrc ├── .husky ├── pre-commit └── pre-push ├── playground ├── .npmrc ├── tsconfig.json ├── app │ ├── assets │ │ └── css │ │ │ └── main.css │ ├── schema │ │ ├── index.ts │ │ ├── login.schema.ts │ │ ├── website.schema.ts │ │ └── user.schema.ts │ ├── app.vue │ ├── components │ │ ├── VNavigation.vue │ │ └── VLocalSwitcher.vue │ └── pages │ │ ├── overload.vue │ │ ├── index.vue │ │ └── complex.vue ├── server │ └── tsconfig.json ├── package.json ├── nuxt.config.ts └── i18n │ └── locales │ ├── en-GB.json │ └── fr-FR.json ├── docs ├── content │ ├── 2.usage │ │ ├── .navigation.yml │ │ ├── 1.how-to-use.md │ │ ├── 3.error-interpolation.md │ │ └── 2.overload-translation.md │ ├── 1.getting-started │ │ ├── .navigation.yml │ │ ├── 2.installation.md │ │ ├── 1.index.md │ │ └── 3.configuration.md │ ├── 3.add-improve-translation.md │ └── index.md ├── public │ ├── favicon.ico │ ├── favicon.png │ └── img │ │ ├── og-nuxt-zod-i18n.jpeg │ │ └── nuxt-i18n.svg ├── tsconfig.json ├── eslint.config.mjs ├── .env.example ├── .gitignore ├── app │ ├── layouts │ │ └── docs.vue │ ├── pages │ │ ├── playground.vue │ │ ├── index.vue │ │ └── [...slug].vue │ ├── assets │ │ └── css │ │ │ └── main.css │ ├── components │ │ ├── AppFooter.vue │ │ ├── TopMenu.vue │ │ ├── AppHeader.vue │ │ └── OgImage │ │ │ └── OgImageDocs.vue │ ├── error.vue │ ├── app.vue │ └── app.config.ts ├── content.config.ts ├── README.md ├── package.json ├── nuxt.config.ts └── nuxt.schema.ts ├── test ├── fixtures │ └── basic │ │ ├── package.json │ │ ├── app.vue │ │ ├── i18n │ │ └── locales │ │ │ ├── en-GB.json │ │ │ └── fr-FR.json │ │ └── nuxt.config.ts └── basic.test.ts ├── tsconfig.json ├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── translation.yml │ ├── question.yml │ ├── feature-request.yml │ └── bug-report.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── studio.yml ├── pnpm-workspace.yaml ├── .editorconfig ├── .vscode └── settings.json ├── localazy.json ├── src ├── utils.ts ├── runtime │ ├── utils │ │ └── index.ts │ ├── i18n │ │ └── locales │ │ │ ├── zh-TW.json │ │ │ ├── zh-CN.json │ │ │ ├── fa-IR.json │ │ │ ├── en-GB.json │ │ │ ├── uk-UA.json │ │ │ ├── id-ID.json │ │ │ ├── cs-CZ.json │ │ │ ├── tr-TR.json │ │ │ ├── nl-NL.json │ │ │ ├── de-DE.json │ │ │ ├── pt-BR.json │ │ │ ├── es-ES.json │ │ │ ├── ru-RU.json │ │ │ ├── pt-PT.json │ │ │ ├── fr-FR.json │ │ │ ├── it-IT.json │ │ │ ├── sk-SK.json │ │ │ └── hu-HU.json │ └── plugin.ts └── module.ts ├── .gitignore ├── eslint.config.mjs ├── README.md ├── package.json └── CHANGELOG.md /.npmrc: -------------------------------------------------------------------------------- 1 | shamefully-hoist=true -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | npx lint-staged 2 | -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | npx vitest run 2 | -------------------------------------------------------------------------------- /playground/.npmrc: -------------------------------------------------------------------------------- 1 | shamefully-hoist=true -------------------------------------------------------------------------------- /docs/content/2.usage/.navigation.yml: -------------------------------------------------------------------------------- 1 | title: Usage 2 | icon: false 3 | -------------------------------------------------------------------------------- /playground/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./.nuxt/tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /playground/app/assets/css/main.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | @import "@nuxt/ui"; 3 | -------------------------------------------------------------------------------- /docs/content/1.getting-started/.navigation.yml: -------------------------------------------------------------------------------- 1 | title: Getting Started 2 | icon: false 3 | -------------------------------------------------------------------------------- /playground/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../.nuxt/tsconfig.server.json" 3 | } 4 | -------------------------------------------------------------------------------- /docs/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xibman/nuxt-zod-i18n/HEAD/docs/public/favicon.ico -------------------------------------------------------------------------------- /docs/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xibman/nuxt-zod-i18n/HEAD/docs/public/favicon.png -------------------------------------------------------------------------------- /test/fixtures/basic/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "basic", 3 | "private": true, 4 | "type": "module" 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/basic/app.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // https://nuxt.com/docs/guide/concepts/typescript 3 | "extends": "./.nuxt/tsconfig.json" 4 | } 5 | -------------------------------------------------------------------------------- /docs/public/img/og-nuxt-zod-i18n.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xibman/nuxt-zod-i18n/HEAD/docs/public/img/og-nuxt-zod-i18n.jpeg -------------------------------------------------------------------------------- /playground/app/schema/index.ts: -------------------------------------------------------------------------------- 1 | export * from './user.schema' 2 | export * from './login.schema' 3 | export * from './website.schema' 4 | -------------------------------------------------------------------------------- /docs/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | import withNuxt from './.nuxt/eslint.config.mjs' 3 | 4 | export default withNuxt( 5 | // Your custom configs here 6 | ) 7 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": [ 3 | "dist", 4 | "node_modules", 5 | "playground", 6 | "docs" 7 | ], 8 | "extends": "./.nuxt/tsconfig.json" 9 | } 10 | -------------------------------------------------------------------------------- /docs/.env.example: -------------------------------------------------------------------------------- 1 | # Production license for @nuxt/ui-pro, get one at https://ui.nuxt.com/pro/purchase 2 | NUXT_UI_PRO_LICENSE= 3 | 4 | # Public URL, used for OG Image when running nuxt generate 5 | NUXT_PUBLIC_SITE_URL= 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: 📖 Documentation 4 | url: https://xibman-nuxt-zod-i18n.nuxt.space 5 | about: Check the documentation for guides and examples. 6 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - docs 3 | - playground 4 | - ./ 5 | 6 | onlyBuiltDependencies: 7 | - '@parcel/watcher' 8 | - '@tailwindcss/oxide' 9 | - esbuild 10 | - sharp 11 | - unrs-resolver 12 | - vue-demi 13 | -------------------------------------------------------------------------------- /playground/app/schema/login.schema.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod' 2 | 3 | export const loginSchema = z.object({ 4 | name: z.string().min(5).max(15), 5 | email: z.string().email().min(1), 6 | }) 7 | 8 | export type LoginDto = z.input 9 | -------------------------------------------------------------------------------- /test/fixtures/basic/i18n/locales/en-GB.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors": { 3 | "green": "green", 4 | "red": "red" 5 | }, 6 | "myCustomError": "Custom error", 7 | "myCustomErrorWithInterpolation": "My preferred colors are {first} and {second}" 8 | } 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_size = 2 5 | indent_style = space 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /playground/app/schema/website.schema.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod' 2 | 3 | export const websiteSchema = z.object({ 4 | name: z.string().min(5).max(15), 5 | url: z.string().url().min(1), 6 | }) 7 | 8 | export type WebsiteDto = z.input 9 | -------------------------------------------------------------------------------- /test/fixtures/basic/i18n/locales/fr-FR.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors": { 3 | "green": "vert", 4 | "red": "rouge" 5 | }, 6 | "myCustomError": "Erreur custom", 7 | "myCustomErrorWithInterpolation": "Mes couleurs préférées sont {first} et {second}" 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.codeActionsOnSave": { 3 | "source.fixAll.eslint": "explicit" 4 | }, 5 | "editor.formatOnSave": false, 6 | "i18n-ally.localesPaths": [ 7 | "playground/i18n/locales", 8 | "src/runtime/locales" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | # Nuxt dev/build outputs 2 | .output 3 | .data 4 | .nuxt 5 | .nitro 6 | .cache 7 | dist 8 | 9 | # Node dependencies 10 | node_modules 11 | 12 | # Logs 13 | logs 14 | *.log 15 | 16 | # Misc 17 | .DS_Store 18 | .fleet 19 | .idea 20 | 21 | # Local env files 22 | .env 23 | .env.* 24 | !.env.example 25 | 26 | # VSC 27 | .history 28 | -------------------------------------------------------------------------------- /localazy.json: -------------------------------------------------------------------------------- 1 | { 2 | "download": { 3 | "files": "src/runtime/locales/${lang}.json", 4 | "includeSourceLang": true 5 | }, 6 | "upload": { 7 | "deprecate": "project", 8 | "files": { 9 | "lang": "${autodetectLang}", 10 | "pattern": "src/runtime/locales/en-GB.json" 11 | }, 12 | "type": "json" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /docs/content/3.add-improve-translation.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Add / Improve translation' 3 | description: 'Add / Improve Nuxt zodI18n translations' 4 | --- 5 | 6 | You can help to translate this module. 7 | 8 | You can use this [English translation](https://github.com/xibman/nuxt-zod-i18n/blob/main/src/runtime/locales/en-GB.json) file as a basis for rewriting it in your language. 9 | 10 | You can also directly update or add translation with Localazy: https://localazy.com/p/zod-i18n 11 | -------------------------------------------------------------------------------- /playground/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "name": "nuxt-zod-i18n-playground", 4 | "private": true, 5 | "scripts": { 6 | "build": "nuxi build", 7 | "dev": "nuxi dev", 8 | "generate": "nuxi generate" 9 | }, 10 | "dependencies": { 11 | "@iconify-json/flag": "^1.2.6", 12 | "@nuxt/ui": "3.3.0", 13 | "tailwindcss": "^4.1.11", 14 | "zod": "^3.25.76" 15 | }, 16 | "devDependencies": { 17 | "@nuxtjs/i18n": "^9.5.6", 18 | "nuxt": "^3.17.7" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/basic.test.ts: -------------------------------------------------------------------------------- 1 | import { fileURLToPath } from 'node:url' 2 | import { describe, it, expect } from 'vitest' 3 | import { setup, $fetch } from '@nuxt/test-utils' 4 | 5 | describe('ssr', async () => { 6 | await setup({ 7 | rootDir: fileURLToPath(new URL('./fixtures/basic', import.meta.url)), 8 | }) 9 | 10 | it('renders the index page', async () => { 11 | // Get response to a server-rendered page with `$fetch`. 12 | const html = await $fetch('/') 13 | expect(html).toContain('
basic
') 14 | }) 15 | }) 16 | -------------------------------------------------------------------------------- /docs/app/layouts/docs.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 23 | -------------------------------------------------------------------------------- /docs/app/pages/playground.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 |