@intlayer/svelte-i18n 9.7.0 → 9.7.1
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/esm/configuration.mjs +1 -2
- package/dist/esm/createMessageFormatter.mjs +1 -2
- package/dist/esm/formatters.mjs +1 -2
- package/dist/esm/helpers.mjs +1 -2
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/locale.mjs +1 -2
- package/dist/esm/plugin/index.mjs +1 -2
- package/dist/esm/registryLookup.mjs +1 -2
- package/dist/esm/runtimeMessages.mjs +1 -2
- package/dist/esm/stores.mjs +4 -5
- package/dist/esm/useDictionary.mjs +2 -3
- package/dist/esm/useDictionaryDynamic.mjs +1 -2
- package/dist/types/configuration.d.ts +0 -2
- package/dist/types/configuration.d.ts.map +1 -1
- package/dist/types/createMessageFormatter.d.ts +0 -2
- package/dist/types/createMessageFormatter.d.ts.map +1 -1
- package/dist/types/formatters.d.ts +0 -2
- package/dist/types/formatters.d.ts.map +1 -1
- package/dist/types/helpers.d.ts +1 -2
- package/dist/types/helpers.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/locale.d.ts +0 -2
- package/dist/types/locale.d.ts.map +1 -1
- package/dist/types/plugin/index.d.ts +0 -2
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/registryLookup.d.ts +0 -2
- package/dist/types/registryLookup.d.ts.map +1 -1
- package/dist/types/runtimeMessages.d.ts +1 -2
- package/dist/types/runtimeMessages.d.ts.map +1 -1
- package/dist/types/stores.d.ts +0 -2
- package/dist/types/stores.d.ts.map +1 -1
- package/dist/types/types.d.ts +0 -2
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/useDictionary.d.ts +0 -2
- package/dist/types/useDictionary.d.ts.map +1 -1
- package/dist/types/useDictionaryDynamic.d.ts +0 -2
- package/dist/types/useDictionaryDynamic.d.ts.map +1 -1
- package/package.json +12 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { internationalization } from "@intlayer/config/built";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/configuration.ts
|
|
4
4
|
/** svelte-i18n's built-in named formats (intl-messageformat defaults). */
|
|
5
5
|
const defaultFormats = {
|
|
6
6
|
number: {
|
|
@@ -93,6 +93,5 @@ const setRuntimeOptions = (options) => {
|
|
|
93
93
|
};
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
//#endregion
|
|
97
96
|
export { configDefaultLocale, configLocales, defaultFormats, runtimeOptions, setRuntimeOptions };
|
|
98
97
|
//# sourceMappingURL=configuration.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { configDefaultLocale, runtimeOptions } from "./configuration.mjs";
|
|
2
2
|
import { interpolateMessage, resolveMessageNodeToString } from "@intlayer/core/messageFormat";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/createMessageFormatter.ts
|
|
5
5
|
/**
|
|
6
6
|
* Whether a looked-up value can be rendered as a message: a string, an
|
|
7
7
|
* interpreted callable, or an intlayer node (compiled runtime ICU) — not a
|
|
@@ -44,6 +44,5 @@ const createMessageFormatter = (activeLocale, lookup) => (idOrMessage, options)
|
|
|
44
44
|
return defaultMessage === void 0 ? id : interpolateMessage(defaultMessage, values, targetLocale);
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
//#endregion
|
|
48
47
|
export { createMessageFormatter };
|
|
49
48
|
//# sourceMappingURL=createMessageFormatter.mjs.map
|
package/dist/esm/formatters.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { configDefaultLocale, runtimeOptions } from "./configuration.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/formatters.ts
|
|
4
4
|
const numberFormatters = /* @__PURE__ */ new Map();
|
|
5
5
|
const dateTimeFormatters = /* @__PURE__ */ new Map();
|
|
6
6
|
/** Cache key of one formatter: locale plus its serialised options. */
|
|
@@ -48,6 +48,5 @@ const getDateFormatter = createDateTimeFormatterFactory("date", "short");
|
|
|
48
48
|
/** Memoized `Intl.DateTimeFormat` honouring named `time` formats. */
|
|
49
49
|
const getTimeFormatter = createDateTimeFormatterFactory("time", "short");
|
|
50
50
|
|
|
51
|
-
//#endregion
|
|
52
51
|
export { getDateFormatter, getNumberFormatter, getTimeFormatter };
|
|
53
52
|
//# sourceMappingURL=formatters.mjs.map
|
package/dist/esm/helpers.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { locale } from "./locale.mjs";
|
|
|
3
3
|
import { dictionary, setMessageCompiler } from "./runtimeMessages.mjs";
|
|
4
4
|
import { createMessageResolver, icuToIntlayerFormatter } from "@intlayer/core/messageFormat";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/helpers.ts
|
|
7
7
|
/**
|
|
8
8
|
* Configures fallback locale, formats and missing-message handling, then
|
|
9
9
|
* activates `initialLocale` (or keeps intlayer's current locale).
|
|
@@ -81,6 +81,5 @@ const getLocaleFromQueryString = (key) => typeof window === "undefined" ? null :
|
|
|
81
81
|
/** Reads the `key` parameter of the current URL hash (`#lang=fr`). */
|
|
82
82
|
const getLocaleFromHash = (key) => typeof window === "undefined" ? null : readSearchParam(window.location.hash.slice(1), key);
|
|
83
83
|
|
|
84
|
-
//#endregion
|
|
85
84
|
export { addMessages, defineMessages, getLocaleFromHash, getLocaleFromHostname, getLocaleFromNavigator, getLocaleFromPathname, getLocaleFromQueryString, getMessageFormatter, init, register, unwrapFunctionStore, waitLocale };
|
|
86
85
|
//# sourceMappingURL=helpers.mjs.map
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { getDateFormatter, getNumberFormatter, getTimeFormatter } from "./formatters.mjs";
|
|
2
|
+
import { addMessages, defineMessages, getLocaleFromHash, getLocaleFromHostname, getLocaleFromNavigator, getLocaleFromPathname, getLocaleFromQueryString, getMessageFormatter, init, register, unwrapFunctionStore, waitLocale } from "./helpers.mjs";
|
|
1
3
|
import { isLoading, locale, locales } from "./locale.mjs";
|
|
2
4
|
import { dictionary } from "./runtimeMessages.mjs";
|
|
3
|
-
import {
|
|
5
|
+
import { _, date, format, json, number, t, time } from "./stores.mjs";
|
|
4
6
|
import { useDictionary } from "./useDictionary.mjs";
|
|
5
7
|
import { useDictionaryDynamic } from "./useDictionaryDynamic.mjs";
|
|
6
|
-
import { getDateFormatter, getNumberFormatter, getTimeFormatter } from "./formatters.mjs";
|
|
7
|
-
import { _, date, format, json, number, t, time } from "./stores.mjs";
|
|
8
8
|
|
|
9
9
|
export { _, addMessages, date, defineMessages, dictionary, format, getDateFormatter, getLocaleFromHash, getLocaleFromHostname, getLocaleFromNavigator, getLocaleFromPathname, getLocaleFromQueryString, getMessageFormatter, getNumberFormatter, getTimeFormatter, init, isLoading, json, locale, locales, number, register, t, time, unwrapFunctionStore, useDictionary, useDictionaryDynamic, waitLocale };
|
package/dist/esm/locale.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { configLocales } from "./configuration.mjs";
|
|
|
2
2
|
import { derived, readable, writable } from "svelte/store";
|
|
3
3
|
import { intlayerStore } from "svelte-intlayer";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/locale.ts
|
|
6
6
|
const currentLocale = derived(intlayerStore, ($store) => $store.locale);
|
|
7
7
|
let currentLocaleValue;
|
|
8
8
|
currentLocale.subscribe((value) => {
|
|
@@ -30,6 +30,5 @@ const locales = readable(configLocales);
|
|
|
30
30
|
*/
|
|
31
31
|
const isLoading = writable(false);
|
|
32
32
|
|
|
33
|
-
//#endregion
|
|
34
33
|
export { isLoading, locale, locales };
|
|
35
34
|
//# sourceMappingURL=locale.mjs.map
|
|
@@ -6,7 +6,7 @@ import { getConfiguration } from "@intlayer/config/node";
|
|
|
6
6
|
import { runOnce } from "@intlayer/engine/utils";
|
|
7
7
|
import { intlayer } from "vite-intlayer";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/plugin/index.ts
|
|
10
10
|
/**
|
|
11
11
|
* A Vite plugin for svelte-i18n compat that wraps vite-intlayer
|
|
12
12
|
* and configures resolve aliases for svelte-i18n.
|
|
@@ -30,6 +30,5 @@ const svelteI18nVitePlugin = (options) => {
|
|
|
30
30
|
return [...Array.isArray(basePlugins) ? basePlugins : [basePlugins], compatPlugin];
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
//#endregion
|
|
34
33
|
export { svelteI18nVitePlugin as default, svelteI18nVitePlugin };
|
|
35
34
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -2,7 +2,7 @@ import { navigatePath } from "@intlayer/core/messageFormat";
|
|
|
2
2
|
import { getIntlayer } from "@intlayer/core/interpreter";
|
|
3
3
|
import { getDictionaries } from "@intlayer/dictionaries-entry";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/registryLookup.ts
|
|
6
6
|
/**
|
|
7
7
|
* Registry-backed message resolution for svelte-i18n ids.
|
|
8
8
|
*
|
|
@@ -52,6 +52,5 @@ const lookupRegistryMessage = (id, locale) => {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
//#endregion
|
|
56
55
|
export { lookupRegistryMessage };
|
|
57
56
|
//# sourceMappingURL=registryLookup.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { navigatePath } from "@intlayer/core/messageFormat";
|
|
2
2
|
import { writable } from "svelte/store";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtimeMessages.ts
|
|
5
5
|
/**
|
|
6
6
|
* `$dictionary` — messages registered at runtime through `addMessages()` /
|
|
7
7
|
* `register()`. Intlayer dictionaries never go through this store.
|
|
@@ -37,6 +37,5 @@ const lookupRuntimeMessage = (messages, targetLocale, id) => {
|
|
|
37
37
|
return compiled;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
//#endregion
|
|
41
40
|
export { dictionary, lookupRuntimeMessage, setMessageCompiler };
|
|
42
41
|
//# sourceMappingURL=runtimeMessages.mjs.map
|
package/dist/esm/stores.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { runtimeOptions } from "./configuration.mjs";
|
|
2
|
-
import { locale } from "./locale.mjs";
|
|
3
|
-
import { dictionary, lookupRuntimeMessage } from "./runtimeMessages.mjs";
|
|
4
|
-
import { lookupRegistryMessage } from "./registryLookup.mjs";
|
|
5
2
|
import { createMessageFormatter } from "./createMessageFormatter.mjs";
|
|
6
3
|
import { getDateFormatter, getNumberFormatter, getTimeFormatter } from "./formatters.mjs";
|
|
4
|
+
import { locale } from "./locale.mjs";
|
|
5
|
+
import { lookupRegistryMessage } from "./registryLookup.mjs";
|
|
6
|
+
import { dictionary, lookupRuntimeMessage } from "./runtimeMessages.mjs";
|
|
7
7
|
import { derived } from "svelte/store";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/stores.ts
|
|
10
10
|
/** Runtime messages win over dictionaries, as `addMessages` overrides. */
|
|
11
11
|
const lookupMessage = (messages, id, targetLocale) => lookupRuntimeMessage(messages, targetLocale, id) ?? lookupRegistryMessage(id, targetLocale);
|
|
12
12
|
/** `$format` / `$_` / `$t` — translates a message id. */
|
|
@@ -31,6 +31,5 @@ const number = derived(locale, ($locale) => (value, options) => getNumberFormatt
|
|
|
31
31
|
...options
|
|
32
32
|
}).format(value));
|
|
33
33
|
|
|
34
|
-
//#endregion
|
|
35
34
|
export { _, date, format, json, number, t, time };
|
|
36
35
|
//# sourceMappingURL=stores.mjs.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { configDefaultLocale } from "./configuration.mjs";
|
|
2
|
-
import { locale } from "./locale.mjs";
|
|
3
2
|
import { createMessageFormatter } from "./createMessageFormatter.mjs";
|
|
3
|
+
import { locale } from "./locale.mjs";
|
|
4
4
|
import { navigatePath } from "@intlayer/core/messageFormat";
|
|
5
5
|
import { derived } from "svelte/store";
|
|
6
6
|
import { getDictionary } from "@intlayer/core/interpreter";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/useDictionary.ts
|
|
9
9
|
/** Joins an optional key prefix and a relative id. */
|
|
10
10
|
const toPrefixedId = (id, keyPrefix) => keyPrefix ? `${keyPrefix}.${id}` : id;
|
|
11
11
|
/**
|
|
@@ -41,6 +41,5 @@ const useDictionary = (dictionary, keyPrefix) => createDictionaryStores(derived(
|
|
|
41
41
|
readContent: (targetLocale) => getDictionary(dictionary, targetLocale)
|
|
42
42
|
})), keyPrefix);
|
|
43
43
|
|
|
44
|
-
//#endregion
|
|
45
44
|
export { createDictionaryStores, toPrefixedId, useDictionary };
|
|
46
45
|
//# sourceMappingURL=useDictionary.mjs.map
|
|
@@ -4,7 +4,7 @@ import { createDictionaryStores } from "./useDictionary.mjs";
|
|
|
4
4
|
import { derived } from "svelte/store";
|
|
5
5
|
import { getDictionary } from "@intlayer/core/interpreter";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/useDictionaryDynamic.ts
|
|
8
8
|
/**
|
|
9
9
|
* Per-locale lazy variant of `useDictionary`: only the active locale's
|
|
10
10
|
* dictionary is fetched. Until it arrives, ids resolve to their `default`
|
|
@@ -45,6 +45,5 @@ const useDictionaryDynamic = (dictionaryLoaders, _dictionaryKey, keyPrefix) => {
|
|
|
45
45
|
return createDictionaryStores(contentStore, keyPrefix);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
//#endregion
|
|
49
48
|
export { useDictionaryDynamic };
|
|
50
49
|
//# sourceMappingURL=useDictionaryDynamic.mjs.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ConfigureOptions, Formats } from "./types.js";
|
|
2
|
-
//#region src/configuration.d.ts
|
|
3
2
|
/** svelte-i18n's built-in named formats (intl-messageformat defaults). */
|
|
4
3
|
export declare const defaultFormats: Formats;
|
|
5
4
|
/** Locale used when nothing else is set: intlayer's configured default. */
|
|
@@ -14,5 +13,4 @@ export declare const runtimeOptions: Omit<ConfigureOptions, 'formats'> & {
|
|
|
14
13
|
* Applies `init()` options, merging custom formats over the defaults.
|
|
15
14
|
*/
|
|
16
15
|
export declare const setRuntimeOptions: (options: Partial<ConfigureOptions>) => void;
|
|
17
|
-
//#endregion
|
|
18
16
|
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","names":[],"sources":["../../src/configuration.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","names":[],"sources":["../../src/configuration.ts"],"mappings":";;qBAIa,gBAAgB;;qBAgChB;;qBAIA;;qBAKA,gBAAgB,KAAK;EAChC,SAAS;;;;;qBASE,oBAAiB,SAAa,QAAQ"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MessageFormatter } from "./types.js";
|
|
2
|
-
//#region src/createMessageFormatter.d.ts
|
|
3
2
|
/** Reads the raw message (string, node or subtree) of an id for a locale. */
|
|
4
3
|
export type MessageLookup = (id: string, locale: string) => unknown;
|
|
5
4
|
/**
|
|
@@ -14,5 +13,4 @@ export type MessageLookup = (id: string, locale: string) => unknown;
|
|
|
14
13
|
* @param lookup - Where messages are read from (registry, bound dictionary…).
|
|
15
14
|
*/
|
|
16
15
|
export declare const createMessageFormatter: (activeLocale: string | null | undefined, lookup: MessageLookup) => MessageFormatter;
|
|
17
|
-
//#endregion
|
|
18
16
|
//# sourceMappingURL=createMessageFormatter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMessageFormatter.d.ts","names":[],"sources":["../../src/createMessageFormatter.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createMessageFormatter.d.ts","names":[],"sources":["../../src/createMessageFormatter.ts"],"mappings":";;YASY,iBAAiB,YAAY;;;;;;;;;;;;qBAwB5B,yBAAsB,yCAEQ,QAC/B,kBACP"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { MemoizedDateTimeFormatterFactoryOptional, MemoizedNumberFormatterFactoryOptional } from "./types.js";
|
|
2
|
-
//#region src/formatters.d.ts
|
|
3
2
|
/** Memoized `Intl.NumberFormat` honouring named `number` formats. */
|
|
4
3
|
export declare const getNumberFormatter: MemoizedNumberFormatterFactoryOptional;
|
|
5
4
|
/** Memoized `Intl.DateTimeFormat` honouring named `date` formats. */
|
|
6
5
|
export declare const getDateFormatter: MemoizedDateTimeFormatterFactoryOptional;
|
|
7
6
|
/** Memoized `Intl.DateTimeFormat` honouring named `time` formats. */
|
|
8
7
|
export declare const getTimeFormatter: MemoizedDateTimeFormatterFactoryOptional;
|
|
9
|
-
//#endregion
|
|
10
8
|
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.d.ts","names":[],"sources":["../../src/formatters.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","names":[],"sources":["../../src/formatters.ts"],"mappings":";;qBA0Ca,oBAAoB;;qBA4CpB,kBAAgB;;qBAGhB,kBAAgB"}
|
package/dist/types/helpers.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ConfigureOptionsInit, InterpolationValues, LocaleDictionary, MessageObject, MessagesLoader } from "./types.js";
|
|
2
2
|
import { Readable } from "svelte/store";
|
|
3
|
-
//#region src/helpers.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Configures fallback locale, formats and missing-message handling, then
|
|
6
5
|
* activates `initialLocale` (or keeps intlayer's current locale).
|
|
@@ -45,5 +44,5 @@ export declare const getLocaleFromNavigator: () => string | null;
|
|
|
45
44
|
export declare const getLocaleFromQueryString: (key: string) => string | null;
|
|
46
45
|
/** Reads the `key` parameter of the current URL hash (`#lang=fr`). */
|
|
47
46
|
export declare const getLocaleFromHash: (key: string) => string | null;
|
|
48
|
-
|
|
47
|
+
export {};
|
|
49
48
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","names":[],"sources":["../../src/helpers.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","names":[],"sources":["../../src/helpers.ts"],"mappings":";;;;;;qBAqBa,OAAI,SAAa,yBAAuB;;;;;qBAYxC,cAAW,yBACF,UACP;;;;;qBAiBF,WAAQ,sBACC,QACZ;;qBAmBG,aAAU,qBAA6B;;qBAKvC,iBAAkB,UAAU,eAAe,gBAAc,UAC1D,MACT;KAEE,WAAW,KAAK,UAAU,eAAe,KAAK;;;;;qBAMtC,sBACX,UAAU,aAAa,4BAA0B,OAE1C,MACN,WAAW;EAAO;;;;;;qBAmBR,sBAAmB,iBACf;EAEZ,SAAS,SAAS;;;qBAeV,wBAAqB,UAAc;;qBAMnC,wBAAqB,UAAc;;qBAMnC;;qBASA,2BAAwB;;qBAMxB,oBAAiB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ConfigureOptions, ConfigureOptionsInit, DateFormatter, FormatXMLElementFn, Formats, InterpolationValues, IntlFormatterOptions, JSONGetter, LocaleDictionary, LocalesDictionary, MemoizedIntlFormatterOptional, MessageFormatter, MessageObject, MessagesLoader, MissingKeyHandler, MissingKeyHandlerInput, MissingKeyHandlerOutput, NumberFormatter, TimeFormatter } from "./types.js";
|
|
2
1
|
import { getDateFormatter, getNumberFormatter, getTimeFormatter } from "./formatters.js";
|
|
3
2
|
import { addMessages, defineMessages, getLocaleFromHash, getLocaleFromHostname, getLocaleFromNavigator, getLocaleFromPathname, getLocaleFromQueryString, getMessageFormatter, init, register, unwrapFunctionStore, waitLocale } from "./helpers.js";
|
|
4
3
|
import { LocaleStore, isLoading, locale, locales } from "./locale.js";
|
|
5
4
|
import { dictionary } from "./runtimeMessages.js";
|
|
6
5
|
import { _, date, format, json, number, t, time } from "./stores.js";
|
|
6
|
+
import { ConfigureOptions, ConfigureOptionsInit, DateFormatter, FormatXMLElementFn, Formats, InterpolationValues, IntlFormatterOptions, JSONGetter, LocaleDictionary, LocalesDictionary, MemoizedIntlFormatterOptional, MessageFormatter, MessageObject, MessagesLoader, MissingKeyHandler, MissingKeyHandlerInput, MissingKeyHandlerOutput, NumberFormatter, TimeFormatter } from "./types.js";
|
|
7
7
|
import { DictionaryMessageStores, useDictionary } from "./useDictionary.js";
|
|
8
8
|
import { useDictionaryDynamic } from "./useDictionaryDynamic.js";
|
|
9
9
|
export { type ConfigureOptions, type ConfigureOptionsInit, type DateFormatter, type DictionaryMessageStores, type FormatXMLElementFn, type Formats, type InterpolationValues, type IntlFormatterOptions, type JSONGetter, type LocaleDictionary, type LocaleStore, type LocalesDictionary, type MemoizedIntlFormatterOptional, type MessageFormatter, type MessageObject, type MessagesLoader, type MissingKeyHandler, type MissingKeyHandlerInput, type MissingKeyHandlerOutput, type NumberFormatter, type TimeFormatter, _, addMessages, date, defineMessages, dictionary, format, getDateFormatter, getLocaleFromHash, getLocaleFromHostname, getLocaleFromNavigator, getLocaleFromPathname, getLocaleFromQueryString, getMessageFormatter, getNumberFormatter, getTimeFormatter, init, isLoading, json, locale, locales, number, register, t, time, unwrapFunctionStore, useDictionary, useDictionaryDynamic, waitLocale };
|
package/dist/types/locale.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Readable } from "svelte/store";
|
|
2
|
-
//#region src/locale.d.ts
|
|
3
2
|
/** A svelte-i18n `locale` store: writable, nullable. */
|
|
4
3
|
export type LocaleStore = Readable<string | null | undefined> & {
|
|
5
4
|
set: (locale: string | null | undefined) => void;
|
|
@@ -17,5 +16,4 @@ export declare const locales: Readable<string[]>;
|
|
|
17
16
|
* (or preloaded per locale), so there is no pending catalog to wait for.
|
|
18
17
|
*/
|
|
19
18
|
export declare const isLoading: import("svelte/store").Writable<boolean>;
|
|
20
|
-
//#endregion
|
|
21
19
|
//# sourceMappingURL=locale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.d.ts","names":[],"sources":["../../src/locale.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"locale.d.ts","names":[],"sources":["../../src/locale.ts"],"mappings":";;YAMY,cAAc;EACxB,MAAM;EACN,SACE,UAAU;;;;;;qBAkBD,QAAQ;;qBAaR,SAAS;;;;;qBAMT,kCAAS"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { PluginOption } from "vite";
|
|
2
2
|
import { intlayer } from "vite-intlayer";
|
|
3
|
-
//#region src/plugin/index.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* A Vite plugin for svelte-i18n compat that wraps vite-intlayer
|
|
6
5
|
* and configures resolve aliases for svelte-i18n.
|
|
7
6
|
*/
|
|
8
7
|
export declare const svelteI18nVitePlugin: (options?: Parameters<typeof intlayer>[0]) => PluginOption[];
|
|
9
|
-
//#endregion
|
|
10
8
|
export { svelteI18nVitePlugin as default };
|
|
11
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/plugin/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/plugin/index.ts"],"mappings":";;;;;;qBAaa,uBAAoB,UACrB,kBAAkB,iBAC3B"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/registryLookup.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Looks up a svelte-i18n id across the intlayer dictionaries:
|
|
4
3
|
*
|
|
@@ -10,5 +9,4 @@
|
|
|
10
9
|
* @returns The interpreted node (string, object or callable), or `undefined`.
|
|
11
10
|
*/
|
|
12
11
|
export declare const lookupRegistryMessage: (id: string, locale: string) => unknown;
|
|
13
|
-
//#endregion
|
|
14
12
|
//# sourceMappingURL=registryLookup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registryLookup.d.ts","names":[],"sources":["../../src/registryLookup.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"registryLookup.d.ts","names":[],"sources":["../../src/registryLookup.ts"],"mappings":";;;;;;;;;;qBA4Ca,wBAAqB,YAAc"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LocalesDictionary } from "./types.js";
|
|
2
2
|
import { Writable } from "svelte/store";
|
|
3
|
-
//#region src/runtimeMessages.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* `$dictionary` — messages registered at runtime through `addMessages()` /
|
|
6
5
|
* `register()`. Intlayer dictionaries never go through this store.
|
|
@@ -14,5 +13,5 @@ export declare const setMessageCompiler: (compiler: MessageCompiler) => void;
|
|
|
14
13
|
* installed. Returns `undefined` when the id is not registered.
|
|
15
14
|
*/
|
|
16
15
|
export declare const lookupRuntimeMessage: (messages: LocalesDictionary, targetLocale: string, id: string) => unknown;
|
|
17
|
-
|
|
16
|
+
export {};
|
|
18
17
|
//# sourceMappingURL=runtimeMessages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeMessages.d.ts","names":[],"sources":["../../src/runtimeMessages.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtimeMessages.d.ts","names":[],"sources":["../../src/runtimeMessages.ts"],"mappings":";;;;;;qBAQa,YAAY,SAAS;;KAG7B,mBAAmB;qBAcX,qBAAkB,UAAc;;;;;qBAQhC,uBAAoB,UACrB,mBAAiB,sBACP"}
|
package/dist/types/stores.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DateFormatter, JSONGetter, MessageFormatter, NumberFormatter, TimeFormatter } from "./types.js";
|
|
2
2
|
import { Readable } from "svelte/store";
|
|
3
|
-
//#region src/stores.d.ts
|
|
4
3
|
/** `$format` / `$_` / `$t` — translates a message id. */
|
|
5
4
|
export declare const format: Readable<MessageFormatter>;
|
|
6
5
|
export declare const _: Readable<MessageFormatter>;
|
|
@@ -13,5 +12,4 @@ export declare const date: Readable<DateFormatter>;
|
|
|
13
12
|
export declare const time: Readable<TimeFormatter>;
|
|
14
13
|
/** `$number` — formats a number with the `number` named formats. */
|
|
15
14
|
export declare const number: Readable<NumberFormatter>;
|
|
16
|
-
//#endregion
|
|
17
15
|
//# sourceMappingURL=stores.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stores.d.ts","names":[],"sources":["../../src/stores.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"stores.d.ts","names":[],"sources":["../../src/stores.ts"],"mappings":";;;qBA8Ba,QAAQ,SAAS;qBAQjB,GAAC,SAAA;qBACD,GAAC,SAAA;;qBAGD,MAAM,SAAS;;qBAYf,MAAM,SAAS;;qBAOf,MAAM,SAAS;;qBAOf,QAAQ,SAAS"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/types.d.ts
|
|
2
1
|
/** Rich-text chunk renderer accepted as an interpolation value. */
|
|
3
2
|
export type FormatXMLElementFn<T = unknown> = (chunks: (string | T)[]) => string | T;
|
|
4
3
|
/** Named `Intl` option presets, keyed by format name (`'short'`, `'EUR'`…). */
|
|
@@ -60,5 +59,4 @@ export type LocaleDictionary = {
|
|
|
60
59
|
export type LocalesDictionary = Record<string, LocaleDictionary>;
|
|
61
60
|
export type MemoizedNumberFormatterFactoryOptional = MemoizedIntlFormatterOptional<Intl.NumberFormat, Intl.NumberFormatOptions>;
|
|
62
61
|
export type MemoizedDateTimeFormatterFactoryOptional = MemoizedIntlFormatterOptional<Intl.DateTimeFormat, Intl.DateTimeFormatOptions>;
|
|
63
|
-
//#endregion
|
|
64
62
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":";YACY,mBAAmB,gBAC7B,kBAAkB,kBACN;;YAGF;EACV,QAAQ,eAAe,KAAK;EAC5B,MAAM,eAAe,KAAK;EAC1B,MAAM,eAAe,KAAK;;YAGhB,sBACR,2CAKI,OACA;YAMI;EACV;EACA;EACA;EACA;EACA,SAAS;;;YAIC,oBACV,aAAa,eACb,UAAU,KAAK;YAGL,qBAAqB,KAAK;EACpC;EACA;;YAGU,iBACV,MAAM,eACN,UAAU,qBAAqB,KAAK;YAG1B,iBACV,MAAM,eACN,UAAU,qBAAqB,KAAK;YAG1B,mBACV,eACA,UAAU,qBAAqB,KAAK;;YAI1B,cAAc,aACxB,YACA,oBACG;YAEO,8BAA8B,GAAG,MAC3C,UAAU,qBAAqB,OAC5B;YAEO,uBAAuB,QACjC;EAAqB,SAAS;;YAGpB;EACV;EACA;EACA;;YAIU;YAEA,qBACV,OAAO,2BACJ;YAEO;;EAEV;;EAEA;;EAEA,UAAU,QAAQ;;EAElB;;EAEA;;EAEA,uBAAuB;;EAEvB;;YAGU,uBAAuB,KAAK,sCACtC,QAAQ,KAAK;YAEH;GACT,cACG,4BAEA,eAAe;;YAIT,oBAAoB,eAAe;YAEnC,yCACV,8BAA8B,KAAK,cAAc,KAAK;YAE5C,2CACV,8BACE,KAAK,gBACL,KAAK"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { JSONGetter, MessageFormatter } from "./types.js";
|
|
2
2
|
import { Readable } from "svelte/store";
|
|
3
3
|
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
|
-
//#region src/useDictionary.d.ts
|
|
5
4
|
/** Message stores bound to one dictionary. */
|
|
6
5
|
export type DictionaryMessageStores = {
|
|
7
6
|
_: Readable<MessageFormatter>;
|
|
@@ -35,5 +34,4 @@ export declare const createDictionaryStores: (contentStore: Readable<{
|
|
|
35
34
|
* ```
|
|
36
35
|
*/
|
|
37
36
|
export declare const useDictionary: <const T extends Dictionary>(dictionary: T, keyPrefix?: string) => DictionaryMessageStores;
|
|
38
|
-
//#endregion
|
|
39
37
|
//# sourceMappingURL=useDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../src/useDictionary.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../src/useDictionary.ts"],"mappings":";;;;YAWY;EACV,GAAG,SAAS;EACZ,GAAG,SAAS;EACZ,QAAQ,SAAS;EACjB,MAAM,SAAS;;;qBAIJ,eAAY,YAAc;;;;;qBAO1B,yBAAsB,cACnB;EACZ;EACA,cAAc;IACd,uBAED;;;;;;;;;;;;;;;;qBAqCU,sBAAuB,UAAU,YAAU,YAC1C,GAAC,uBAEZ"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DictionaryMessageStores } from "./useDictionary.js";
|
|
2
2
|
import { Dictionary } from "@intlayer/types/dictionary";
|
|
3
3
|
import { DictionaryKeys, StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
4
|
-
//#region src/useDictionaryDynamic.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Per-locale lazy variant of `useDictionary`: only the active locale's
|
|
7
6
|
* dictionary is fetched. Until it arrives, ids resolve to their `default`
|
|
@@ -12,5 +11,4 @@ import { DictionaryKeys, StrictModeLocaleMap } from "@intlayer/types/module_augm
|
|
|
12
11
|
* @param keyPrefix - Optional prefix applied to every id.
|
|
13
12
|
*/
|
|
14
13
|
export declare const useDictionaryDynamic: <const T extends Dictionary, const K extends DictionaryKeys>(dictionaryLoaders: StrictModeLocaleMap<() => Promise<T>>, _dictionaryKey: K, keyPrefix?: string) => DictionaryMessageStores;
|
|
15
|
-
//#endregion
|
|
16
14
|
//# sourceMappingURL=useDictionaryDynamic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../src/useDictionaryDynamic.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../src/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;qBAwBa,6BACL,UAAU,kBACV,UAAU,gBAAc,mBAEX,0BAA0B,QAAQ,KAAG,gBACxC,GAAC,uBAEhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/svelte-i18n",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "svelte-i18n API adapter for intlayer — drop-in compatibility layer",
|
|
6
6
|
"keywords": [
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@intlayer/config": "9.
|
|
73
|
-
"@intlayer/core": "9.7.
|
|
74
|
-
"@intlayer/dictionaries-entry": "9.
|
|
75
|
-
"@intlayer/engine": "9.7.
|
|
76
|
-
"@intlayer/types": "9.7.
|
|
77
|
-
"svelte-intlayer": "9.
|
|
78
|
-
"vite-intlayer": "9.
|
|
72
|
+
"@intlayer/config": "9.7.1",
|
|
73
|
+
"@intlayer/core": "9.7.1",
|
|
74
|
+
"@intlayer/dictionaries-entry": "9.7.1",
|
|
75
|
+
"@intlayer/engine": "9.7.1",
|
|
76
|
+
"@intlayer/types": "9.7.1",
|
|
77
|
+
"svelte-intlayer": "9.7.1",
|
|
78
|
+
"vite-intlayer": "9.7.1"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@types/node": "^26",
|
|
@@ -83,12 +83,12 @@
|
|
|
83
83
|
"@utils/ts-config-types": "1.0.4",
|
|
84
84
|
"@utils/tsdown-config": "1.0.4",
|
|
85
85
|
"rimraf": "6.1.3",
|
|
86
|
-
"svelte": "5.57.
|
|
86
|
+
"svelte": "5.57.3",
|
|
87
87
|
"svelte-i18n": "^4.0.1",
|
|
88
|
-
"tsdown": "0.23.
|
|
88
|
+
"tsdown": "0.23.4",
|
|
89
89
|
"typescript": "7.0.2",
|
|
90
|
-
"vite": "8.3.
|
|
91
|
-
"vitest": "5.0
|
|
90
|
+
"vite": "8.3.5",
|
|
91
|
+
"vitest": "5.1.0"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"svelte": ">=5.0.0",
|