@deverjak/tenantkit-i18n 0.1.0
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/LICENSE +21 -0
- package/dist/index.d.ts +386 -0
- package/dist/index.js +39 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chytré Digital
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
/** A supported locale string, e.g. 'cs' | 'en'. Apps narrow this via their `createI18n` call. */
|
|
2
|
+
export type Locale = string;
|
|
3
|
+
export interface CreateI18nOptions<L extends readonly Locale[]> {
|
|
4
|
+
locales: L;
|
|
5
|
+
defaultLocale: L[number];
|
|
6
|
+
/** How a locale's messages are loaded; defaults to dynamic-importing `messages/‹locale›.json`. */
|
|
7
|
+
loadMessages?: (locale: L[number]) => Promise<Record<string, unknown>>;
|
|
8
|
+
}
|
|
9
|
+
export declare function createI18n<const L extends readonly Locale[]>(opts: CreateI18nOptions<L>): {
|
|
10
|
+
routing: {
|
|
11
|
+
locales: L;
|
|
12
|
+
defaultLocale: L[number];
|
|
13
|
+
localePrefix?: import("next-intl/routing").LocalePrefix<L, "as-needed"> | undefined;
|
|
14
|
+
domains?: undefined;
|
|
15
|
+
localeCookie?: boolean | {
|
|
16
|
+
maxAge?: number | undefined | undefined;
|
|
17
|
+
priority?: "low" | "medium" | "high" | undefined | undefined;
|
|
18
|
+
domain?: string | undefined | undefined;
|
|
19
|
+
path?: string | undefined | undefined;
|
|
20
|
+
secure?: boolean | undefined | undefined;
|
|
21
|
+
sameSite?: true | false | "lax" | "strict" | "none" | undefined | undefined;
|
|
22
|
+
partitioned?: boolean | undefined | undefined;
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
alternateLinks?: boolean;
|
|
26
|
+
localeDetection?: boolean;
|
|
27
|
+
};
|
|
28
|
+
request: (params: import("next-intl/server").GetRequestConfigParams) => import("next-intl/server").RequestConfig | Promise<import("next-intl/server").RequestConfig>;
|
|
29
|
+
navigation: {
|
|
30
|
+
Link: import("react").ForwardRefExoticComponent<Omit<{
|
|
31
|
+
id?: string | undefined | undefined;
|
|
32
|
+
target?: import("react").HTMLAttributeAnchorTarget | undefined;
|
|
33
|
+
replace?: boolean | undefined;
|
|
34
|
+
slot?: string | undefined | undefined;
|
|
35
|
+
style?: import("react").CSSProperties | undefined;
|
|
36
|
+
title?: string | undefined | undefined;
|
|
37
|
+
locale?: string | undefined;
|
|
38
|
+
ref?: import("react").Ref<HTMLAnchorElement> | undefined;
|
|
39
|
+
prefix?: string | undefined | undefined;
|
|
40
|
+
key?: import("react").Key | null | undefined;
|
|
41
|
+
as?: (string | import("url").UrlObject) | undefined;
|
|
42
|
+
scroll?: boolean | undefined;
|
|
43
|
+
shallow?: boolean | undefined;
|
|
44
|
+
passHref?: boolean | undefined;
|
|
45
|
+
prefetch?: boolean | "auto" | null | undefined;
|
|
46
|
+
legacyBehavior?: boolean | undefined;
|
|
47
|
+
onNavigate?: ((event: {
|
|
48
|
+
preventDefault: () => void;
|
|
49
|
+
}) => void) | undefined;
|
|
50
|
+
transitionTypes?: string[] | undefined;
|
|
51
|
+
download?: any;
|
|
52
|
+
hrefLang?: string | undefined | undefined;
|
|
53
|
+
media?: string | undefined | undefined;
|
|
54
|
+
ping?: string | undefined | undefined;
|
|
55
|
+
type?: string | undefined | undefined;
|
|
56
|
+
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
57
|
+
defaultChecked?: boolean | undefined | undefined;
|
|
58
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
59
|
+
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
60
|
+
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
61
|
+
accessKey?: string | undefined | undefined;
|
|
62
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
63
|
+
autoFocus?: boolean | undefined | undefined;
|
|
64
|
+
className?: string | undefined | undefined;
|
|
65
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
66
|
+
contextMenu?: string | undefined | undefined;
|
|
67
|
+
dir?: string | undefined | undefined;
|
|
68
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
69
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
70
|
+
hidden?: boolean | undefined | undefined;
|
|
71
|
+
lang?: string | undefined | undefined;
|
|
72
|
+
nonce?: string | undefined | undefined;
|
|
73
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
74
|
+
tabIndex?: number | undefined | undefined;
|
|
75
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
76
|
+
radioGroup?: string | undefined | undefined;
|
|
77
|
+
role?: import("react").AriaRole | undefined;
|
|
78
|
+
about?: string | undefined | undefined;
|
|
79
|
+
content?: string | undefined | undefined;
|
|
80
|
+
datatype?: string | undefined | undefined;
|
|
81
|
+
inlist?: any;
|
|
82
|
+
property?: string | undefined | undefined;
|
|
83
|
+
rel?: string | undefined | undefined;
|
|
84
|
+
resource?: string | undefined | undefined;
|
|
85
|
+
rev?: string | undefined | undefined;
|
|
86
|
+
typeof?: string | undefined | undefined;
|
|
87
|
+
vocab?: string | undefined | undefined;
|
|
88
|
+
autoCorrect?: string | undefined | undefined;
|
|
89
|
+
autoSave?: string | undefined | undefined;
|
|
90
|
+
color?: string | undefined | undefined;
|
|
91
|
+
itemProp?: string | undefined | undefined;
|
|
92
|
+
itemScope?: boolean | undefined | undefined;
|
|
93
|
+
itemType?: string | undefined | undefined;
|
|
94
|
+
itemID?: string | undefined | undefined;
|
|
95
|
+
itemRef?: string | undefined | undefined;
|
|
96
|
+
results?: number | undefined | undefined;
|
|
97
|
+
security?: string | undefined | undefined;
|
|
98
|
+
unselectable?: "on" | "off" | undefined | undefined;
|
|
99
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined | undefined;
|
|
100
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
101
|
+
popoverTarget?: string | undefined | undefined;
|
|
102
|
+
inert?: boolean | undefined | undefined;
|
|
103
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
104
|
+
is?: string | undefined | undefined;
|
|
105
|
+
exportparts?: string | undefined | undefined;
|
|
106
|
+
part?: string | undefined | undefined;
|
|
107
|
+
"aria-activedescendant"?: string | undefined | undefined;
|
|
108
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
109
|
+
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
|
|
110
|
+
"aria-braillelabel"?: string | undefined | undefined;
|
|
111
|
+
"aria-brailleroledescription"?: string | undefined | undefined;
|
|
112
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
113
|
+
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
|
|
114
|
+
"aria-colcount"?: number | undefined | undefined;
|
|
115
|
+
"aria-colindex"?: number | undefined | undefined;
|
|
116
|
+
"aria-colindextext"?: string | undefined | undefined;
|
|
117
|
+
"aria-colspan"?: number | undefined | undefined;
|
|
118
|
+
"aria-controls"?: string | undefined | undefined;
|
|
119
|
+
"aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined | undefined;
|
|
120
|
+
"aria-describedby"?: string | undefined | undefined;
|
|
121
|
+
"aria-description"?: string | undefined | undefined;
|
|
122
|
+
"aria-details"?: string | undefined | undefined;
|
|
123
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
124
|
+
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined | undefined;
|
|
125
|
+
"aria-errormessage"?: string | undefined | undefined;
|
|
126
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
127
|
+
"aria-flowto"?: string | undefined | undefined;
|
|
128
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
129
|
+
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined | undefined;
|
|
130
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
131
|
+
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined | undefined;
|
|
132
|
+
"aria-keyshortcuts"?: string | undefined | undefined;
|
|
133
|
+
"aria-label"?: string | undefined | undefined;
|
|
134
|
+
"aria-labelledby"?: string | undefined | undefined;
|
|
135
|
+
"aria-level"?: number | undefined | undefined;
|
|
136
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined | undefined;
|
|
137
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
138
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
139
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
140
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined | undefined;
|
|
141
|
+
"aria-owns"?: string | undefined | undefined;
|
|
142
|
+
"aria-placeholder"?: string | undefined | undefined;
|
|
143
|
+
"aria-posinset"?: number | undefined | undefined;
|
|
144
|
+
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
|
|
145
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
146
|
+
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined | undefined;
|
|
147
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
148
|
+
"aria-roledescription"?: string | undefined | undefined;
|
|
149
|
+
"aria-rowcount"?: number | undefined | undefined;
|
|
150
|
+
"aria-rowindex"?: number | undefined | undefined;
|
|
151
|
+
"aria-rowindextext"?: string | undefined | undefined;
|
|
152
|
+
"aria-rowspan"?: number | undefined | undefined;
|
|
153
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
154
|
+
"aria-setsize"?: number | undefined | undefined;
|
|
155
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined | undefined;
|
|
156
|
+
"aria-valuemax"?: number | undefined | undefined;
|
|
157
|
+
"aria-valuemin"?: number | undefined | undefined;
|
|
158
|
+
"aria-valuenow"?: number | undefined | undefined;
|
|
159
|
+
"aria-valuetext"?: string | undefined | undefined;
|
|
160
|
+
href: string | import("url").UrlObject;
|
|
161
|
+
children?: import("react").ReactNode;
|
|
162
|
+
dangerouslySetInnerHTML?: {
|
|
163
|
+
__html: string | TrustedHTML;
|
|
164
|
+
} | undefined | undefined;
|
|
165
|
+
onCopy?: import("react").ClipboardEventHandler<HTMLAnchorElement> | undefined;
|
|
166
|
+
onCopyCapture?: import("react").ClipboardEventHandler<HTMLAnchorElement> | undefined;
|
|
167
|
+
onCut?: import("react").ClipboardEventHandler<HTMLAnchorElement> | undefined;
|
|
168
|
+
onCutCapture?: import("react").ClipboardEventHandler<HTMLAnchorElement> | undefined;
|
|
169
|
+
onPaste?: import("react").ClipboardEventHandler<HTMLAnchorElement> | undefined;
|
|
170
|
+
onPasteCapture?: import("react").ClipboardEventHandler<HTMLAnchorElement> | undefined;
|
|
171
|
+
onCompositionEnd?: import("react").CompositionEventHandler<HTMLAnchorElement> | undefined;
|
|
172
|
+
onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLAnchorElement> | undefined;
|
|
173
|
+
onCompositionStart?: import("react").CompositionEventHandler<HTMLAnchorElement> | undefined;
|
|
174
|
+
onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLAnchorElement> | undefined;
|
|
175
|
+
onCompositionUpdate?: import("react").CompositionEventHandler<HTMLAnchorElement> | undefined;
|
|
176
|
+
onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLAnchorElement> | undefined;
|
|
177
|
+
onFocus?: import("react").FocusEventHandler<HTMLAnchorElement> | undefined;
|
|
178
|
+
onFocusCapture?: import("react").FocusEventHandler<HTMLAnchorElement> | undefined;
|
|
179
|
+
onBlur?: import("react").FocusEventHandler<HTMLAnchorElement> | undefined;
|
|
180
|
+
onBlurCapture?: import("react").FocusEventHandler<HTMLAnchorElement> | undefined;
|
|
181
|
+
onChange?: import("react").ChangeEventHandler<HTMLAnchorElement, Element> | undefined;
|
|
182
|
+
onChangeCapture?: import("react").ChangeEventHandler<HTMLAnchorElement, Element> | undefined;
|
|
183
|
+
onBeforeInput?: import("react").InputEventHandler<HTMLAnchorElement> | undefined;
|
|
184
|
+
onBeforeInputCapture?: import("react").InputEventHandler<HTMLAnchorElement> | undefined;
|
|
185
|
+
onInput?: import("react").InputEventHandler<HTMLAnchorElement> | undefined;
|
|
186
|
+
onInputCapture?: import("react").InputEventHandler<HTMLAnchorElement> | undefined;
|
|
187
|
+
onReset?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
188
|
+
onResetCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
189
|
+
onSubmit?: import("react").SubmitEventHandler<HTMLAnchorElement> | undefined;
|
|
190
|
+
onSubmitCapture?: import("react").SubmitEventHandler<HTMLAnchorElement> | undefined;
|
|
191
|
+
onInvalid?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
192
|
+
onInvalidCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
193
|
+
onLoad?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
194
|
+
onLoadCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
195
|
+
onError?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
196
|
+
onErrorCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
197
|
+
onKeyDown?: import("react").KeyboardEventHandler<HTMLAnchorElement> | undefined;
|
|
198
|
+
onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLAnchorElement> | undefined;
|
|
199
|
+
onKeyPress?: import("react").KeyboardEventHandler<HTMLAnchorElement> | undefined;
|
|
200
|
+
onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLAnchorElement> | undefined;
|
|
201
|
+
onKeyUp?: import("react").KeyboardEventHandler<HTMLAnchorElement> | undefined;
|
|
202
|
+
onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLAnchorElement> | undefined;
|
|
203
|
+
onAbort?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
204
|
+
onAbortCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
205
|
+
onCanPlay?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
206
|
+
onCanPlayCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
207
|
+
onCanPlayThrough?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
208
|
+
onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
209
|
+
onDurationChange?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
210
|
+
onDurationChangeCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
211
|
+
onEmptied?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
212
|
+
onEmptiedCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
213
|
+
onEncrypted?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
214
|
+
onEncryptedCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
215
|
+
onEnded?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
216
|
+
onEndedCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
217
|
+
onLoadedData?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
218
|
+
onLoadedDataCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
219
|
+
onLoadedMetadata?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
220
|
+
onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
221
|
+
onLoadStart?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
222
|
+
onLoadStartCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
223
|
+
onPause?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
224
|
+
onPauseCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
225
|
+
onPlay?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
226
|
+
onPlayCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
227
|
+
onPlaying?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
228
|
+
onPlayingCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
229
|
+
onProgress?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
230
|
+
onProgressCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
231
|
+
onRateChange?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
232
|
+
onRateChangeCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
233
|
+
onSeeked?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
234
|
+
onSeekedCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
235
|
+
onSeeking?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
236
|
+
onSeekingCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
237
|
+
onStalled?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
238
|
+
onStalledCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
239
|
+
onSuspend?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
240
|
+
onSuspendCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
241
|
+
onTimeUpdate?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
242
|
+
onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
243
|
+
onVolumeChange?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
244
|
+
onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
245
|
+
onWaiting?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
246
|
+
onWaitingCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
247
|
+
onAuxClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
248
|
+
onAuxClickCapture?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
249
|
+
onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
250
|
+
onClickCapture?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
251
|
+
onContextMenu?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
252
|
+
onContextMenuCapture?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
253
|
+
onDoubleClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
254
|
+
onDoubleClickCapture?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
255
|
+
onDrag?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
256
|
+
onDragCapture?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
257
|
+
onDragEnd?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
258
|
+
onDragEndCapture?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
259
|
+
onDragEnter?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
260
|
+
onDragEnterCapture?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
261
|
+
onDragExit?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
262
|
+
onDragExitCapture?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
263
|
+
onDragLeave?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
264
|
+
onDragLeaveCapture?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
265
|
+
onDragOver?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
266
|
+
onDragOverCapture?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
267
|
+
onDragStart?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
268
|
+
onDragStartCapture?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
269
|
+
onDrop?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
270
|
+
onDropCapture?: import("react").DragEventHandler<HTMLAnchorElement> | undefined;
|
|
271
|
+
onMouseDown?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
272
|
+
onMouseDownCapture?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
273
|
+
onMouseEnter?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
274
|
+
onMouseLeave?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
275
|
+
onMouseMove?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
276
|
+
onMouseMoveCapture?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
277
|
+
onMouseOut?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
278
|
+
onMouseOutCapture?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
279
|
+
onMouseOver?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
280
|
+
onMouseOverCapture?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
281
|
+
onMouseUp?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
282
|
+
onMouseUpCapture?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
283
|
+
onSelect?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
284
|
+
onSelectCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
285
|
+
onTouchCancel?: import("react").TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
286
|
+
onTouchCancelCapture?: import("react").TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
287
|
+
onTouchEnd?: import("react").TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
288
|
+
onTouchEndCapture?: import("react").TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
289
|
+
onTouchMove?: import("react").TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
290
|
+
onTouchMoveCapture?: import("react").TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
291
|
+
onTouchStart?: import("react").TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
292
|
+
onTouchStartCapture?: import("react").TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
293
|
+
onPointerDown?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
294
|
+
onPointerDownCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
295
|
+
onPointerMove?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
296
|
+
onPointerMoveCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
297
|
+
onPointerUp?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
298
|
+
onPointerUpCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
299
|
+
onPointerCancel?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
300
|
+
onPointerCancelCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
301
|
+
onPointerEnter?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
302
|
+
onPointerLeave?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
303
|
+
onPointerOver?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
304
|
+
onPointerOverCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
305
|
+
onPointerOut?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
306
|
+
onPointerOutCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
307
|
+
onGotPointerCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
308
|
+
onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
309
|
+
onLostPointerCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
310
|
+
onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
311
|
+
onScroll?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
312
|
+
onScrollCapture?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
313
|
+
onScrollEnd?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
314
|
+
onScrollEndCapture?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
315
|
+
onWheel?: import("react").WheelEventHandler<HTMLAnchorElement> | undefined;
|
|
316
|
+
onWheelCapture?: import("react").WheelEventHandler<HTMLAnchorElement> | undefined;
|
|
317
|
+
onAnimationStart?: import("react").AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
318
|
+
onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
319
|
+
onAnimationEnd?: import("react").AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
320
|
+
onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
321
|
+
onAnimationIteration?: import("react").AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
322
|
+
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
323
|
+
onToggle?: import("react").ToggleEventHandler<HTMLAnchorElement> | undefined;
|
|
324
|
+
onBeforeToggle?: import("react").ToggleEventHandler<HTMLAnchorElement> | undefined;
|
|
325
|
+
onTransitionCancel?: import("react").TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
326
|
+
onTransitionCancelCapture?: import("react").TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
327
|
+
onTransitionEnd?: import("react").TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
328
|
+
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
329
|
+
onTransitionRun?: import("react").TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
330
|
+
onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
331
|
+
onTransitionStart?: import("react").TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
332
|
+
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
333
|
+
}, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
334
|
+
usePathname: () => string;
|
|
335
|
+
useRouter: () => {
|
|
336
|
+
push: (href: string | {
|
|
337
|
+
pathname: string;
|
|
338
|
+
query?: import("next-intl/navigation").QueryParams;
|
|
339
|
+
}, options?: (Partial<import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions> & {
|
|
340
|
+
locale?: string;
|
|
341
|
+
}) | undefined) => void;
|
|
342
|
+
replace: (href: string | {
|
|
343
|
+
pathname: string;
|
|
344
|
+
query?: import("next-intl/navigation").QueryParams;
|
|
345
|
+
}, options?: (Partial<import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions> & {
|
|
346
|
+
locale?: string;
|
|
347
|
+
}) | undefined) => void;
|
|
348
|
+
prefetch: (href: string | {
|
|
349
|
+
pathname: string;
|
|
350
|
+
query?: import("next-intl/navigation").QueryParams;
|
|
351
|
+
}, options?: (Partial<import("next/dist/shared/lib/app-router-context.shared-runtime").PrefetchOptions> & {
|
|
352
|
+
locale?: string;
|
|
353
|
+
}) | undefined) => void;
|
|
354
|
+
back(): void;
|
|
355
|
+
forward(): void;
|
|
356
|
+
refresh(): void;
|
|
357
|
+
experimental_gesturePush?(href: string, options?: import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions): void;
|
|
358
|
+
};
|
|
359
|
+
getPathname: (args: {
|
|
360
|
+
href: string | {
|
|
361
|
+
pathname: string;
|
|
362
|
+
query?: import("next-intl/navigation").QueryParams;
|
|
363
|
+
};
|
|
364
|
+
locale: string;
|
|
365
|
+
forcePrefix?: boolean;
|
|
366
|
+
}) => string;
|
|
367
|
+
redirect: (args: {
|
|
368
|
+
href: string | {
|
|
369
|
+
pathname: string;
|
|
370
|
+
query?: import("next-intl/navigation").QueryParams;
|
|
371
|
+
};
|
|
372
|
+
locale: string;
|
|
373
|
+
forcePrefix?: boolean;
|
|
374
|
+
}, type?: import("next/dist/client/components/redirect-error").RedirectType | undefined) => never;
|
|
375
|
+
permanentRedirect: (args: {
|
|
376
|
+
href: string | {
|
|
377
|
+
pathname: string;
|
|
378
|
+
query?: import("next-intl/navigation").QueryParams;
|
|
379
|
+
};
|
|
380
|
+
locale: string;
|
|
381
|
+
forcePrefix?: boolean;
|
|
382
|
+
}, type?: import("next/dist/client/components/redirect-error").RedirectType | undefined) => never;
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
/** The `{ routing, request, navigation }` bundle returned by `createI18n`. */
|
|
386
|
+
export type I18n = ReturnType<typeof createI18n>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Realizes docs/02-reservation-core.md §13 — the i18n factory (`@reservation-core/i18n`).
|
|
3
|
+
*
|
|
4
|
+
* A thin factory over next-intl that returns `routing` (defineRouting), `request` (getRequestConfig loading
|
|
5
|
+
* `messages/‹locale›.json`), and locale-aware `navigation` (Link/redirect/usePathname/useRouter). This deletes
|
|
6
|
+
* the config DRIFT found in Restaurio (two configs, `cs` vs `en` default). Message catalogues are per-app and
|
|
7
|
+
* namespaced (`admin.*`, `portal.*`, `enroll.*`, `email.*`); plugins ship their own (`plugins.payments.*`).
|
|
8
|
+
* Locale resolution: URL `[locale]` → user profile → tenant default → system default.
|
|
9
|
+
*/
|
|
10
|
+
import { defineRouting } from 'next-intl/routing';
|
|
11
|
+
import { createNavigation } from 'next-intl/navigation';
|
|
12
|
+
import { getRequestConfig } from 'next-intl/server';
|
|
13
|
+
// `L` is inferred as a const tuple (`['cs','en']`), which is what next-intl's tuple-generic API expects — a
|
|
14
|
+
// bare `string[]` would widen and demand a `pathnames` map. This mirrors how an app calls createI18n. The
|
|
15
|
+
// return type is inferred (the three next-intl handles) rather than annotated, so the precise tuple-narrowed
|
|
16
|
+
// routing type is preserved instead of widened to the broad `Pathnames<Locales>` branch.
|
|
17
|
+
export function createI18n(opts) {
|
|
18
|
+
const { locales, defaultLocale } = opts;
|
|
19
|
+
const load = opts.loadMessages ?? defaultLoader;
|
|
20
|
+
// 1) routing — the `[locale]` segment config (prefix strategy etc.).
|
|
21
|
+
const routing = defineRouting({
|
|
22
|
+
locales,
|
|
23
|
+
defaultLocale,
|
|
24
|
+
localePrefix: 'as-needed', // default locale unprefixed; others get `/‹locale›`
|
|
25
|
+
});
|
|
26
|
+
// 2) request — server-side per-request config: validate the requested locale, then load its catalogue.
|
|
27
|
+
const request = getRequestConfig(async ({ requestLocale }) => {
|
|
28
|
+
const requested = await requestLocale;
|
|
29
|
+
const locale = requested && locales.includes(requested) ? requested : defaultLocale;
|
|
30
|
+
return { locale, messages: await load(locale) };
|
|
31
|
+
});
|
|
32
|
+
// 3) navigation — locale-aware Link / redirect / usePathname / useRouter bound to the routing above.
|
|
33
|
+
const navigation = createNavigation(routing);
|
|
34
|
+
return { routing, request, navigation };
|
|
35
|
+
}
|
|
36
|
+
function defaultLoader(locale) {
|
|
37
|
+
// Apps keep catalogues at `messages/‹locale›.json` (doc 02 §13). The `@/` alias resolves into the app.
|
|
38
|
+
return import(`@/messages/${locale}.json`).then((m) => m.default);
|
|
39
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deverjak/tenantkit-i18n",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "next-intl wiring for tenantkit: createI18n() -> routing/request/navigation. The framework-bound i18n seam (kept out of the vendor-free kernel).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"next": ">=15",
|
|
21
|
+
"next-intl": ">=4"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"next-intl": "^4.13.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typescript": "^5.9.3",
|
|
28
|
+
"next": "^16.2.9",
|
|
29
|
+
"react": "^19.2.7",
|
|
30
|
+
"@types/react": "^19.2.0"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"build": "tsc -p tsconfig.json --outDir dist --declaration"
|
|
35
|
+
}
|
|
36
|
+
}
|