@internationalized/message 3.1.4-nightly.4624 → 3.1.5-nightly.4629
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.
|
@@ -25,14 +25,14 @@ $parcel$export(module.exports, "MessageDictionary", () => $9a5a7b8408290694$expo
|
|
|
25
25
|
if (!string) throw new Error(`Could not find intl message ${key} in ${locale} locale`);
|
|
26
26
|
return string;
|
|
27
27
|
}
|
|
28
|
-
constructor(messages, defaultLocale =
|
|
28
|
+
constructor(messages, defaultLocale = 'en-US'){
|
|
29
29
|
// Clone messages so we don't modify the original object.
|
|
30
30
|
// Filter out entries with falsy values which may have been caused by applying optimize-locales-plugin.
|
|
31
31
|
this.messages = Object.fromEntries(Object.entries(messages).filter(([, v])=>v));
|
|
32
32
|
this.defaultLocale = defaultLocale;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
function $9a5a7b8408290694$var$getStringsForLocale(locale, strings, defaultLocale =
|
|
35
|
+
function $9a5a7b8408290694$var$getStringsForLocale(locale, strings, defaultLocale = 'en-US') {
|
|
36
36
|
// If there is an exact match, use it.
|
|
37
37
|
if (strings[locale]) return strings[locale];
|
|
38
38
|
// Attempt to find the closest match by language.
|
|
@@ -43,7 +43,7 @@ function $9a5a7b8408290694$var$getStringsForLocale(locale, strings, defaultLocal
|
|
|
43
43
|
let language = $9a5a7b8408290694$var$getLanguage(locale);
|
|
44
44
|
if (strings[language]) return strings[language];
|
|
45
45
|
for(let key in strings){
|
|
46
|
-
if (key.startsWith(language +
|
|
46
|
+
if (key.startsWith(language + '-')) return strings[key];
|
|
47
47
|
}
|
|
48
48
|
// Nothing close, use english.
|
|
49
49
|
return strings[defaultLocale];
|
|
@@ -52,7 +52,7 @@ function $9a5a7b8408290694$var$getLanguage(locale) {
|
|
|
52
52
|
// @ts-ignore
|
|
53
53
|
if (Intl.Locale) // @ts-ignore
|
|
54
54
|
return new Intl.Locale(locale).language;
|
|
55
|
-
return locale.split(
|
|
55
|
+
return locale.split('-')[0];
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
if (!string) throw new Error(`Could not find intl message ${key} in ${locale} locale`);
|
|
20
20
|
return string;
|
|
21
21
|
}
|
|
22
|
-
constructor(messages, defaultLocale =
|
|
22
|
+
constructor(messages, defaultLocale = 'en-US'){
|
|
23
23
|
// Clone messages so we don't modify the original object.
|
|
24
24
|
// Filter out entries with falsy values which may have been caused by applying optimize-locales-plugin.
|
|
25
25
|
this.messages = Object.fromEntries(Object.entries(messages).filter(([, v])=>v));
|
|
26
26
|
this.defaultLocale = defaultLocale;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function $d6fd23bc337660df$var$getStringsForLocale(locale, strings, defaultLocale =
|
|
29
|
+
function $d6fd23bc337660df$var$getStringsForLocale(locale, strings, defaultLocale = 'en-US') {
|
|
30
30
|
// If there is an exact match, use it.
|
|
31
31
|
if (strings[locale]) return strings[locale];
|
|
32
32
|
// Attempt to find the closest match by language.
|
|
@@ -37,7 +37,7 @@ function $d6fd23bc337660df$var$getStringsForLocale(locale, strings, defaultLocal
|
|
|
37
37
|
let language = $d6fd23bc337660df$var$getLanguage(locale);
|
|
38
38
|
if (strings[language]) return strings[language];
|
|
39
39
|
for(let key in strings){
|
|
40
|
-
if (key.startsWith(language +
|
|
40
|
+
if (key.startsWith(language + '-')) return strings[key];
|
|
41
41
|
}
|
|
42
42
|
// Nothing close, use english.
|
|
43
43
|
return strings[defaultLocale];
|
|
@@ -46,7 +46,7 @@ function $d6fd23bc337660df$var$getLanguage(locale) {
|
|
|
46
46
|
// @ts-ignore
|
|
47
47
|
if (Intl.Locale) // @ts-ignore
|
|
48
48
|
return new Intl.Locale(locale).language;
|
|
49
|
-
return locale.split(
|
|
49
|
+
return locale.split('-')[0];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
if (!string) throw new Error(`Could not find intl message ${key} in ${locale} locale`);
|
|
20
20
|
return string;
|
|
21
21
|
}
|
|
22
|
-
constructor(messages, defaultLocale =
|
|
22
|
+
constructor(messages, defaultLocale = 'en-US'){
|
|
23
23
|
// Clone messages so we don't modify the original object.
|
|
24
24
|
// Filter out entries with falsy values which may have been caused by applying optimize-locales-plugin.
|
|
25
25
|
this.messages = Object.fromEntries(Object.entries(messages).filter(([, v])=>v));
|
|
26
26
|
this.defaultLocale = defaultLocale;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function $d6fd23bc337660df$var$getStringsForLocale(locale, strings, defaultLocale =
|
|
29
|
+
function $d6fd23bc337660df$var$getStringsForLocale(locale, strings, defaultLocale = 'en-US') {
|
|
30
30
|
// If there is an exact match, use it.
|
|
31
31
|
if (strings[locale]) return strings[locale];
|
|
32
32
|
// Attempt to find the closest match by language.
|
|
@@ -37,7 +37,7 @@ function $d6fd23bc337660df$var$getStringsForLocale(locale, strings, defaultLocal
|
|
|
37
37
|
let language = $d6fd23bc337660df$var$getLanguage(locale);
|
|
38
38
|
if (strings[language]) return strings[language];
|
|
39
39
|
for(let key in strings){
|
|
40
|
-
if (key.startsWith(language +
|
|
40
|
+
if (key.startsWith(language + '-')) return strings[key];
|
|
41
41
|
}
|
|
42
42
|
// Nothing close, use english.
|
|
43
43
|
return strings[defaultLocale];
|
|
@@ -46,7 +46,7 @@ function $d6fd23bc337660df$var$getLanguage(locale) {
|
|
|
46
46
|
// @ts-ignore
|
|
47
47
|
if (Intl.Locale) // @ts-ignore
|
|
48
48
|
return new Intl.Locale(locale).language;
|
|
49
|
-
return locale.split(
|
|
49
|
+
return locale.split('-')[0];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internationalized/message",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5-nightly.4629+c34886769",
|
|
4
4
|
"description": "Internationalized message formatting and locale negotiation",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "c34886769d3e69bb56553a02eead6a0fd877e754"
|
|
32
32
|
}
|