tera-system-ui 0.1.64 → 0.1.66
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/dist/COMPONENT_API.md +2 -539
- package/dist/components/accordion/Accordion.d.ts +24 -0
- package/dist/components/accordion/Accordion.js +4 -0
- package/dist/components/accordion/components/Accordion.svelte +2 -8
- package/dist/components/accordion/components/AccordionContent.svelte +5 -12
- package/dist/components/accordion/components/AccordionItem.svelte +3 -9
- package/dist/components/accordion/components/AccordionTrigger.svelte +5 -15
- package/dist/components/ai/ChatBubble.svelte +35 -0
- package/dist/components/ai/ChatBubble.svelte.d.ts +12 -0
- package/dist/components/ai/PromptInput.svelte +58 -0
- package/dist/components/ai/PromptInput.svelte.d.ts +13 -0
- package/dist/components/ai/StreamText.svelte +41 -0
- package/dist/components/ai/StreamText.svelte.d.ts +11 -0
- package/dist/components/ai/SuggestionChips.svelte +34 -0
- package/dist/components/ai/SuggestionChips.svelte.d.ts +10 -0
- package/dist/components/ai/ThinkingLoader.svelte +34 -0
- package/dist/components/ai/ThinkingLoader.svelte.d.ts +11 -0
- package/dist/components/ai/index.d.ts +5 -0
- package/dist/components/ai/index.js +5 -0
- package/dist/components/alert/Alert.svelte +47 -0
- package/dist/components/alert/Alert.svelte.d.ts +15 -0
- package/dist/components/alert/index.d.ts +1 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/avatar/Avatar.svelte +9 -25
- package/dist/components/badge/Badge.d.ts +52 -0
- package/dist/components/badge/Badge.js +22 -0
- package/dist/components/badge/Badge.svelte +22 -0
- package/dist/components/badge/Badge.svelte.d.ts +4 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/brand-logo/BrandLogo.svelte +12 -10
- package/dist/components/button/Button.d.ts +2 -2
- package/dist/components/button/Button.js +12 -12
- package/dist/components/button/Button.svelte +7 -34
- package/dist/components/card/Card.d.ts +68 -0
- package/dist/components/card/Card.js +28 -0
- package/dist/components/card/Card.svelte +33 -0
- package/dist/components/card/Card.svelte.d.ts +4 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +25 -4
- package/dist/components/checkbox/Checkbox.js +4 -0
- package/dist/components/checkbox/Checkbox.svelte +13 -16
- package/dist/components/checkbox/Checkbox.svelte.d.ts +2 -2
- package/dist/components/combobox/Combobox.d.ts +45 -9
- package/dist/components/combobox/Combobox.js +5 -7
- package/dist/components/combobox/Combobox.svelte +226 -8
- package/dist/components/combobox/Combobox.svelte.d.ts +2 -2
- package/dist/components/combobox/index.d.ts +1 -1
- package/dist/components/command/components/command-empty.svelte +3 -8
- package/dist/components/command/components/command-group.svelte +3 -13
- package/dist/components/command/components/command-input.svelte +5 -13
- package/dist/components/command/components/command-item.svelte +3 -9
- package/dist/components/command/components/command-link-item.svelte +3 -8
- package/dist/components/command/components/command-list.svelte +3 -8
- package/dist/components/command/components/command-separator.svelte +3 -8
- package/dist/components/command/components/command-shortcut.svelte +2 -10
- package/dist/components/command/components/command.svelte +29 -42
- package/dist/components/date-range-picker/DateRangePicker.svelte +490 -0
- package/dist/components/date-range-picker/DateRangePicker.svelte.d.ts +4 -0
- package/dist/components/date-range-picker/DateRangePicker.types.d.ts +38 -0
- package/dist/components/date-range-picker/DateRangePicker.types.js +1 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/dialog/Dialog.d.ts +43 -121
- package/dist/components/dialog/Dialog.js +1 -39
- package/dist/components/dialog/Dialog.svelte +103 -113
- package/dist/components/dialog/Dialog.svelte.d.ts +1 -2
- package/dist/components/dialog/dialog.scss +21 -24
- package/dist/components/drawer/Drawer.svelte +63 -0
- package/dist/components/drawer/Drawer.svelte.d.ts +16 -0
- package/dist/components/drawer/index.d.ts +1 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +51 -24
- package/dist/components/dropdown-menu/DropdownMenu.js +1 -15
- package/dist/components/dropdown-menu/components/DropdownMenu.svelte +36 -34
- package/dist/components/dropdown-menu/components/DropdownMenu.svelte.d.ts +1 -1
- package/dist/components/dropdown-menu/components/DropdownMenuGroup.svelte +8 -12
- package/dist/components/dropdown-menu/components/DropdownMenuGroup.svelte.d.ts +2 -4
- package/dist/components/dropdown-menu/components/DropdownMenuHeader.svelte +11 -12
- package/dist/components/dropdown-menu/components/DropdownMenuHeader.svelte.d.ts +2 -4
- package/dist/components/dropdown-menu/components/DropdownMenuItem.svelte +27 -30
- package/dist/components/dropdown-menu/components/DropdownMenuItem.svelte.d.ts +1 -1
- package/dist/components/dropdown-menu/components/DropdownMenuSeparator.svelte +9 -11
- package/dist/components/dropdown-menu/components/DropdownMenuSeparator.svelte.d.ts +2 -4
- package/dist/components/fonts/TeraFontMono.svelte +4 -4
- package/dist/components/fonts/TeraFontMono.svelte.d.ts +1 -0
- package/dist/components/fonts/TeraFontSansSerif.svelte +4 -4
- package/dist/components/fonts/TeraFontSansSerif.svelte.d.ts +1 -1
- package/dist/components/header/Header.svelte +6 -9
- package/dist/components/header/header.scss +1 -1
- package/dist/components/icons/IconArrowBigRightFilled.svelte +3 -7
- package/dist/components/icons/IconBook.svelte +3 -6
- package/dist/components/icons/IconBookmarkPlus.svelte +3 -6
- package/dist/components/icons/IconCalculator.svelte +3 -6
- package/dist/components/icons/IconCheck.svelte +3 -6
- package/dist/components/icons/IconChevronDown.svelte +3 -6
- package/dist/components/icons/IconCoin.svelte +3 -6
- package/dist/components/icons/IconCoinConvert.svelte +2 -5
- package/dist/components/icons/IconCopy.svelte +3 -6
- package/dist/components/icons/IconCopyCheckFilled.svelte +3 -6
- package/dist/components/icons/IconHamburger.svelte +3 -6
- package/dist/components/icons/IconLanguage.svelte +3 -6
- package/dist/components/icons/IconLoader2.svelte +3 -6
- package/dist/components/icons/IconLogout.svelte +3 -6
- package/dist/components/icons/IconMoon.svelte +3 -6
- package/dist/components/icons/IconPointFilled.svelte +3 -6
- package/dist/components/icons/IconSearch.svelte +3 -6
- package/dist/components/icons/IconSettings.svelte +3 -6
- package/dist/components/icons/IconSun.svelte +3 -6
- package/dist/components/icons/IconSwitchHorizontal.svelte +3 -6
- package/dist/components/icons/IconSwitchVertical.svelte +3 -6
- package/dist/components/icons/IconTransform.svelte +3 -6
- package/dist/components/icons/IconX.svelte +3 -6
- package/dist/components/input/Input.d.ts +2 -2
- package/dist/components/input/Input.js +10 -10
- package/dist/components/input/Input.svelte +10 -26
- package/dist/components/label/Label.d.ts +2 -2
- package/dist/components/label/Label.js +2 -2
- package/dist/components/label/Label.svelte +4 -12
- package/dist/components/language-picker-button/LanguagePickerButton.svelte +23 -42
- package/dist/components/light-dark-toggle/LightDarkToggle.svelte +21 -26
- package/dist/components/marketing/FeatureCard.svelte +37 -0
- package/dist/components/marketing/FeatureCard.svelte.d.ts +13 -0
- package/dist/components/marketing/PricingCard.svelte +48 -0
- package/dist/components/marketing/PricingCard.svelte.d.ts +15 -0
- package/dist/components/marketing/StatBlock.svelte +14 -0
- package/dist/components/marketing/StatBlock.svelte.d.ts +10 -0
- package/dist/components/marketing/TestimonialCard.svelte +24 -0
- package/dist/components/marketing/TestimonialCard.svelte.d.ts +12 -0
- package/dist/components/marketing/index.d.ts +4 -0
- package/dist/components/marketing/index.js +4 -0
- package/dist/components/popover/Popover.d.ts +32 -13
- package/dist/components/popover/Popover.js +1 -7
- package/dist/components/popover/Popover.svelte +40 -158
- package/dist/components/popover/Popover.svelte.d.ts +2 -2
- package/dist/components/popover-responsive/PopoverResponsive.d.ts +18 -7
- package/dist/components/popover-responsive/PopoverResponsive.js +1 -7
- package/dist/components/popover-responsive/PopoverResponsive.svelte +25 -87
- package/dist/components/popover-responsive/PopoverResponsive.svelte.d.ts +2 -11
- package/dist/components/select/Select.d.ts +60 -23
- package/dist/components/select/Select.js +14 -35
- package/dist/components/select/Select.svelte +157 -28
- package/dist/components/select/Select.svelte.d.ts +2 -3
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/side-navigation/SideNavigation.svelte +73 -96
- package/dist/components/side-navigation/SideNavigationItem.svelte +2 -2
- package/dist/components/side-navigation/SideNavigationLayout.svelte +3 -5
- package/dist/components/side-navigation/sidenav.scss +17 -13
- package/dist/components/skeleton/Skeleton.svelte +48 -0
- package/dist/components/skeleton/Skeleton.svelte.d.ts +12 -0
- package/dist/components/skeleton/index.d.ts +1 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/slider/Slider.d.ts +25 -15
- package/dist/components/slider/Slider.js +1 -7
- package/dist/components/slider/Slider.svelte +38 -164
- package/dist/components/slider/Slider.svelte.d.ts +1 -1
- package/dist/components/spinner/Spinner.svelte +39 -0
- package/dist/components/spinner/Spinner.svelte.d.ts +10 -0
- package/dist/components/spinner/index.d.ts +1 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/star-rating/StarRating.svelte +33 -49
- package/dist/components/switch/Switch.d.ts +19 -4
- package/dist/components/switch/Switch.js +4 -0
- package/dist/components/switch/Switch.svelte +13 -17
- package/dist/components/switch/Switch.svelte.d.ts +2 -2
- package/dist/components/table/Table.svelte +68 -0
- package/dist/components/table/Table.svelte.d.ts +40 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/tabs/Tabs.svelte.d.ts +45 -16
- package/dist/components/tabs/Tabs.svelte.js +8 -18
- package/dist/components/tabs/components/Tabs.svelte +27 -33
- package/dist/components/tabs/components/Tabs.svelte.d.ts +1 -1
- package/dist/components/tabs/components/TabsContent.svelte +13 -36
- package/dist/components/tabs/components/TabsContent.svelte.d.ts +2 -5
- package/dist/components/tabs/components/TabsItem.svelte +43 -32
- package/dist/components/tabs/components/TabsItem.svelte.d.ts +2 -5
- package/dist/components/tabs/components/TabsList.svelte +90 -58
- package/dist/components/tabs/components/TabsList.svelte.d.ts +2 -4
- package/dist/components/tera-ui-context/TeraUiContext.svelte +13 -26
- package/dist/components/text-area/TextArea.d.ts +2 -2
- package/dist/components/text-area/TextArea.js +9 -9
- package/dist/components/text-area/TextArea.svelte +41 -65
- package/dist/components/toast/ToastContainer.svelte +50 -0
- package/dist/components/toast/ToastContainer.svelte.d.ts +18 -0
- package/dist/components/toast/index.d.ts +3 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toast/toast.svelte.d.ts +22 -0
- package/dist/components/toast/toast.svelte.js +18 -0
- package/dist/components/tooltip/Tooltip.d.ts +23 -0
- package/dist/components/tooltip/Tooltip.js +1 -0
- package/dist/components/tooltip/Tooltip.svelte +30 -0
- package/dist/components/tooltip/Tooltip.svelte.d.ts +4 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/user-avatar-with-menu/UserAvatarWithMenu.svelte +48 -69
- package/dist/index.d.ts +19 -2
- package/dist/index.js +12 -0
- package/dist/llms/accordion.md +90 -0
- package/dist/llms/ai.md +110 -0
- package/dist/llms/alert.md +29 -0
- package/dist/llms/avatar.md +34 -0
- package/dist/llms/badge.md +31 -0
- package/dist/llms/brand-logo.md +30 -0
- package/dist/llms/button.md +37 -0
- package/dist/llms/card.md +32 -0
- package/dist/llms/checkbox.md +35 -0
- package/dist/llms/colors.md +161 -0
- package/dist/llms/combobox.md +40 -0
- package/dist/llms/command.md +7 -0
- package/dist/llms/date-range-picker.md +36 -0
- package/dist/llms/dialog.md +45 -0
- package/dist/llms/drawer.md +30 -0
- package/dist/llms/dropdown-menu.md +112 -0
- package/dist/llms/fonts.md +7 -0
- package/dist/llms/header.md +26 -0
- package/dist/llms/icons.md +43 -0
- package/dist/llms/index.md +65 -0
- package/dist/llms/input.md +37 -0
- package/dist/llms/label.md +30 -0
- package/dist/llms/language-picker-button.md +30 -0
- package/dist/llms/light-dark-toggle.md +26 -0
- package/dist/llms/marketing.md +95 -0
- package/dist/llms/popover-responsive.md +32 -0
- package/dist/llms/popover.md +40 -0
- package/dist/llms/select.md +44 -0
- package/dist/llms/side-navigation.md +30 -0
- package/dist/llms/skeleton.md +28 -0
- package/dist/llms/slider.md +36 -0
- package/dist/llms/spinner.md +25 -0
- package/dist/llms/star-rating.md +31 -0
- package/dist/llms/switch.md +33 -0
- package/dist/llms/table.md +30 -0
- package/dist/llms/tabs.md +92 -0
- package/dist/llms/tera-ui-context.md +30 -0
- package/dist/llms/text-area.md +39 -0
- package/dist/llms/toast.md +7 -0
- package/dist/llms/tooltip.md +32 -0
- package/dist/llms/user-avatar-with-menu.md +28 -0
- package/dist/paraglide/README.md +72 -3
- package/dist/paraglide/messages/text_account_settings.d.ts +14 -2
- package/dist/paraglide/messages/text_account_settings.js +53 -58
- package/dist/paraglide/messages/text_calces_documentation.d.ts +14 -2
- package/dist/paraglide/messages/text_calces_documentation.js +53 -58
- package/dist/paraglide/messages/text_calces_scientific_calculator.d.ts +14 -2
- package/dist/paraglide/messages/text_calces_scientific_calculator.js +53 -58
- package/dist/paraglide/messages/text_currency_converter.d.ts +14 -2
- package/dist/paraglide/messages/text_currency_converter.js +53 -58
- package/dist/paraglide/messages/text_logout.d.ts +14 -2
- package/dist/paraglide/messages/text_logout.js +53 -58
- package/dist/paraglide/messages/text_select_language.d.ts +14 -2
- package/dist/paraglide/messages/text_select_language.js +53 -58
- package/dist/paraglide/messages/text_unit_converter.d.ts +14 -2
- package/dist/paraglide/messages/text_unit_converter.js +53 -58
- package/dist/paraglide/registry.d.ts +13 -0
- package/dist/paraglide/registry.js +15 -0
- package/dist/paraglide/runtime.d.ts +243 -126
- package/dist/paraglide/runtime.js +473 -148
- package/dist/paraglide/server.d.ts +13 -20
- package/dist/paraglide/server.js +92 -40
- package/dist/stories/ComponentOverview.stories.svelte +533 -0
- package/dist/stories/ComponentOverview.stories.svelte.d.ts +6 -0
- package/dist/themes/tera-ui-base.css +242 -77
- package/dist/themes/theme-ai.css +100 -0
- package/dist/themes/theme-marketing.css +91 -0
- package/dist/themes/theme-professional.css +41 -0
- package/package.json +35 -29
- package/dist/tera-i18n/projects/tera-system-ui/project.inlang/.meta.json +0 -3
- package/dist/tera-i18n/projects/tera-system-ui/project.inlang/README.md +0 -103
- package/dist/tera-i18n/projects/tera-system-ui/project.inlang/project_id +0 -1
- package/dist/themes/tw-preset.cjs +0 -160
- package/dist/themes/tw-preset.d.cts +0 -157
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the strategy to use for a specific URL.
|
|
3
|
+
*
|
|
4
|
+
* If no route strategy matches (or the matching rule is `exclude: true`),
|
|
5
|
+
* the global strategy is returned.
|
|
6
|
+
*
|
|
7
|
+
* @param {string | URL} url
|
|
8
|
+
* @returns {typeof strategy}
|
|
9
|
+
*/
|
|
10
|
+
export function getStrategyForUrl(url: string | URL): typeof strategy;
|
|
11
|
+
/**
|
|
12
|
+
* Returns whether the given URL is excluded from middleware i18n processing.
|
|
13
|
+
*
|
|
14
|
+
* @param {string | URL} url
|
|
15
|
+
* @returns {boolean}
|
|
16
|
+
*/
|
|
17
|
+
export function isExcludedByRouteStrategy(url: string | URL): boolean;
|
|
1
18
|
/**
|
|
2
19
|
* Sets the server side async local storage.
|
|
3
20
|
*
|
|
@@ -10,7 +27,36 @@
|
|
|
10
27
|
*/
|
|
11
28
|
export function overwriteServerAsyncLocalStorage(value: ParaglideAsyncLocalStorage | undefined): void;
|
|
12
29
|
/**
|
|
13
|
-
*
|
|
30
|
+
* Resolve locale for a given URL using route-aware strategies.
|
|
31
|
+
*
|
|
32
|
+
* @param {string | URL} url
|
|
33
|
+
* @returns {Locale}
|
|
34
|
+
*/
|
|
35
|
+
export function getLocaleForUrl(url: string | URL): Locale;
|
|
36
|
+
/**
|
|
37
|
+
* Get writing direction for a locale.
|
|
38
|
+
*
|
|
39
|
+
* Uses `Intl.Locale` text info when available and falls back to a
|
|
40
|
+
* language-based RTL check for runtimes without `getTextInfo()`.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* getTextDirection(); // "ltr" or "rtl" for current locale
|
|
44
|
+
* getTextDirection("ar"); // "rtl"
|
|
45
|
+
* getTextDirection("en"); // "ltr"
|
|
46
|
+
*
|
|
47
|
+
* @param {string} [locale] - Target locale. If not provided, uses `getLocale()`
|
|
48
|
+
* @returns {"ltr" | "rtl"}
|
|
49
|
+
*/
|
|
50
|
+
export function getTextDirection(locale?: string): "ltr" | "rtl";
|
|
51
|
+
/**
|
|
52
|
+
* Coerces a locale-like string to the canonical locale value used by the runtime.
|
|
53
|
+
*
|
|
54
|
+
* @param {unknown} value
|
|
55
|
+
* @returns {Locale | undefined}
|
|
56
|
+
*/
|
|
57
|
+
export function toLocale(value: unknown): Locale | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Check if something is an available locale with the canonical project casing.
|
|
14
60
|
*
|
|
15
61
|
* @example
|
|
16
62
|
* if (isLocale(params.locale)) {
|
|
@@ -19,32 +65,61 @@ export function overwriteServerAsyncLocalStorage(value: ParaglideAsyncLocalStora
|
|
|
19
65
|
* setLocale('en');
|
|
20
66
|
* }
|
|
21
67
|
*
|
|
22
|
-
*
|
|
68
|
+
* Use `toLocale()` when you want case-insensitive matching and canonicalization.
|
|
69
|
+
*
|
|
70
|
+
* @param {unknown} locale
|
|
23
71
|
* @returns {locale is Locale}
|
|
24
72
|
*/
|
|
25
|
-
export function isLocale(locale:
|
|
73
|
+
export function isLocale(locale: unknown): locale is Locale;
|
|
26
74
|
/**
|
|
27
|
-
* Asserts that the input
|
|
75
|
+
* Asserts that the input can be normalized to a locale.
|
|
28
76
|
*
|
|
29
|
-
* @param {
|
|
30
|
-
* @returns {Locale} The input
|
|
77
|
+
* @param {unknown} input - The input to check.
|
|
78
|
+
* @returns {Locale} The input normalized to a Locale.
|
|
31
79
|
* @throws {Error} If the input is not a locale.
|
|
32
80
|
*/
|
|
33
|
-
export function assertIsLocale(input:
|
|
81
|
+
export function assertIsLocale(input: unknown): Locale;
|
|
34
82
|
/**
|
|
35
83
|
* Extracts a cookie from the document.
|
|
36
84
|
*
|
|
37
85
|
* Will return undefined if the document is not available or if the cookie is not set.
|
|
38
86
|
* The `document` object is not available in server-side rendering, so this function should not be called in that context.
|
|
39
87
|
*
|
|
40
|
-
* @returns {
|
|
88
|
+
* @returns {Locale | undefined}
|
|
89
|
+
*/
|
|
90
|
+
export function extractLocaleFromCookie(): Locale | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Extracts a locale from the accept-language header.
|
|
93
|
+
*
|
|
94
|
+
* Use the function on the server to extract the locale
|
|
95
|
+
* from the accept-language header that is sent by the client.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* const locale = extractLocaleFromHeader(request);
|
|
99
|
+
*
|
|
100
|
+
* @param {Request} request - The request object to extract the locale from.
|
|
101
|
+
* @returns {Locale | undefined} The negotiated preferred language.
|
|
102
|
+
*/
|
|
103
|
+
export function extractLocaleFromHeader(request: Request): Locale | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Negotiates a preferred language from navigator.languages.
|
|
106
|
+
*
|
|
107
|
+
* Use the function on the client to extract the locale
|
|
108
|
+
* from the navigator.languages array.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* const locale = extractLocaleFromNavigator();
|
|
112
|
+
*
|
|
113
|
+
* @returns {Locale | undefined}
|
|
41
114
|
*/
|
|
42
|
-
export function extractLocaleFromCookie(): string | undefined;
|
|
43
|
-
export function extractLocaleFromHeader(request: Request): Locale;
|
|
44
115
|
export function extractLocaleFromNavigator(): Locale | undefined;
|
|
45
116
|
/**
|
|
46
117
|
* Extracts the locale from a given URL using native URLPattern.
|
|
47
118
|
*
|
|
119
|
+
* The built-in default `/:locale/...` routing is case-insensitive because it
|
|
120
|
+
* canonicalizes the first path segment with `toLocale()`. Custom `urlPatterns`
|
|
121
|
+
* keep URLPattern's normal exact matching semantics for path segments.
|
|
122
|
+
*
|
|
48
123
|
* @param {URL|string} url - The full URL from which to extract the locale.
|
|
49
124
|
* @returns {Locale|undefined} The extracted locale, or undefined if no locale is found.
|
|
50
125
|
*/
|
|
@@ -89,12 +164,12 @@ export function extractLocaleFromUrl(url: URL | string): Locale | undefined;
|
|
|
89
164
|
* ```
|
|
90
165
|
*
|
|
91
166
|
* @param {string | URL} url - The URL to localize. If string, must be absolute.
|
|
92
|
-
* @param {
|
|
93
|
-
* @param {
|
|
167
|
+
* @param {object} [options] - Options for localization
|
|
168
|
+
* @param {Locale} [options.locale] - Target locale. If not provided, uses getLocale()
|
|
94
169
|
* @returns {URL} The localized URL, always absolute
|
|
95
170
|
*/
|
|
96
171
|
export function localizeUrl(url: string | URL, options?: {
|
|
97
|
-
locale?:
|
|
172
|
+
locale?: "id" | "no" | "ar" | "bg" | "bn" | "ca" | "cs" | "da" | "de" | "el" | "en" | "es" | "fi" | "fr" | "he" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "lv" | "ms" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sq" | "sr" | "sv" | "sw" | "ta" | "te" | "th" | "tl" | "tr" | "uk" | "vi" | "zh-CN" | "zh-TW" | undefined;
|
|
98
173
|
}): URL;
|
|
99
174
|
/**
|
|
100
175
|
* Low-level URL de-localization function, primarily used in server contexts.
|
|
@@ -136,23 +211,30 @@ export function localizeUrl(url: string | URL, options?: {
|
|
|
136
211
|
* @returns {URL} The de-localized URL, always absolute
|
|
137
212
|
*/
|
|
138
213
|
export function deLocalizeUrl(url: string | URL): URL;
|
|
214
|
+
/**
|
|
215
|
+
* Aggregates named groups from various parts of the URLPattern match result.
|
|
216
|
+
*
|
|
217
|
+
*
|
|
218
|
+
* @param {any} match - The URLPattern match result object.
|
|
219
|
+
* @returns {Record<string, string | null | undefined>} An object containing all named groups from the match.
|
|
220
|
+
*/
|
|
139
221
|
export function aggregateGroups(match: any): Record<string, string | null | undefined>;
|
|
140
222
|
/**
|
|
141
223
|
* @typedef {object} ShouldRedirectServerInput
|
|
142
224
|
* @property {Request} request
|
|
143
|
-
* @property {string | URL} [
|
|
144
|
-
* @property {
|
|
225
|
+
* @property {string | URL} [effectiveRequestUrl] - Effective request URL to use for route matching, locale detection with the URL strategy, and redirect targets.
|
|
226
|
+
* @property {Locale} [locale]
|
|
145
227
|
*
|
|
146
228
|
* @typedef {object} ShouldRedirectClientInput
|
|
147
229
|
* @property {undefined} [request]
|
|
148
230
|
* @property {string | URL} [url]
|
|
149
|
-
* @property {
|
|
231
|
+
* @property {Locale} [locale]
|
|
150
232
|
*
|
|
151
233
|
* @typedef {ShouldRedirectServerInput | ShouldRedirectClientInput} ShouldRedirectInput
|
|
152
234
|
*
|
|
153
235
|
* @typedef {object} ShouldRedirectResult
|
|
154
236
|
* @property {boolean} shouldRedirect - Indicates whether the consumer should perform a redirect.
|
|
155
|
-
* @property {
|
|
237
|
+
* @property {Locale} locale - Locale resolved using the configured strategies.
|
|
156
238
|
* @property {URL | undefined} redirectUrl - Destination URL when a redirect is required.
|
|
157
239
|
*/
|
|
158
240
|
/**
|
|
@@ -188,6 +270,23 @@ export function aggregateGroups(match: any): Record<string, string | null | unde
|
|
|
188
270
|
* return render(request, decision.locale);
|
|
189
271
|
* }
|
|
190
272
|
*
|
|
273
|
+
* @example
|
|
274
|
+
* // Server side usage behind a proxy where request.url is not public-facing
|
|
275
|
+
* export async function handle(request) {
|
|
276
|
+
* const effectiveRequestUrl = new URL(request.url);
|
|
277
|
+
* effectiveRequestUrl.protocol = "https:";
|
|
278
|
+
* effectiveRequestUrl.host = "example.com";
|
|
279
|
+
*
|
|
280
|
+
* const decision = await shouldRedirect({
|
|
281
|
+
* request,
|
|
282
|
+
* effectiveRequestUrl,
|
|
283
|
+
* });
|
|
284
|
+
*
|
|
285
|
+
* if (decision.shouldRedirect) {
|
|
286
|
+
* return Response.redirect(decision.redirectUrl, 307);
|
|
287
|
+
* }
|
|
288
|
+
* }
|
|
289
|
+
*
|
|
191
290
|
* @param {ShouldRedirectInput} [input]
|
|
192
291
|
* @returns {Promise<ShouldRedirectResult>}
|
|
193
292
|
*/
|
|
@@ -228,12 +327,12 @@ export function shouldRedirect(input?: ShouldRedirectInput): Promise<ShouldRedir
|
|
|
228
327
|
* which provides more precise control over URL handling.
|
|
229
328
|
*
|
|
230
329
|
* @param {string} href - The href to localize (can be relative or absolute)
|
|
231
|
-
* @param {
|
|
232
|
-
* @param {
|
|
330
|
+
* @param {object} [options] - Options for localization
|
|
331
|
+
* @param {Locale} [options.locale] - Target locale. If not provided, uses `getLocale()`
|
|
233
332
|
* @returns {string} The localized href, relative if input was relative
|
|
234
333
|
*/
|
|
235
334
|
export function localizeHref(href: string, options?: {
|
|
236
|
-
locale?:
|
|
335
|
+
locale?: "id" | "no" | "ar" | "bg" | "bn" | "ca" | "cs" | "da" | "de" | "el" | "en" | "es" | "fi" | "fr" | "he" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "lv" | "ms" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sq" | "sr" | "sv" | "sw" | "ta" | "te" | "th" | "tl" | "tr" | "uk" | "vi" | "zh-CN" | "zh-TW" | undefined;
|
|
237
336
|
}): string;
|
|
238
337
|
/**
|
|
239
338
|
* High-level URL de-localization function optimized for client-side UI usage.
|
|
@@ -328,33 +427,33 @@ export function generateStaticLocalizedUrls(urls: (string | URL)[]): URL[];
|
|
|
328
427
|
/**
|
|
329
428
|
* Checks if the given strategy is a custom strategy.
|
|
330
429
|
*
|
|
331
|
-
* @param {
|
|
430
|
+
* @param {unknown} strategy The name of the custom strategy to validate.
|
|
332
431
|
* Must be a string that starts with "custom-" followed by alphanumeric characters, hyphens, or underscores.
|
|
333
432
|
* @returns {boolean} Returns true if it is a custom strategy, false otherwise.
|
|
334
433
|
*/
|
|
335
|
-
export function isCustomStrategy(strategy:
|
|
434
|
+
export function isCustomStrategy(strategy: unknown): boolean;
|
|
336
435
|
/**
|
|
337
436
|
* Defines a custom strategy that is executed on the server.
|
|
338
437
|
*
|
|
339
438
|
* @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy#write-your-own-strategy
|
|
340
439
|
*
|
|
341
|
-
* @param {
|
|
440
|
+
* @param {string} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.
|
|
342
441
|
* @param {CustomServerStrategyHandler} handler The handler for the custom strategy, which should implement
|
|
343
442
|
* the method getLocale.
|
|
344
443
|
* @returns {void}
|
|
345
444
|
*/
|
|
346
|
-
export function defineCustomServerStrategy(strategy:
|
|
445
|
+
export function defineCustomServerStrategy(strategy: string, handler: CustomServerStrategyHandler): void;
|
|
347
446
|
/**
|
|
348
447
|
* Defines a custom strategy that is executed on the client.
|
|
349
448
|
*
|
|
350
449
|
* @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy#write-your-own-strategy
|
|
351
450
|
*
|
|
352
|
-
* @param {
|
|
451
|
+
* @param {string} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.
|
|
353
452
|
* @param {CustomClientStrategyHandler} handler The handler for the custom strategy, which should implement the
|
|
354
453
|
* methods getLocale and setLocale.
|
|
355
454
|
* @returns {void}
|
|
356
455
|
*/
|
|
357
|
-
export function defineCustomClientStrategy(strategy:
|
|
456
|
+
export function defineCustomClientStrategy(strategy: string, handler: CustomClientStrategyHandler): void;
|
|
358
457
|
/**
|
|
359
458
|
* The project's base locale.
|
|
360
459
|
*
|
|
@@ -385,10 +484,26 @@ export const localStorageKey: string;
|
|
|
385
484
|
* @type {Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>}
|
|
386
485
|
*/
|
|
387
486
|
export const strategy: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>;
|
|
487
|
+
/**
|
|
488
|
+
* Route-level strategy overrides.
|
|
489
|
+
*
|
|
490
|
+
* `match` uses URLPattern syntax.
|
|
491
|
+
*
|
|
492
|
+
* @type {Array<{
|
|
493
|
+
* match: string;
|
|
494
|
+
* strategy?: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>;
|
|
495
|
+
* exclude?: boolean;
|
|
496
|
+
* }>}
|
|
497
|
+
*/
|
|
498
|
+
export const routeStrategies: Array<{
|
|
499
|
+
match: string;
|
|
500
|
+
strategy?: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>;
|
|
501
|
+
exclude?: boolean;
|
|
502
|
+
}>;
|
|
388
503
|
/**
|
|
389
504
|
* The used URL patterns.
|
|
390
505
|
*
|
|
391
|
-
* @type {Array<{ pattern: string, localized: Array<[Locale, string]> }>
|
|
506
|
+
* @type {Array<{ pattern: string, localized: Array<[Locale, string]> }>}
|
|
392
507
|
*/
|
|
393
508
|
export const urlPatterns: Array<{
|
|
394
509
|
pattern: string;
|
|
@@ -416,44 +531,11 @@ export const urlPatterns: Array<{
|
|
|
416
531
|
export let serverAsyncLocalStorage: ParaglideAsyncLocalStorage | undefined;
|
|
417
532
|
export const disableAsyncLocalStorage: false;
|
|
418
533
|
export const experimentalMiddlewareLocaleSplitting: false;
|
|
419
|
-
export const isServer:
|
|
534
|
+
export const isServer: any;
|
|
420
535
|
/** @type {Locale | undefined} */
|
|
421
536
|
export const experimentalStaticLocale: Locale | undefined;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
*
|
|
425
|
-
* The locale is resolved using your configured strategies (URL, cookie, localStorage, etc.)
|
|
426
|
-
* in the order they are defined. In SSR contexts, the locale is retrieved from AsyncLocalStorage
|
|
427
|
-
* which is set by the `paraglideMiddleware()`.
|
|
428
|
-
*
|
|
429
|
-
* @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy - Configure locale detection strategies
|
|
430
|
-
*
|
|
431
|
-
* @example
|
|
432
|
-
* if (getLocale() === 'de') {
|
|
433
|
-
* console.log('Germany 🇩🇪');
|
|
434
|
-
* } else if (getLocale() === 'nl') {
|
|
435
|
-
* console.log('Netherlands 🇳🇱');
|
|
436
|
-
* }
|
|
437
|
-
*
|
|
438
|
-
* @type {() => Locale}
|
|
439
|
-
*/
|
|
440
|
-
export let getLocale: () => Locale;
|
|
441
|
-
/**
|
|
442
|
-
* Overwrite the `getLocale()` function.
|
|
443
|
-
*
|
|
444
|
-
* Use this function to overwrite how the locale is resolved. This is useful
|
|
445
|
-
* for custom locale resolution or advanced use cases like SSG with concurrent rendering.
|
|
446
|
-
*
|
|
447
|
-
* @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy
|
|
448
|
-
*
|
|
449
|
-
* @example
|
|
450
|
-
* overwriteGetLocale(() => {
|
|
451
|
-
* return Cookies.get('locale') ?? baseLocale
|
|
452
|
-
* });
|
|
453
|
-
*
|
|
454
|
-
* @type {(fn: () => Locale) => void}
|
|
455
|
-
*/
|
|
456
|
-
export const overwriteGetLocale: (fn: () => Locale) => void;
|
|
537
|
+
export function getLocale(): Locale;
|
|
538
|
+
export function overwriteGetLocale(fn: () => Locale): void;
|
|
457
539
|
/**
|
|
458
540
|
* @typedef {(newLocale: Locale, options?: { reload?: boolean }) => void | Promise<void>} SetLocaleFn
|
|
459
541
|
*/
|
|
@@ -490,64 +572,12 @@ export function overwriteSetLocale(fn: SetLocaleFn): void;
|
|
|
490
572
|
* @type {() => string}
|
|
491
573
|
*/
|
|
492
574
|
export let getUrlOrigin: () => string;
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
* @type {(fn: () => string) => void}
|
|
500
|
-
*/
|
|
501
|
-
export let overwriteGetUrlOrigin: (fn: () => string) => void;
|
|
502
|
-
/**
|
|
503
|
-
* Extracts a locale from a request.
|
|
504
|
-
*
|
|
505
|
-
* Use the function on the server to extract the locale
|
|
506
|
-
* from a request.
|
|
507
|
-
*
|
|
508
|
-
* The function goes through the strategies in the order
|
|
509
|
-
* they are defined. If a strategy returns an invalid locale,
|
|
510
|
-
* it will fall back to the next strategy.
|
|
511
|
-
*
|
|
512
|
-
* Note: Custom server strategies are not supported in this synchronous version.
|
|
513
|
-
* Use `extractLocaleFromRequestAsync` if you need custom server strategies with async getLocale methods.
|
|
514
|
-
*
|
|
515
|
-
* @example
|
|
516
|
-
* const locale = extractLocaleFromRequest(request);
|
|
517
|
-
*
|
|
518
|
-
* @type {(request: Request) => Locale}
|
|
519
|
-
*/
|
|
520
|
-
export const extractLocaleFromRequest: (request: Request) => Locale;
|
|
521
|
-
/**
|
|
522
|
-
* Asynchronously extracts a locale from a request.
|
|
523
|
-
*
|
|
524
|
-
* This function supports async custom server strategies, unlike the synchronous
|
|
525
|
-
* `extractLocaleFromRequest`. Use this function when you have custom server strategies
|
|
526
|
-
* that need to perform asynchronous operations (like database calls) in their getLocale method.
|
|
527
|
-
*
|
|
528
|
-
* The function first processes any custom server strategies asynchronously, then falls back
|
|
529
|
-
* to the synchronous `extractLocaleFromRequest` for all other strategies.
|
|
530
|
-
*
|
|
531
|
-
* @see {@link https://github.com/opral/inlang-paraglide-js/issues/527#issuecomment-2978151022}
|
|
532
|
-
*
|
|
533
|
-
* @example
|
|
534
|
-
* // Basic usage
|
|
535
|
-
* const locale = await extractLocaleFromRequestAsync(request);
|
|
536
|
-
*
|
|
537
|
-
* @example
|
|
538
|
-
* // With custom async server strategy
|
|
539
|
-
* defineCustomServerStrategy("custom-database", {
|
|
540
|
-
* getLocale: async (request) => {
|
|
541
|
-
* const userId = extractUserIdFromRequest(request);
|
|
542
|
-
* return await getUserLocaleFromDatabase(userId);
|
|
543
|
-
* }
|
|
544
|
-
* });
|
|
545
|
-
*
|
|
546
|
-
* const locale = await extractLocaleFromRequestAsync(request);
|
|
547
|
-
*
|
|
548
|
-
* @type {(request: Request) => Promise<Locale>}
|
|
549
|
-
*/
|
|
550
|
-
export const extractLocaleFromRequestAsync: (request: Request) => Promise<Locale>;
|
|
575
|
+
export function overwriteGetUrlOrigin(fn: () => string): void;
|
|
576
|
+
export function extractLocaleFromRequest(request: Request, options?: ExtractLocaleFromRequestOptions): Locale;
|
|
577
|
+
export function extractLocaleFromRequestWithStrategies(request: Request, strategies: typeof strategy, url?: string | URL): Locale;
|
|
578
|
+
export function extractLocaleFromRequestAsync(request: Request, options?: {
|
|
579
|
+
effectiveRequestUrl?: string | URL;
|
|
580
|
+
}): Promise<Locale>;
|
|
551
581
|
/**
|
|
552
582
|
* @typedef {"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage"} BuiltInStrategy
|
|
553
583
|
*/
|
|
@@ -572,7 +602,10 @@ export const customServerStrategies: Map<string, CustomServerStrategyHandler>;
|
|
|
572
602
|
export const customClientStrategies: Map<string, CustomClientStrategyHandler>;
|
|
573
603
|
export type ShouldRedirectServerInput = {
|
|
574
604
|
request: Request;
|
|
575
|
-
|
|
605
|
+
/**
|
|
606
|
+
* - Effective request URL to use for route matching, locale detection with the URL strategy, and redirect targets.
|
|
607
|
+
*/
|
|
608
|
+
effectiveRequestUrl?: string | URL | undefined;
|
|
576
609
|
locale?: "id" | "no" | "ar" | "bg" | "bn" | "ca" | "cs" | "da" | "de" | "el" | "en" | "es" | "fi" | "fr" | "he" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "lv" | "ms" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sq" | "sr" | "sv" | "sw" | "ta" | "te" | "th" | "tl" | "tr" | "uk" | "vi" | "zh-CN" | "zh-TW" | undefined;
|
|
577
610
|
};
|
|
578
611
|
export type ShouldRedirectClientInput = {
|
|
@@ -589,7 +622,7 @@ export type ShouldRedirectResult = {
|
|
|
589
622
|
/**
|
|
590
623
|
* - Locale resolved using the configured strategies.
|
|
591
624
|
*/
|
|
592
|
-
locale:
|
|
625
|
+
locale: Locale;
|
|
593
626
|
/**
|
|
594
627
|
* - Destination URL when a redirect is required.
|
|
595
628
|
*/
|
|
@@ -610,6 +643,12 @@ export type ParaglideAsyncLocalStorage = {
|
|
|
610
643
|
export type SetLocaleFn = (newLocale: Locale, options?: {
|
|
611
644
|
reload?: boolean;
|
|
612
645
|
}) => void | Promise<void>;
|
|
646
|
+
export type ExtractLocaleFromRequestOptions = {
|
|
647
|
+
/**
|
|
648
|
+
* - Effective request URL to use for route matching and locale detection with the URL strategy.
|
|
649
|
+
*/
|
|
650
|
+
effectiveRequestUrl?: string | URL | undefined;
|
|
651
|
+
};
|
|
613
652
|
export type BuiltInStrategy = "cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage";
|
|
614
653
|
export type CustomStrategy = `custom_${string}`;
|
|
615
654
|
export type Strategy = BuiltInStrategy | CustomStrategy;
|
|
@@ -628,14 +667,92 @@ export type Locale = (typeof locales)[number];
|
|
|
628
667
|
/**
|
|
629
668
|
* A branded type representing a localized string.
|
|
630
669
|
*
|
|
631
|
-
* Message functions return this type instead of
|
|
670
|
+
* Message functions return this type instead of \`string\`, enabling TypeScript
|
|
632
671
|
* to distinguish translated strings from regular strings at compile time.
|
|
633
672
|
* This allows you to enforce that only properly localized content is used
|
|
634
673
|
* in your UI components.
|
|
635
674
|
*
|
|
636
|
-
* Since
|
|
637
|
-
* backward compatible—you can pass it anywhere a
|
|
675
|
+
* Since \`LocalizedString\` is a branded subtype of \`string\`, it remains fully
|
|
676
|
+
* backward compatible—you can pass it anywhere a \`string\` is expected.
|
|
638
677
|
*/
|
|
639
678
|
export type LocalizedString = string & {
|
|
640
679
|
readonly __brand: "LocalizedString";
|
|
641
680
|
};
|
|
681
|
+
/**
|
|
682
|
+
* A single markup option passed to a tag instance.
|
|
683
|
+
*/
|
|
684
|
+
export type MessageMarkupOption = {
|
|
685
|
+
name: string;
|
|
686
|
+
value: unknown;
|
|
687
|
+
};
|
|
688
|
+
/**
|
|
689
|
+
* A single static markup attribute attached to a tag instance.
|
|
690
|
+
*/
|
|
691
|
+
export type MessageMarkupAttribute = {
|
|
692
|
+
name: string;
|
|
693
|
+
value: string | true;
|
|
694
|
+
};
|
|
695
|
+
/**
|
|
696
|
+
* Record of markup options for a tag instance.
|
|
697
|
+
*/
|
|
698
|
+
export type MessageMarkupOptions = Record<string, unknown>;
|
|
699
|
+
/**
|
|
700
|
+
* Record of markup attributes for a tag instance.
|
|
701
|
+
*/
|
|
702
|
+
export type MessageMarkupAttributes = Record<string, string | true>;
|
|
703
|
+
/**
|
|
704
|
+
* Type-level schema for a single markup tag.
|
|
705
|
+
*/
|
|
706
|
+
export type MessageMarkupTag = {
|
|
707
|
+
options: MessageMarkupOptions;
|
|
708
|
+
attributes: MessageMarkupAttributes;
|
|
709
|
+
children: boolean;
|
|
710
|
+
};
|
|
711
|
+
/**
|
|
712
|
+
* Type-level schema for all markup tags in a message.
|
|
713
|
+
*/
|
|
714
|
+
export type MessageMarkupSchema = Record<string, MessageMarkupTag>;
|
|
715
|
+
/**
|
|
716
|
+
* Type-only metadata attached to compiled message functions.
|
|
717
|
+
*/
|
|
718
|
+
export type MessageMetadata<Inputs, Options, Markup extends MessageMarkupSchema = MessageMarkupSchema> = {
|
|
719
|
+
readonly __paraglide?: {
|
|
720
|
+
inputs: Inputs;
|
|
721
|
+
options: Options;
|
|
722
|
+
markup: Markup;
|
|
723
|
+
};
|
|
724
|
+
};
|
|
725
|
+
/**
|
|
726
|
+
* A compiled, framework-neutral message part.
|
|
727
|
+
*/
|
|
728
|
+
export type MessagePart = {
|
|
729
|
+
type: "text";
|
|
730
|
+
value: string;
|
|
731
|
+
} | {
|
|
732
|
+
type: "markup-start";
|
|
733
|
+
name: string;
|
|
734
|
+
options: MessageMarkupOptions;
|
|
735
|
+
attributes: MessageMarkupAttributes;
|
|
736
|
+
} | {
|
|
737
|
+
type: "markup-end";
|
|
738
|
+
name: string;
|
|
739
|
+
options: MessageMarkupOptions;
|
|
740
|
+
attributes: MessageMarkupAttributes;
|
|
741
|
+
} | {
|
|
742
|
+
type: "markup-standalone";
|
|
743
|
+
name: string;
|
|
744
|
+
options: MessageMarkupOptions;
|
|
745
|
+
attributes: MessageMarkupAttributes;
|
|
746
|
+
};
|
|
747
|
+
/**
|
|
748
|
+
* A message function is a message for a specific locale.
|
|
749
|
+
*/
|
|
750
|
+
export type MessageFunction = (inputs?: Record<string, never>) => LocalizedString;
|
|
751
|
+
/**
|
|
752
|
+
* A message bundle function that selects the message to be returned.
|
|
753
|
+
*
|
|
754
|
+
* Uses `getLocale()` under the hood to determine the locale with an option.
|
|
755
|
+
*/
|
|
756
|
+
export type MessageBundleFunction<T extends string> = (params: Record<string, never>, options: {
|
|
757
|
+
locale: T;
|
|
758
|
+
}) => LocalizedString;
|