Skip to content

Commit ce7a09d

Browse files
committed
docs: add documentation about i18n meta field
1 parent 8fc86ad commit ce7a09d

File tree

6 files changed

+393
-226
lines changed

6 files changed

+393
-226
lines changed

docs/app/components/examples/Fields.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,18 @@ const schema = z.object({
1111
hint: 'Hint',
1212
help: 'Help',
1313
}),
14-
input: z.number().meta({ input: {
15-
props: {
16-
placeholder: '69420',
14+
input: z.number().meta({
15+
title: 'input.title',
16+
description: 'input.description',
17+
hint: 'input.hint',
18+
help: 'input.help',
19+
i18n: true,
20+
input: {
21+
props: {
22+
placeholder: '69420',
23+
},
1724
},
18-
} }),
25+
}),
1926
style: z.boolean()
2027
.meta({ theme: { floatRight: true } }),
2128
})

docs/content/2.customization/2.fields.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ They map directly to properties inside `UFormField` Nuxt UI component.
4040
::field{name="help" type="string"}
4141
Help text displayed below the input field.
4242
::
43+
44+
::field{name="i18n" type="boolean"}
45+
Intend to use `$t` function of `vue-i18n` to translate `title`, `description`, `hint`, and `help` texts.
46+
::
4347
::
4448

4549
## Input customization

docs/i18n/locales/en-GB.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"input": {
3+
"title": "Input Field",
4+
"description": "A customizable input field component.",
5+
"hint": "Please enter your data.",
6+
"help": "This field accepts alphanumeric characters."
7+
}
8+
}

docs/nuxt.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// https://nuxt.com/docs/api/configuration/nuxt-config
22
export default defineNuxtConfig({
33
modules: [
4+
'@nuxtjs/i18n',
45
'@norbiros/nuxt-auto-form',
56
'@nuxt/eslint',
67
'@nuxt/image',
@@ -85,4 +86,17 @@ export default defineNuxtConfig({
8586
},
8687
],
8788
},
89+
90+
i18n: {
91+
defaultDirection: 'ltr',
92+
defaultLocale: 'en',
93+
locales: [
94+
{
95+
code: 'en',
96+
language: 'en-GB',
97+
name: 'English',
98+
file: 'en-GB.json',
99+
},
100+
],
101+
},
88102
})

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@nuxt/content": "^3.6.3",
1919
"@nuxt/image": "^1.10.0",
2020
"@nuxt/ui-pro": "^3.2.0",
21+
"@nuxtjs/i18n": "^10.1.1",
2122
"better-sqlite3": "^12.2.0",
2223
"nuxt": "^4.0.0",
2324
"nuxt-llms": "0.1.3",

0 commit comments

Comments
 (0)