canopy-i18n 0.0.4 → 0.0.5
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 +17 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -175,3 +175,20 @@ console.log(m.home.title.render()); // "Title"
|
|
|
175
175
|
```
|
|
176
176
|
|
|
177
177
|
Note: Module namespace objects are read-only; `applyLocaleDeep` returns a cloned plain object while updating each `I18nMessage` instance's locale in place.
|
|
178
|
+
|
|
179
|
+
## Example: Next.js App Router
|
|
180
|
+
|
|
181
|
+
An example Next.js App Router project lives under `examples/next-app`.
|
|
182
|
+
|
|
183
|
+
- Server-side usage: `/{locale}/server` renders messages using `applyLocaleDeep` in a server component
|
|
184
|
+
- Client-side usage: `/{locale}/client` renders messages using hooks (`useLocale`, `useApplyLocaleDeep`)
|
|
185
|
+
|
|
186
|
+
How to run:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
cd examples/next-app
|
|
190
|
+
pnpm install
|
|
191
|
+
pnpm dev
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Open `http://localhost:3000` and you will be redirected to `/{locale}` based on `Accept-Language`.
|