@djangocfg/layouts 2.1.303 → 2.1.307

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 (29) hide show
  1. package/package.json +18 -18
  2. package/src/layouts/AppLayout/AppLayout.tsx +14 -11
  3. package/src/layouts/AppLayout/BaseApp.tsx +3 -1
  4. package/src/layouts/AppLayout/LayoutI18nProvider.tsx +59 -0
  5. package/src/layouts/AppLayout/index.ts +7 -0
  6. package/src/layouts/PrivateLayout/PrivateLayout.tsx +1 -5
  7. package/src/layouts/PrivateLayout/components/PrivateSidebar.tsx +2 -4
  8. package/src/layouts/PublicLayout/footers/DefaultFooter/DefaultFooter.tsx +6 -11
  9. package/src/layouts/PublicLayout/footers/DefaultFooter/types.ts +15 -6
  10. package/src/layouts/PublicLayout/navbars/FloatingNavbar/FloatingNavbar.tsx +1 -5
  11. package/src/layouts/PublicLayout/navbars/FlushNavbar/FlushNavbar.tsx +1 -5
  12. package/src/layouts/PublicLayout/navbars/MinimalNavbar/MinimalNavbar.tsx +1 -6
  13. package/src/layouts/PublicLayout/primitives/NavControls.tsx +5 -9
  14. package/src/layouts/PublicLayout/shared/MobileDrawerShell.tsx +2 -6
  15. package/src/layouts/PublicLayout/shared/NavbarShell.tsx +1 -7
  16. package/src/layouts/_components/LocaleSwitcher.tsx +40 -178
  17. package/src/layouts/_components/PrivateSidebarAccount.tsx +6 -8
  18. package/src/layouts/_components/UserMenu.tsx +15 -19
  19. package/src/layouts/_components/index.ts +23 -2
  20. package/src/layouts/_components/locale-switcher/LocaleCard.tsx +91 -0
  21. package/src/layouts/_components/locale-switcher/LocaleGrid.tsx +128 -0
  22. package/src/layouts/_components/locale-switcher/LocaleSwitcher.tsx +100 -0
  23. package/src/layouts/_components/locale-switcher/LocaleSwitcherDialog.tsx +168 -0
  24. package/src/layouts/_components/locale-switcher/LocaleSwitcherDropdown.tsx +85 -0
  25. package/src/layouts/_components/locale-switcher/LocaleSwitcherTrigger.tsx +74 -0
  26. package/src/layouts/_components/locale-switcher/index.ts +27 -0
  27. package/src/layouts/_components/locale-switcher/localeMeta.ts +109 -0
  28. package/src/layouts/_components/locale-switcher/types.ts +48 -0
  29. package/src/layouts/types/layout.types.ts +37 -1
