solid-intlayer 8.4.0 → 8.4.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../chunk-C91j1N6u.js`);let t=require(`@intlayer/config/built`);t=e.t(t);let n=require(`@intlayer/core/localization`),r=require(`@intlayer/core/utils`),i=require(`@intlayer/types/locales`);
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../chunk-C91j1N6u.js`);let t=require(`@intlayer/config/built`);t=e.t(t);let n=require(`@intlayer/core/localization`),r=require(`@intlayer/core/utils`),i=require(`@intlayer/types/locales`);var a=function(e){return e.Querystring=`querystring`,e.Storage=`storage`,e.Navigator=`navigator`,e.HtmlTag=`htmlTag`,e}({}),o=()=>({order:[a.Querystring,a.Storage,a.Navigator,a.HtmlTag],lookupQuerystring:`locale`,htmlTag:typeof document<`u`?document.documentElement:null}),s=(e,i)=>{let o={},s=()=>{if(typeof window>`u`)return;let e=window.location.search||``,t=new URLSearchParams(e).get(i.lookupQuerystring??``);t&&(o[a.Querystring]=t)},c=()=>{if(typeof window>`u`)return;let e=(0,r.getLocaleFromStorage)({getCookie:e=>{try{let t=document.cookie.split(`;`),n=`${e}=`,r=t.find(e=>e.trim().startsWith(n));if(r)return r.split(`=`)[1].trim()}catch{}},getSessionStorage:e=>{try{return window.sessionStorage.getItem(e)??void 0}catch{}},getLocaleStorage:e=>{try{return window.localStorage.getItem(e)??void 0}catch{}}});e&&(o[a.Storage]=e)},l=()=>{if(typeof navigator>`u`)return;let{internationalization:e}=t.default,r=navigator.languages??[navigator.language],i=(0,n.localeDetector)({"accept-language":r.join(`,`)},e.locales,e.defaultLocale);i&&(o[a.Navigator]=i)},u=()=>{let e=i.htmlTag;if(e&&typeof e.getAttribute==`function`){let r=e.getAttribute(`lang`);if(r){let{internationalization:e}=t.default,i=(0,n.localeDetector)({"accept-language":r},e.locales,e.defaultLocale);o[a.HtmlTag]=i}}},d={[a.Querystring]:s,[a.Storage]:c,[a.Navigator]:l,[a.HtmlTag]:u};return e.forEach(e=>{d[e]?.()}),o},c=(e,n)=>{let{internationalization:r}=t.default;for(let t of n){let n=e[t];if(n&&r.locales.includes(n))return n}return r?.defaultLocale??i.ENGLISH},l=(e={})=>{let t={...o(),...e};return c(s(t.order??[],t),t.order??[])};exports.LanguageDetector=a,exports.getBrowserLocale=l;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "@intlayer/config/built";
|
|
2
2
|
import { localeDetector as t } from "@intlayer/core/localization";
|
|
3
3
|
import { getLocaleFromStorage as n } from "@intlayer/core/utils";
|
|
4
|
-
import
|
|
4
|
+
import { ENGLISH as r } from "@intlayer/types/locales";
|
|
5
5
|
//#region src/client/getBrowserLocale.tsx
|
|
6
6
|
var i = /* @__PURE__ */ function(e) {
|
|
7
7
|
return e.Querystring = "querystring", e.Storage = "storage", e.Navigator = "navigator", e.HtmlTag = "htmlTag", e;
|
|
@@ -68,7 +68,7 @@ var i = /* @__PURE__ */ function(e) {
|
|
|
68
68
|
let n = t[e];
|
|
69
69
|
if (n && i.locales.includes(n)) return n;
|
|
70
70
|
}
|
|
71
|
-
return i?.defaultLocale ?? r
|
|
71
|
+
return i?.defaultLocale ?? r;
|
|
72
72
|
}, c = (e = {}) => {
|
|
73
73
|
let t = {
|
|
74
74
|
...a(),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WrappedIntl } from '@intlayer/core/formatters';
|
|
1
2
|
import { LocalesValues } from '@intlayer/types/module_augmentation';
|
|
2
3
|
/**
|
|
3
4
|
* Solid client hook that provides a locale-bound `Intl` object.
|
|
@@ -17,62 +18,4 @@ import { LocalesValues } from '@intlayer/types/module_augmentation';
|
|
|
17
18
|
* }).format(123.45);
|
|
18
19
|
* ```
|
|
19
20
|
*/
|
|
20
|
-
export declare const useIntl: (locale?: LocalesValues) => import('solid-js').Accessor<
|
|
21
|
-
Collator: {
|
|
22
|
-
new (locales?: LocalesValues, options?: Intl.CollatorOptions | undefined): Intl.Collator;
|
|
23
|
-
new (options?: (Intl.CollatorOptions & {
|
|
24
|
-
locale?: LocalesValues;
|
|
25
|
-
}) | undefined): Intl.Collator;
|
|
26
|
-
};
|
|
27
|
-
NumberFormat: {
|
|
28
|
-
new (locales?: LocalesValues, options?: Intl.NumberFormatOptions | undefined): Intl.NumberFormat;
|
|
29
|
-
new (options?: (Intl.NumberFormatOptions & {
|
|
30
|
-
locale?: LocalesValues;
|
|
31
|
-
}) | undefined): Intl.NumberFormat;
|
|
32
|
-
};
|
|
33
|
-
DateTimeFormat: {
|
|
34
|
-
new (locales?: LocalesValues, options?: Intl.DateTimeFormatOptions | undefined): Intl.DateTimeFormat;
|
|
35
|
-
new (options?: (Intl.DateTimeFormatOptions & {
|
|
36
|
-
locale?: LocalesValues;
|
|
37
|
-
}) | undefined): Intl.DateTimeFormat;
|
|
38
|
-
};
|
|
39
|
-
getCanonicalLocales: typeof Intl.getCanonicalLocales;
|
|
40
|
-
readonly PluralRules: {
|
|
41
|
-
new (locales?: LocalesValues, options?: Intl.PluralRulesOptions | undefined): Intl.PluralRules;
|
|
42
|
-
new (options?: (Intl.PluralRulesOptions & {
|
|
43
|
-
locale?: LocalesValues;
|
|
44
|
-
}) | undefined): Intl.PluralRules;
|
|
45
|
-
};
|
|
46
|
-
readonly RelativeTimeFormat: {
|
|
47
|
-
new (locales?: LocalesValues, options?: Intl.RelativeTimeFormatOptions | undefined): Intl.RelativeTimeFormat;
|
|
48
|
-
new (options?: (Intl.RelativeTimeFormatOptions & {
|
|
49
|
-
locale?: LocalesValues;
|
|
50
|
-
}) | undefined): Intl.RelativeTimeFormat;
|
|
51
|
-
};
|
|
52
|
-
readonly Locale: {
|
|
53
|
-
new (locales?: LocalesValues, options?: Intl.LocaleOptions | undefined): Intl.Locale;
|
|
54
|
-
new (options?: (Intl.LocaleOptions & {
|
|
55
|
-
locale?: LocalesValues;
|
|
56
|
-
}) | undefined): Intl.Locale;
|
|
57
|
-
};
|
|
58
|
-
readonly DisplayNames: {
|
|
59
|
-
prototype: Intl.DisplayNames;
|
|
60
|
-
new (locales: Intl.LocalesArgument, options: Intl.DisplayNamesOptions): Intl.DisplayNames;
|
|
61
|
-
supportedLocalesOf(locales?: Intl.LocalesArgument, options?: {
|
|
62
|
-
localeMatcher?: Intl.RelativeTimeFormatLocaleMatcher;
|
|
63
|
-
}): Intl.UnicodeBCP47LocaleIdentifier[];
|
|
64
|
-
};
|
|
65
|
-
readonly ListFormat: {
|
|
66
|
-
new (locales?: LocalesValues, options?: Intl.ListFormatOptions | undefined): Intl.ListFormat;
|
|
67
|
-
new (options?: (Intl.ListFormatOptions & {
|
|
68
|
-
locale?: LocalesValues;
|
|
69
|
-
}) | undefined): Intl.ListFormat;
|
|
70
|
-
};
|
|
71
|
-
supportedValuesOf: typeof Intl.supportedValuesOf;
|
|
72
|
-
readonly Segmenter: {
|
|
73
|
-
new (locales?: LocalesValues, options?: Intl.SegmenterOptions | undefined): Intl.Segmenter;
|
|
74
|
-
new (options?: (Intl.SegmenterOptions & {
|
|
75
|
-
locale?: LocalesValues;
|
|
76
|
-
}) | undefined): Intl.Segmenter;
|
|
77
|
-
};
|
|
78
|
-
}>;
|
|
21
|
+
export declare const useIntl: (locale?: LocalesValues) => import('solid-js').Accessor<WrappedIntl>;
|
|
@@ -3,7 +3,7 @@ import { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';
|
|
|
3
3
|
* On the client side, hook to get the translation content based on the locale
|
|
4
4
|
*/
|
|
5
5
|
export declare const useContent: <Content>(languageContent: StrictModeLocaleMap<Content>) => {
|
|
6
|
-
locale: import('intlayer').Locale;
|
|
6
|
+
locale: import('@intlayer/types/allLocales').Locale;
|
|
7
7
|
content: Content;
|
|
8
8
|
t: <Content_1 = string>(languageContent: StrictModeLocaleMap<Content_1>) => Content_1;
|
|
9
9
|
};
|
|
@@ -2,13 +2,13 @@ import { LocalesValues } from '@intlayer/types/module_augmentation';
|
|
|
2
2
|
/**
|
|
3
3
|
* Get the locale cookie
|
|
4
4
|
*/
|
|
5
|
-
export declare const localeInStorage: import('intlayer').Locale | undefined;
|
|
5
|
+
export declare const localeInStorage: import('@intlayer/types/allLocales').Locale | undefined;
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Use localeInStorage instead
|
|
8
8
|
*
|
|
9
9
|
* Get the locale cookie
|
|
10
10
|
*/
|
|
11
|
-
export declare const localeCookie: import('intlayer').Locale | undefined;
|
|
11
|
+
export declare const localeCookie: import('@intlayer/types/allLocales').Locale | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* Set the locale cookie
|
|
14
14
|
*/
|
|
@@ -23,7 +23,7 @@ export declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled?:
|
|
|
23
23
|
* Hook that provides the locale storage and a function to set it
|
|
24
24
|
*/
|
|
25
25
|
export declare const useLocaleStorage: (isCookieEnabled?: boolean) => import('solid-js').Accessor<{
|
|
26
|
-
getLocale: () => import('intlayer').Locale;
|
|
26
|
+
getLocale: () => import('@intlayer/types/allLocales').Locale;
|
|
27
27
|
setLocale: (locale: LocalesValues) => void;
|
|
28
28
|
}>;
|
|
29
29
|
/**
|
|
@@ -34,6 +34,6 @@ export declare const useLocaleStorage: (isCookieEnabled?: boolean) => import('so
|
|
|
34
34
|
* Hook that provides the locale cookie and a function to set it
|
|
35
35
|
*/
|
|
36
36
|
export declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
37
|
-
localeCookie: import('intlayer').Locale;
|
|
37
|
+
localeCookie: import('@intlayer/types/allLocales').Locale;
|
|
38
38
|
setLocaleCookie: (locale: LocalesValues) => void;
|
|
39
39
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-intlayer",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Solid applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@intlayer/api": "8.4.
|
|
77
|
-
"@intlayer/config": "8.4.
|
|
78
|
-
"@intlayer/core": "8.4.
|
|
79
|
-
"@intlayer/editor": "8.4.
|
|
80
|
-
"@intlayer/types": "8.4.
|
|
76
|
+
"@intlayer/api": "8.4.1",
|
|
77
|
+
"@intlayer/config": "8.4.1",
|
|
78
|
+
"@intlayer/core": "8.4.1",
|
|
79
|
+
"@intlayer/editor": "8.4.1",
|
|
80
|
+
"@intlayer/types": "8.4.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@solidjs/testing-library": "0.8.10",
|