@djangocfg/nextjs 2.1.304 → 2.1.308

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/nextjs",
3
- "version": "2.1.304",
3
+ "version": "2.1.308",
4
4
  "description": "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
5
5
  "keywords": [
6
6
  "nextjs",
@@ -143,9 +143,9 @@
143
143
  "ai-docs": "tsx src/ai/cli.ts"
144
144
  },
145
145
  "peerDependencies": {
146
- "@djangocfg/i18n": "^2.1.304",
147
- "@djangocfg/monitor": "^2.1.304",
148
- "@djangocfg/ui-core": "^2.1.304",
146
+ "@djangocfg/i18n": "^2.1.308",
147
+ "@djangocfg/monitor": "^2.1.308",
148
+ "@djangocfg/ui-core": "^2.1.308",
149
149
  "next": "^16.2.2"
150
150
  },
151
151
  "peerDependenciesMeta": {
@@ -167,11 +167,11 @@
167
167
  "serwist": "^9.2.3"
168
168
  },
169
169
  "devDependencies": {
170
- "@djangocfg/i18n": "^2.1.304",
171
- "@djangocfg/monitor": "^2.1.304",
172
- "@djangocfg/ui-core": "^2.1.304",
173
- "@djangocfg/layouts": "^2.1.304",
174
- "@djangocfg/typescript-config": "^2.1.304",
170
+ "@djangocfg/i18n": "^2.1.308",
171
+ "@djangocfg/monitor": "^2.1.308",
172
+ "@djangocfg/ui-core": "^2.1.308",
173
+ "@djangocfg/layouts": "^2.1.308",
174
+ "@djangocfg/typescript-config": "^2.1.308",
175
175
  "@types/node": "^24.7.2",
176
176
  "@types/react": "^19.1.0",
177
177
  "@types/react-dom": "^19.1.0",
@@ -1,33 +1,24 @@
1
1
  /**
2
2
  * LocaleSwitcher Component (Smart)
3
3
  *
4
- * Wrapper around @djangocfg/layouts LocaleSwitcher with next-intl hooks.
5
- * Automatically gets locale data from routing config.
4
+ * Wrapper around `@djangocfg/layouts` LocaleSwitcher with next-intl plumbing.
5
+ * Mounts its own `LayoutI18nProvider` so the switcher works standalone — no
6
+ * need to wrap the page in `<AppLayout i18n={...}>` just to render it.
6
7
  *
7
8
  * @example
8
9
  * ```tsx
9
10
  * import { LocaleSwitcher } from '@djangocfg/nextjs/i18n/components';
10
11
  *
11
- * // Basic usage (uses all locales from routing config)
12
12
  * <LocaleSwitcher />
13
- *
14
- * // With custom locales
15
13
  * <LocaleSwitcher locales={['en', 'ru']} />
16
- *
17
- * // With custom labels
18
- * <LocaleSwitcher
19
- * labels={{
20
- * en: 'English',
21
- * ru: 'Русский',
22
- * ko: '한국어',
23
- * }}
24
- * />
14
+ * <LocaleSwitcher labels={{ en: 'English', ru: 'Русский' }} />
25
15
  * ```
26
16
  */
27
17
 
28
18
  'use client';
29
19
 
30
20
  import {
21
+ LayoutI18nProvider,
31
22
  LocaleSwitcher as BaseLocaleSwitcher,
32
23
  type LocaleSwitcherProps as BaseLocaleSwitcherProps,
33
24
  } from '@djangocfg/layouts';
@@ -35,26 +26,25 @@ import {
35
26
  import { useLocaleSwitcher } from '../client';
36
27
  import type { LocaleCode } from '../types';
37
28
 
38
- export interface LocaleSwitcherProps
39
- extends Omit<BaseLocaleSwitcherProps, 'locale' | 'locales' | 'onChange'> {
29
+ export interface LocaleSwitcherProps extends BaseLocaleSwitcherProps {
40
30
  /** Available locales (defaults to all from routing config) */
41
31
  locales?: LocaleCode[];
42
32
  }
43
33
 
44
- export function LocaleSwitcher({
45
- locales: customLocales,
46
- ...props
47
- }: LocaleSwitcherProps) {
34
+ export function LocaleSwitcher({ locales: customLocales, ...props }: LocaleSwitcherProps) {
48
35
  const { locale, locales: routingLocales, changeLocale } = useLocaleSwitcher();
49
36
 
50
37
  const availableLocales = customLocales || routingLocales;
51
38
 
52
39
  return (
53
- <BaseLocaleSwitcher
54
- locale={locale}
55
- locales={availableLocales}
56
- onChange={changeLocale}
57
- {...props}
58
- />
40
+ <LayoutI18nProvider
41
+ value={{
42
+ locale,
43
+ locales: availableLocales,
44
+ onLocaleChange: changeLocale,
45
+ }}
46
+ >
47
+ <BaseLocaleSwitcher {...props} />
48
+ </LayoutI18nProvider>
59
49
  );
60
50
  }