inline-i18n-multi-next 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +113 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # inline-i18n-multi-next
2
+
3
+ Next.js App Router integration for inline-i18n-multi. Full SSR/SSG support with SEO utilities.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install inline-i18n-multi-next
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### Layout Setup
14
+
15
+ ```tsx
16
+ // app/[locale]/layout.tsx
17
+ import { LocaleProvider } from 'inline-i18n-multi-next/client'
18
+ import { configureI18n, generateLocaleParams } from 'inline-i18n-multi-next/server'
19
+
20
+ configureI18n({
21
+ locales: ['en', 'ko', 'ja'],
22
+ defaultLocale: 'en',
23
+ baseUrl: 'https://example.com',
24
+ })
25
+
26
+ export function generateStaticParams() {
27
+ return generateLocaleParams()
28
+ }
29
+
30
+ export default async function Layout({ children, params }) {
31
+ const { locale } = await params
32
+ return (
33
+ <html lang={locale}>
34
+ <body>
35
+ <LocaleProvider locale={locale}>{children}</LocaleProvider>
36
+ </body>
37
+ </html>
38
+ )
39
+ }
40
+ ```
41
+
42
+ ### Server Components
43
+
44
+ ```tsx
45
+ // app/[locale]/page.tsx
46
+ import { it } from 'inline-i18n-multi-next/server'
47
+
48
+ export default async function Page() {
49
+ return <h1>{await it('안녕하세요', 'Hello')}</h1>
50
+ }
51
+ ```
52
+
53
+ ### Server Components with Key-Based Translation
54
+
55
+ ```tsx
56
+ import { t, setLocale, loadDictionaries } from 'inline-i18n-multi'
57
+
58
+ loadDictionaries({
59
+ en: { greeting: 'Hello' },
60
+ ko: { greeting: '안녕하세요' },
61
+ })
62
+
63
+ export default async function Page({ params }) {
64
+ const { locale } = await params
65
+ setLocale(locale) // Required before using t()
66
+
67
+ return <h1>{t('greeting')}</h1>
68
+ }
69
+ ```
70
+
71
+ ### Client Components
72
+
73
+ ```tsx
74
+ 'use client'
75
+ import { it, T, useT } from 'inline-i18n-multi-next/client'
76
+
77
+ export function ClientComponent() {
78
+ const t = useT()
79
+ return (
80
+ <div>
81
+ <p>{it('클라이언트', 'Client')}</p>
82
+ <T ko="환영" en="Welcome" />
83
+ <p>{t('nav.home')}</p>
84
+ </div>
85
+ )
86
+ }
87
+ ```
88
+
89
+ ## SEO Utilities
90
+
91
+ ```tsx
92
+ import { createMetadata, getAlternates } from 'inline-i18n-multi-next/server'
93
+
94
+ export async function generateMetadata({ params }) {
95
+ const { locale } = await params
96
+ return createMetadata(
97
+ {
98
+ title: { en: 'My Site', ko: '내 사이트' },
99
+ description: { en: 'Welcome', ko: '환영합니다' },
100
+ },
101
+ locale,
102
+ '/about'
103
+ )
104
+ }
105
+ ```
106
+
107
+ ## Documentation
108
+
109
+ Full documentation: [GitHub](https://github.com/jaesukpark/inline-i18n-multi)
110
+
111
+ ## License
112
+
113
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inline-i18n-multi-next",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
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.0",
55
- "inline-i18n-multi-react": "0.1.0"
54
+ "inline-i18n-multi": "0.1.1",
55
+ "inline-i18n-multi-react": "0.1.1"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/react": "^19.0.2",