@djangocfg/nextjs 2.1.111 → 2.1.113
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 +34 -2
- package/dist/config/index.mjs +1 -1
- package/dist/config/index.mjs.map +1 -1
- package/dist/i18n/client.mjs +1 -1
- package/dist/i18n/client.mjs.map +1 -1
- package/dist/i18n/components.d.mts +3 -14
- package/dist/i18n/components.mjs +13 -56
- package/dist/i18n/components.mjs.map +1 -1
- package/dist/i18n/index.d.mts +1 -0
- package/dist/i18n/index.mjs +13 -56
- package/dist/i18n/index.mjs.map +1 -1
- package/dist/i18n/navigation.mjs +1 -1
- package/dist/i18n/navigation.mjs.map +1 -1
- package/dist/i18n/proxy.mjs +1 -1
- package/dist/i18n/proxy.mjs.map +1 -1
- package/dist/i18n/request.mjs +1 -1
- package/dist/i18n/request.mjs.map +1 -1
- package/dist/i18n/routing.d.mts +2 -2
- package/dist/i18n/routing.mjs +1 -1
- package/dist/i18n/routing.mjs.map +1 -1
- package/dist/i18n/server.mjs +1 -1
- package/dist/i18n/server.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/i18n/components/LocaleSwitcher.tsx +15 -79
- package/src/i18n/routing.ts +1 -1
package/README.md
CHANGED
|
@@ -390,12 +390,27 @@ function MyComponent() {
|
|
|
390
390
|
|
|
391
391
|
#### Locale Switcher
|
|
392
392
|
|
|
393
|
+
Smart wrapper around `@djangocfg/layouts` LocaleSwitcher with automatic next-intl hooks:
|
|
394
|
+
|
|
393
395
|
```tsx
|
|
394
396
|
import { LocaleSwitcher } from '@djangocfg/nextjs/i18n/components';
|
|
395
397
|
|
|
396
|
-
|
|
398
|
+
// Basic usage (automatically gets locale from next-intl)
|
|
399
|
+
<LocaleSwitcher />
|
|
400
|
+
|
|
401
|
+
// With custom locales (override routing config)
|
|
402
|
+
<LocaleSwitcher locales={['en', 'ru']} />
|
|
403
|
+
|
|
404
|
+
// With custom labels and styling
|
|
405
|
+
<LocaleSwitcher
|
|
406
|
+
labels={{ en: 'English', ru: 'Русский' }}
|
|
407
|
+
variant="outline"
|
|
408
|
+
size="sm"
|
|
409
|
+
/>
|
|
397
410
|
```
|
|
398
411
|
|
|
412
|
+
> **Note:** This component wraps `@djangocfg/layouts` LocaleSwitcher with `useLocaleSwitcher()` hook. For a presentational version that accepts locale data via props, use `LocaleSwitcher` from `@djangocfg/layouts` directly.
|
|
413
|
+
|
|
399
414
|
### Sitemap Generation
|
|
400
415
|
|
|
401
416
|
Generate dynamic XML sitemaps with i18n hreflang support:
|
|
@@ -625,18 +640,35 @@ import { I18nProvider } from '@djangocfg/nextjs/i18n';
|
|
|
625
640
|
|
|
626
641
|
#### `LocaleSwitcher`
|
|
627
642
|
|
|
628
|
-
|
|
643
|
+
Smart locale switcher that wraps `@djangocfg/layouts` LocaleSwitcher with next-intl hooks.
|
|
629
644
|
|
|
630
645
|
```tsx
|
|
631
646
|
import { LocaleSwitcher } from '@djangocfg/nextjs/i18n/components';
|
|
632
647
|
|
|
648
|
+
// Automatically gets locale from next-intl routing
|
|
649
|
+
<LocaleSwitcher />
|
|
650
|
+
|
|
651
|
+
// With custom options
|
|
633
652
|
<LocaleSwitcher
|
|
653
|
+
locales={['en', 'ru']} // Override available locales
|
|
654
|
+
labels={{ en: 'EN', ru: 'RU' }} // Custom locale labels
|
|
634
655
|
variant="outline"
|
|
635
656
|
size="sm"
|
|
657
|
+
showIcon={true}
|
|
636
658
|
className="w-full"
|
|
637
659
|
/>
|
|
638
660
|
```
|
|
639
661
|
|
|
662
|
+
**Props** (extends `@djangocfg/layouts` LocaleSwitcherProps):
|
|
663
|
+
| Prop | Type | Default | Description |
|
|
664
|
+
|------|------|---------|-------------|
|
|
665
|
+
| `locales` | `string[]` | From routing | Override available locales |
|
|
666
|
+
| `labels` | `Record<string, string>` | Built-in | Custom locale labels |
|
|
667
|
+
| `showCode` | `boolean` | `false` | Show locale code with label |
|
|
668
|
+
| `variant` | `'ghost' \| 'outline' \| 'default'` | `'ghost'` | Button variant |
|
|
669
|
+
| `size` | `'sm' \| 'default' \| 'lg' \| 'icon'` | `'sm'` | Button size |
|
|
670
|
+
| `showIcon` | `boolean` | `true` | Show globe icon |
|
|
671
|
+
|
|
640
672
|
### Sitemap
|
|
641
673
|
|
|
642
674
|
#### `createSitemapHandler(options)`
|
package/dist/config/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ var require_package = __commonJS({
|
|
|
14
14
|
"package.json"(exports, module) {
|
|
15
15
|
module.exports = {
|
|
16
16
|
name: "@djangocfg/nextjs",
|
|
17
|
-
version: "2.1.
|
|
17
|
+
version: "2.1.113",
|
|
18
18
|
description: "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
|
|
19
19
|
keywords: [
|
|
20
20
|
"nextjs",
|