@@ -0,0 +1,168 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { Globe, X } from 'lucide-react';
5
+
6
+ import {
7
+ Dialog,
8
+ DialogContent,
9
+ DialogTitle,
10
+ DialogClose,
11
+ } from '@djangocfg/ui-core/components';
12
+ import { useIsMobile } from '@djangocfg/ui-core/hooks';
13
+ import { cn } from '@djangocfg/ui-core/lib';
14
+
15
+ import { LocaleGrid } from './LocaleGrid';
16
+ import type {
17
+ LocaleSwitcherBrand,
18
+ LocaleSwitcherLabels,
19
+ LocaleSwitcherSharedProps,
20
+ } from './types';
21
+
22
+ export interface LocaleSwitcherDialogProps extends LocaleSwitcherSharedProps {
23
+ open: boolean;
24
+ onOpenChange: (open: boolean) => void;
25
+ brand?: LocaleSwitcherBrand;
26
+ }
27
+
28
+ const DEFAULT_LABELS: Required<LocaleSwitcherLabels> = {
29
+ dialogTitle: 'Choose your language',
30
+ dialogSubtitle: 'Pick the language you want to browse the site in.',
31
+ searchPlaceholder: 'Search language…',
32
+ emptyResults: 'No languages found',
33
+ closeLabel: 'Close',
34
+ triggerLabel: 'Change language',
35
+ };
36
+
37
+ /**
38
+ * Fullscreen language picker dialog. Slides up from the bottom on mobile,
39
+ * fades into a centred fullscreen sheet on tablet/desktop.
40
+ *
41
+ * The dialog uses ui-core's `<DialogContent fullscreen>` and provides a
42
+ * custom pill-shaped close button via `closeButton` so the default Radix
43
+ * X glyph does not stack on top.
44
+ */
45
+ export function LocaleSwitcherDialog({
46
+ locale,
47
+ locales,
48
+ onChange,
49
+ open,
50
+ onOpenChange,
51
+ brand,
52
+ labels,
53
+ i18nLabels,
54
+ }: LocaleSwitcherDialogProps) {
55
+ const isMobile = useIsMobile();
56
+
57
+ const merged = React.useMemo(
58
+ () => ({ ...DEFAULT_LABELS, ...i18nLabels }),
59
+ [i18nLabels],
60
+ );
61
+
62
+ const handleSelect = React.useCallback(
63
+ (code: string) => {
64
+ onChange(code);
65
+ onOpenChange(false);
66
+ },
67
+ [onChange, onOpenChange],
68
+ );
69
+
70
+ const closeButton = React.useMemo(
71
+ () => (
72
+ <DialogClose
73
+ aria-label={merged.closeLabel}
74
+ className={cn(
75
+ 'absolute right-4 top-4 inline-flex h-10 w-10 items-center justify-center',
76
+ 'cursor-pointer rounded-full border border-border/60 bg-background/90 text-muted-foreground shadow-sm',
77
+ 'transition-colors hover:bg-accent hover:text-foreground',
78
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40',
79
+ )}
80
+ >
81
+ <X className="h-4 w-4" />
82
+ </DialogClose>
83
+ ),
84
+ [merged.closeLabel],
85
+ );
86
+
87
+ return (
88
+ <Dialog open={open} onOpenChange={onOpenChange}>
89
+ <DialogContent
90
+ fullscreen
91
+ closeButton={closeButton}
92
+ className={cn(
93
+ 'bg-background/95 backdrop-blur-md',
94
+ isMobile
95
+ ? 'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom'
96
+ : null,
97
+ )}
98
+ >
99
+ <DialogTitle className="sr-only">{merged.dialogTitle}</DialogTitle>
100
+
101
+ {/*
102
+ Single padded shell — both header and grid use the same horizontal
103
+ rhythm, so the search input lines up with the cards beneath it.
104
+ The shell scrolls; the grid below uses overflow-hidden so the focus
105
+ ring on the search input isn't clipped by an inner scroll edge.
106
+ */}
107
+ <div className="mx-auto flex h-full w-full max-w-5xl flex-col px-4 sm:px-6 lg:px-8">
108
+ <LocaleSwitcherDialogHeader brand={brand} labels={merged} />
109
+
110
+ <div className="flex-1 min-h-0 pb-6 lg:pb-10">
111
+ <LocaleGrid
112
+ locale={locale}
113
+ locales={locales}
114
+ onSelect={handleSelect}
115
+ labels={labels}
116
+ searchPlaceholder={merged.searchPlaceholder}
117
+ emptyResults={merged.emptyResults}
118
+ compact={isMobile}
119
+ />
120
+ </div>
121
+ </div>
122
+ </DialogContent>
123
+ </Dialog>
124
+ );
125
+ }
126
+
127
+ interface DialogHeaderProps {
128
+ brand?: LocaleSwitcherBrand;
129
+ labels: Required<LocaleSwitcherLabels>;
130
+ }
131
+
132
+ function LocaleSwitcherDialogHeader({ brand, labels }: DialogHeaderProps) {
133
+ const hasBrand = Boolean(brand?.logo || brand?.name);
134
+
135
+ return (
136
+ <header className="shrink-0 pb-5 pt-6 sm:pt-8 lg:pb-7 lg:pt-10">
137
+ <div className="mb-5 inline-flex items-center gap-2.5 lg:mb-7">
138
+ {hasBrand ? (
139
+ <>
140
+ {brand?.logo ? (
141
+ <span className="inline-flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-primary/10 text-primary">
142
+ {brand.logo}
143
+ </span>
144
+ ) : null}
145
+ {brand?.name ? (
146
+ <span className="text-sm font-semibold tracking-tight text-foreground">
147
+ {brand.name}
148
+ </span>
149
+ ) : null}
150
+ </>
151
+ ) : (
152
+ <span className="inline-flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10 text-primary">
153
+ <Globe className="h-4 w-4" aria-hidden />
154
+ </span>
155
+ )}
156
+ </div>
157
+
158
+ <h2 className="text-2xl font-semibold tracking-tight text-foreground sm:text-3xl">
159
+ {labels.dialogTitle}
160
+ </h2>
161
+ {labels.dialogSubtitle && (
162
+ <p className="mt-1.5 text-sm text-muted-foreground sm:text-base">
163
+ {labels.dialogSubtitle}
164
+ </p>
165
+ )}
166
+ </header>
167
+ );
168
+ }
@@ -0,0 +1,85 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { Globe } from 'lucide-react';
5
+
6
+ import {
7
+ Button,
8
+ DropdownMenu,
9
+ DropdownMenuContent,
10
+ DropdownMenuItem,
11
+ DropdownMenuTrigger,
12
+ LanguageFlag,
13
+ } from '@djangocfg/ui-core/components';
14
+ import { cn } from '@djangocfg/ui-core/lib';
15
+
16
+ import { getLocaleMeta } from './localeMeta';
17
+ import type { LocaleSwitcherSharedProps } from './types';
18
+
19
+ export interface LocaleSwitcherDropdownProps extends LocaleSwitcherSharedProps {
20
+ showCode?: boolean;
21
+ variant?: 'ghost' | 'outline' | 'default';
22
+ size?: 'sm' | 'default' | 'lg' | 'icon';
23
+ showIcon?: boolean;
24
+ showFlag?: boolean;
25
+ showTriggerLabel?: boolean;
26
+ }
27
+
28
+ /**
29
+ * Compact dropdown locale switcher — kept for navbar and dense layouts where
30
+ * a fullscreen dialog feels heavy.
31
+ */
32
+ export function LocaleSwitcherDropdown({
33
+ locale,
34
+ locales,
35
+ onChange,
36
+ labels,
37
+ showCode = false,
38
+ variant = 'ghost',
39
+ size = 'sm',
40
+ showIcon = true,
41
+ showFlag = true,
42
+ showTriggerLabel = true,
43
+ className,
44
+ }: LocaleSwitcherDropdownProps) {
45
+ const currentMeta = getLocaleMeta(locale, labels);
46
+ const currentLabel = showCode ? locale.toUpperCase() : currentMeta.native;
47
+
48
+ return (
49
+ <DropdownMenu>
50
+ <DropdownMenuTrigger asChild>
51
+ <Button variant={variant} size={size} className={className}>
52
+ {showFlag ? (
53
+ <LanguageFlag
54
+ code={locale}
55
+ rounded
56
+ className={cn('h-3 w-4 shrink-0', showTriggerLabel && 'mr-1.5')}
57
+ />
58
+ ) : showIcon ? (
59
+ <Globe className={cn('h-4 w-4 shrink-0', showTriggerLabel && 'mr-1')} />
60
+ ) : null}
61
+ {showTriggerLabel && <span>{currentLabel}</span>}
62
+ </Button>
63
+ </DropdownMenuTrigger>
64
+ <DropdownMenuContent align="end">
65
+ {locales.map((code) => {
66
+ const meta = getLocaleMeta(code, labels);
67
+ const active = code === locale;
68
+ return (
69
+ <DropdownMenuItem
70
+ key={code}
71
+ onClick={() => onChange(code)}
72
+ className={cn(
73
+ 'flex items-center gap-2',
74
+ active && 'bg-accent',
75
+ )}
76
+ >
77
+ {showFlag && <LanguageFlag code={code} rounded className="h-3 w-4 shrink-0" />}
78
+ <span>{showCode ? `${code.toUpperCase()} - ${meta.native}` : meta.native}</span>
79
+ </DropdownMenuItem>
80
+ );
81
+ })}
82
+ </DropdownMenuContent>
83
+ </DropdownMenu>
84
+ );
85
+ }
@@ -0,0 +1,74 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { Globe } from 'lucide-react';
5
+
6
+ import { Button, LanguageFlag } from '@djangocfg/ui-core/components';
7
+ import { cn } from '@djangocfg/ui-core/lib';
8
+
9
+ import { getLocaleMeta } from './localeMeta';
10
+
11
+ export interface LocaleSwitcherTriggerProps {
12
+ locale: string;
13
+ labels?: Record<string, string>;
14
+ /** Show the flag in the trigger. @default true */
15
+ showFlag?: boolean;
16
+ /** Show the locale label / native name in the trigger. @default true */
17
+ showLabel?: boolean;
18
+ /** Show locale code instead of the native name (`'EN'` instead of `'English'`). */
19
+ showCode?: boolean;
20
+ variant?: 'ghost' | 'outline' | 'default';
21
+ size?: 'sm' | 'default' | 'lg' | 'icon';
22
+ className?: string;
23
+ ariaLabel?: string;
24
+ onClick?: () => void;
25
+ }
26
+
27
+ /**
28
+ * Footer / navbar trigger that opens the dialog. Visually matches the
29
+ * existing dropdown trigger so swapping `variant` does not shift the row.
30
+ */
31
+ export const LocaleSwitcherTrigger = React.forwardRef<
32
+ HTMLButtonElement,
33
+ LocaleSwitcherTriggerProps
34
+ >(function LocaleSwitcherTrigger(
35
+ {
36
+ locale,
37
+ labels,
38
+ showFlag = true,
39
+ showLabel = true,
40
+ showCode = false,
41
+ variant = 'outline',
42
+ size = 'default',
43
+ className,
44
+ ariaLabel,
45
+ onClick,
46
+ },
47
+ ref,
48
+ ) {
49
+ const meta = getLocaleMeta(locale, labels);
50
+ const labelText = showCode ? locale.toUpperCase() : meta.native;
51
+
52
+ return (
53
+ <Button
54
+ ref={ref}
55
+ type="button"
56
+ variant={variant}
57
+ size={size}
58
+ onClick={onClick}
59
+ aria-label={ariaLabel}
60
+ className={cn('inline-flex items-center gap-2', className)}
61
+ >
62
+ {showFlag ? (
63
+ <LanguageFlag
64
+ code={locale}
65
+ rounded
66
+ className="h-3 w-4 shrink-0"
67
+ />
68
+ ) : (
69
+ <Globe className="h-4 w-4 shrink-0" aria-hidden />
70
+ )}
71
+ {showLabel && <span className="truncate">{labelText}</span>}
72
+ </Button>
73
+ );
74
+ });
@@ -0,0 +1,27 @@
1
+ export { LocaleSwitcher } from './LocaleSwitcher';
2
+ export type { LocaleSwitcherProps } from './LocaleSwitcher';
3
+
4
+ export { LocaleSwitcherDialog } from './LocaleSwitcherDialog';
5
+ export type { LocaleSwitcherDialogProps } from './LocaleSwitcherDialog';
6
+
7
+ export { LocaleSwitcherDropdown } from './LocaleSwitcherDropdown';
8
+ export type { LocaleSwitcherDropdownProps } from './LocaleSwitcherDropdown';
9
+
10
+ export { LocaleSwitcherTrigger } from './LocaleSwitcherTrigger';
11
+ export type { LocaleSwitcherTriggerProps } from './LocaleSwitcherTrigger';
12
+
13
+ export { LocaleGrid } from './LocaleGrid';
14
+ export type { LocaleGridProps } from './LocaleGrid';
15
+
16
+ export { LocaleCard } from './LocaleCard';
17
+ export type { LocaleCardProps } from './LocaleCard';
18
+
19
+ export { getLocaleMeta } from './localeMeta';
20
+ export type { LocaleMeta } from './localeMeta';
21
+
22
+ export type {
23
+ LocaleSwitcherBrand,
24
+ LocaleSwitcherLabels,
25
+ LocaleSwitcherSharedProps,
26
+ LocaleSwitcherVariant,
27
+ } from './types';
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Locale metadata — native name + english name per locale code.
3
+ *
4
+ * Covers the codes shipped with `@djangocfg/i18n` (and their common regional
5
+ * variants). Unknown codes fall back to the uppercase code itself.
6
+ */
7
+
8
+ export interface LocaleMeta {
9
+ /** Native rendering — `'Русский'`, `'한국어'`. */
10
+ native: string;
11
+ /** English name — `'Russian'`, `'Korean'`. Used as the secondary line. */
12
+ english: string;
13
+ /** Marks the locale as RTL (`ar`, `he`, `fa`, `ur`). */
14
+ rtl?: boolean;
15
+ }
16
+
17
+ const RTL_LANGS = new Set(['ar', 'he', 'fa', 'ur', 'ps', 'sd', 'yi', 'ku']);
18
+
19
+ const META: Record<string, { native: string; english: string }> = {
20
+ // Major
21
+ en: { native: 'English', english: 'English' },
22
+ ru: { native: 'Русский', english: 'Russian' },
23
+ ko: { native: '한국어', english: 'Korean' },
24
+ zh: { native: '中文', english: 'Chinese' },
25
+ ja: { native: '日本語', english: 'Japanese' },
26
+ es: { native: 'Español', english: 'Spanish' },
27
+ fr: { native: 'Français', english: 'French' },
28
+ de: { native: 'Deutsch', english: 'German' },
29
+ pt: { native: 'Português', english: 'Portuguese' },
30
+ it: { native: 'Italiano', english: 'Italian' },
31
+ ar: { native: 'العربية', english: 'Arabic' },
32
+ hi: { native: 'हिन्दी', english: 'Hindi' },
33
+ tr: { native: 'Türkçe', english: 'Turkish' },
34
+ pl: { native: 'Polski', english: 'Polish' },
35
+ nl: { native: 'Nederlands', english: 'Dutch' },
36
+ uk: { native: 'Українська', english: 'Ukrainian' },
37
+
38
+ // Regional variants
39
+ 'pt-BR': { native: 'Português (Brasil)', english: 'Portuguese (Brazil)' },
40
+ 'pt-PT': { native: 'Português (Portugal)', english: 'Portuguese (Portugal)' },
41
+ 'zh-CN': { native: '简体中文', english: 'Chinese (Simplified)' },
42
+ 'zh-TW': { native: '繁體中文', english: 'Chinese (Traditional)' },
43
+ 'en-US': { native: 'English (US)', english: 'English (US)' },
44
+ 'en-GB': { native: 'English (UK)', english: 'English (UK)' },
45
+ 'es-MX': { native: 'Español (México)', english: 'Spanish (Mexico)' },
46
+ 'es-ES': { native: 'Español (España)', english: 'Spanish (Spain)' },
47
+ 'fr-CA': { native: 'Français (Canada)', english: 'French (Canada)' },
48
+
49
+ // Scandinavian
50
+ sv: { native: 'Svenska', english: 'Swedish' },
51
+ no: { native: 'Norsk', english: 'Norwegian' },
52
+ nb: { native: 'Norsk Bokmål', english: 'Norwegian Bokmål' },
53
+ nn: { native: 'Norsk Nynorsk', english: 'Norwegian Nynorsk' },
54
+ da: { native: 'Dansk', english: 'Danish' },
55
+ fi: { native: 'Suomi', english: 'Finnish' },
56
+ is: { native: 'Íslenska', english: 'Icelandic' },
57
+
58
+ // Other European
59
+ cs: { native: 'Čeština', english: 'Czech' },
60
+ sk: { native: 'Slovenčina', english: 'Slovak' },
61
+ hu: { native: 'Magyar', english: 'Hungarian' },
62
+ ro: { native: 'Română', english: 'Romanian' },
63
+ bg: { native: 'Български', english: 'Bulgarian' },
64
+ hr: { native: 'Hrvatski', english: 'Croatian' },
65
+ sr: { native: 'Српски', english: 'Serbian' },
66
+ sl: { native: 'Slovenščina', english: 'Slovenian' },
67
+ et: { native: 'Eesti', english: 'Estonian' },
68
+ lv: { native: 'Latviešu', english: 'Latvian' },
69
+ lt: { native: 'Lietuvių', english: 'Lithuanian' },
70
+ el: { native: 'Ελληνικά', english: 'Greek' },
71
+
72
+ // Other
73
+ th: { native: 'ไทย', english: 'Thai' },
74
+ vi: { native: 'Tiếng Việt', english: 'Vietnamese' },
75
+ id: { native: 'Indonesia', english: 'Indonesian' },
76
+ ms: { native: 'Bahasa Melayu', english: 'Malay' },
77
+ he: { native: 'עברית', english: 'Hebrew' },
78
+ fa: { native: 'فارسی', english: 'Persian' },
79
+ };
80
+
81
+ function normalize(code: string): { exact: string; base: string } {
82
+ const trimmed = code.trim();
83
+ const dash = trimmed.indexOf('-');
84
+ if (dash === -1) {
85
+ return { exact: trimmed.toLowerCase(), base: trimmed.toLowerCase() };
86
+ }
87
+ const lang = trimmed.slice(0, dash).toLowerCase();
88
+ const region = trimmed.slice(dash + 1).toUpperCase();
89
+ return { exact: `${lang}-${region}`, base: lang };
90
+ }
91
+
92
+ export function getLocaleMeta(
93
+ code: string,
94
+ overrides?: Record<string, string>,
95
+ ): LocaleMeta {
96
+ const { exact, base } = normalize(code);
97
+
98
+ // Manual overrides win — match either the exact code or the base.
99
+ const overrideNative = overrides?.[code] ?? overrides?.[exact] ?? overrides?.[base];
100
+
101
+ // Try exact match first (`pt-BR`), fall back to base (`pt`).
102
+ const direct = META[exact] ?? META[base];
103
+
104
+ return {
105
+ native: overrideNative ?? direct?.native ?? code.toUpperCase(),
106
+ english: direct?.english ?? code.toUpperCase(),
107
+ rtl: RTL_LANGS.has(base),
108
+ };
109
+ }
@@ -0,0 +1,48 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export type LocaleSwitcherVariant = 'dropdown' | 'dialog';
4
+
5
+ /**
6
+ * Brand block shown in the dialog header. Pass either a logo node, a
7
+ * project name string, or both. Falls back to a Globe icon + "Select
8
+ * language" header when no brand is provided.
9
+ */
10
+ export interface LocaleSwitcherBrand {
11
+ /** Logo node (img, svg, lucide icon, …). Sized at ~40×40 in the dialog header. */
12
+ logo?: ReactNode;
13
+ /** Project name displayed alongside the logo. */
14
+ name?: string;
15
+ }
16
+
17
+ export interface LocaleSwitcherLabels {
18
+ /**
19
+ * Title rendered in the dialog hero (`Choose your language`).
20
+ * The dialog also exposes this string as the accessible DialogTitle.
21
+ */
22
+ dialogTitle?: string;
23
+ /** Subtitle below the title. */
24
+ dialogSubtitle?: string;
25
+ /** Search input placeholder. */
26
+ searchPlaceholder?: string;
27
+ /** Empty state when no locales match the search. */
28
+ emptyResults?: string;
29
+ /** Aria-label for the close button (also used as tooltip). */
30
+ closeLabel?: string;
31
+ /** Aria-label for the trigger button. */
32
+ triggerLabel?: string;
33
+ }
34
+
35
+ export interface LocaleSwitcherSharedProps {
36
+ /** Current locale (ISO 639-1, optionally with region — `'pt-BR'`). */
37
+ locale: string;
38
+ /** Available locales. */
39
+ locales: string[];
40
+ /** Selection callback. */
41
+ onChange: (locale: string) => void;
42
+ /** Override / add native names (`{ es: 'Español' }`). */
43
+ labels?: Record<string, string>;
44
+ /** UI strings (search placeholder, close, …). */
45
+ i18nLabels?: LocaleSwitcherLabels;
46
+ /** Extra trigger className. */
47
+ className?: string;
48
+ }
@@ -62,6 +62,13 @@ export interface BaseLayoutProps {
62
62
 
63
63
  /** Debug panel configuration */
64
64
  debug?: DebugConfig;
65
+
66
+ /**
67
+ * Locale-switching plumbing. Mounted into a `LayoutI18nProvider` inside
68
+ * `BaseApp` — every locale-aware component (footer, navbar, sidebar,
69
+ * UserMenu, LocaleSwitcher) reads from there via `useLayoutI18n()`.
70
+ */
71
+ i18n?: I18nLayoutConfig;
65
72
  }
