inline-i18n-multi-next 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
> **Important:** For complete documentation, examples, and best practices, please read the [full documentation on GitHub](https://github.com/exiivy98/inline-i18n-multi).
|
|
2
|
+
|
|
3
|
+
# inline-i18n-multi-next
|
|
4
|
+
|
|
5
|
+
Next.js App Router integration for inline-i18n-multi. Full SSR/SSG support with SEO utilities.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install inline-i18n-multi-next
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Layout Setup
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
// app/[locale]/layout.tsx
|
|
19
|
+
import { LocaleProvider } from 'inline-i18n-multi-next/client'
|
|
20
|
+
import { configureI18n, generateLocaleParams } from 'inline-i18n-multi-next/server'
|
|
21
|
+
|
|
22
|
+
configureI18n({
|
|
23
|
+
locales: ['en', 'ko', 'ja'],
|
|
24
|
+
defaultLocale: 'en',
|
|
25
|
+
baseUrl: 'https://example.com',
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export function generateStaticParams() {
|
|
29
|
+
return generateLocaleParams()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default async function Layout({ children, params }) {
|
|
33
|
+
const { locale } = await params
|
|
34
|
+
return (
|
|
35
|
+
<html lang={locale}>
|
|
36
|
+
<body>
|
|
37
|
+
<LocaleProvider locale={locale}>{children}</LocaleProvider>
|
|
38
|
+
</body>
|
|
39
|
+
</html>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Server Components
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
// app/[locale]/page.tsx
|
|
48
|
+
import { it } from 'inline-i18n-multi-next/server'
|
|
49
|
+
|
|
50
|
+
export default async function Page() {
|
|
51
|
+
return <h1>{await it('안녕하세요', 'Hello')}</h1>
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Server Components with Key-Based Translation
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { t, setLocale, loadDictionaries } from 'inline-i18n-multi'
|
|
59
|
+
|
|
60
|
+
loadDictionaries({
|
|
61
|
+
en: { greeting: 'Hello' },
|
|
62
|
+
ko: { greeting: '안녕하세요' },
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
export default async function Page({ params }) {
|
|
66
|
+
const { locale } = await params
|
|
67
|
+
setLocale(locale) // Required before using t()
|
|
68
|
+
|
|
69
|
+
return <h1>{t('greeting')}</h1>
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Client Components
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
'use client'
|
|
77
|
+
import { it, T, useT } from 'inline-i18n-multi-next/client'
|
|
78
|
+
|
|
79
|
+
export function ClientComponent() {
|
|
80
|
+
const t = useT()
|
|
81
|
+
return (
|
|
82
|
+
<div>
|
|
83
|
+
<p>{it('클라이언트', 'Client')}</p>
|
|
84
|
+
<T ko="환영" en="Welcome" />
|
|
85
|
+
<p>{t('nav.home')}</p>
|
|
86
|
+
</div>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## SEO Utilities
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { createMetadata, getAlternates } from 'inline-i18n-multi-next/server'
|
|
95
|
+
|
|
96
|
+
export async function generateMetadata({ params }) {
|
|
97
|
+
const { locale } = await params
|
|
98
|
+
return createMetadata(
|
|
99
|
+
{
|
|
100
|
+
title: { en: 'My Site', ko: '내 사이트' },
|
|
101
|
+
description: { en: 'Welcome', ko: '환영합니다' },
|
|
102
|
+
},
|
|
103
|
+
locale,
|
|
104
|
+
'/about'
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Documentation
|
|
110
|
+
|
|
111
|
+
**Please read the [full documentation on GitHub](https://github.com/exiivy98/inline-i18n-multi)** for complete API reference, SEO best practices, and advanced patterns.
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inline-i18n-multi-next",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Next.js integration for inline-i18n-multi",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"react": "^18.0.0 || ^19.0.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"inline-i18n-multi": "0.1.
|
|
55
|
-
"inline-i18n-multi-react": "0.1.
|
|
54
|
+
"inline-i18n-multi": "0.1.2",
|
|
55
|
+
"inline-i18n-multi-react": "0.1.2"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/react": "^19.0.2",
|