66
73
 
67
74
  /** Debug panel config — enabled in development by default, pass enabled: true/false to override */
@@ -70,9 +77,34 @@ export interface DebugConfig extends DebugButtonProps {
70
77
  enabled?: boolean;
71
78
  }
72
79
 
80
+ /**
81
+ * Brand block surfaced inside the locale-switcher dialog. Shared via
82
+ * `I18nLayoutConfig.brand` so footer / navbar / sidebar all open the same
83
+ * dialog with the same identity.
84
+ */
85
+ export interface I18nBrandConfig {
86
+ /** Logo node — img / svg / lucide icon. Sized ~36×36 in the dialog header. */
87
+ logo?: ReactNode;
88
+ /** Project name shown beside the logo. */
89
+ name?: string;
90
+ }
91
+
92
+ /** UI strings for the locale-switcher dialog (also passed via i18n). */
93
+ export interface I18nDialogLabels {
94
+ dialogTitle?: string;
95
+ dialogSubtitle?: string;
96
+ searchPlaceholder?: string;
97
+ emptyResults?: string;
98
+ closeLabel?: string;
99
+ triggerLabel?: string;
100
+ }
101
+
73
102
  /**
74
103
  * i18n configuration consumed by layouts, navbars, footer controls, and the
75
- * UserMenu locale row. Same shape as `@djangocfg/nextjs`'s `useLocaleSwitcher`.
104
+ * UserMenu locale row. Same shape as `@djangocfg/nextjs`'s `useLocaleSwitcher`,
105
+ * with optional `brand` / `dialogLabels` so every locale-switcher mount
106
+ * (footer, navbar, sidebar) opens the same fullscreen dialog with a
107
+ * consistent identity.
76
108
  */
77
109
  export interface I18nLayoutConfig {
78
110
  /** Current locale (e.g. `"en"`, `"ru"`, `"pt-BR"`). */
@@ -81,6 +113,10 @@ export interface I18nLayoutConfig {
81
113
  locales: string[];
82
114
  /** Called when the user picks a new locale. */
83
115
  onLocaleChange: (locale: string) => void;
116
+ /** Brand surfaced in the locale-switcher dialog header. */
117
+ brand?: I18nBrandConfig;
118
+ /** Custom UI strings for the locale-switcher dialog. */
119
+ dialogLabels?: I18nDialogLabels;
84
120
  }
85
121
 
86
122
  // ============================================================================