@internationalized/string 3.2.3-nightly.4623 → 3.2.3

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.
@@ -14,8 +14,8 @@ $parcel$export(module.exports, "LocalizedStringDictionary", () => $f80be5fd4d03d
14
14
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
15
  * OF ANY KIND, either express or implied. See the License for the specific language
16
16
  * governing permissions and limitations under the License.
17
- */ const $f80be5fd4d03dda9$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
18
- const $f80be5fd4d03dda9$var$stringsSymbol = Symbol.for("react-aria.i18n.strings");
17
+ */ const $f80be5fd4d03dda9$var$localeSymbol = Symbol.for('react-aria.i18n.locale');
18
+ const $f80be5fd4d03dda9$var$stringsSymbol = Symbol.for('react-aria.i18n.strings');
19
19
  let $f80be5fd4d03dda9$var$cachedGlobalStrings = undefined;
20
20
  class $f80be5fd4d03dda9$export$c17fa47878dc55b6 {
21
21
  /** Returns a localized string for the given key and locale. */ getStringForLocale(key, locale) {
@@ -33,7 +33,7 @@ class $f80be5fd4d03dda9$export$c17fa47878dc55b6 {
33
33
  return strings;
34
34
  }
35
35
  static getGlobalDictionaryForPackage(packageName) {
36
- if (typeof window === "undefined") return null;
36
+ if (typeof window === 'undefined') return null;
37
37
  let locale = window[$f80be5fd4d03dda9$var$localeSymbol];
38
38
  if ($f80be5fd4d03dda9$var$cachedGlobalStrings === undefined) {
39
39
  let globalStrings = window[$f80be5fd4d03dda9$var$stringsSymbol];
@@ -47,14 +47,14 @@ class $f80be5fd4d03dda9$export$c17fa47878dc55b6 {
47
47
  if (!dictionary) throw new Error(`Strings for package "${packageName}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);
48
48
  return dictionary;
49
49
  }
50
- constructor(messages, defaultLocale = "en-US"){
50
+ constructor(messages, defaultLocale = 'en-US'){
51
51
  // Clone messages so we don't modify the original object.
52
52
  // Filter out entries with falsy values which may have been caused by applying optimize-locales-plugin.
53
53
  this.strings = Object.fromEntries(Object.entries(messages).filter(([, v])=>v));
54
54
  this.defaultLocale = defaultLocale;
55
55
  }
56
56
  }
57
- function $f80be5fd4d03dda9$var$getStringsForLocale(locale, strings, defaultLocale = "en-US") {
57
+ function $f80be5fd4d03dda9$var$getStringsForLocale(locale, strings, defaultLocale = 'en-US') {
58
58
  // If there is an exact match, use it.
59
59
  if (strings[locale]) return strings[locale];
60
60
  // Attempt to find the closest match by language.
@@ -65,7 +65,7 @@ function $f80be5fd4d03dda9$var$getStringsForLocale(locale, strings, defaultLocal
65
65
  let language = $f80be5fd4d03dda9$var$getLanguage(locale);
66
66
  if (strings[language]) return strings[language];
67
67
  for(let key in strings){
68
- if (key.startsWith(language + "-")) return strings[key];
68
+ if (key.startsWith(language + '-')) return strings[key];
69
69
  }
70
70
  // Nothing close, use english.
71
71
  return strings[defaultLocale];
@@ -74,7 +74,7 @@ function $f80be5fd4d03dda9$var$getLanguage(locale) {
74
74
  // @ts-ignore
75
75
  if (Intl.Locale) // @ts-ignore
76
76
  return new Intl.Locale(locale).language;
77
- return locale.split("-")[0];
77
+ return locale.split('-')[0];
78
78
  }
79
79
 
80
80
 
@@ -8,8 +8,8 @@
8
8
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
- */ const $5b160d28a433310d$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
12
- const $5b160d28a433310d$var$stringsSymbol = Symbol.for("react-aria.i18n.strings");
11
+ */ const $5b160d28a433310d$var$localeSymbol = Symbol.for('react-aria.i18n.locale');
12
+ const $5b160d28a433310d$var$stringsSymbol = Symbol.for('react-aria.i18n.strings');
13
13
  let $5b160d28a433310d$var$cachedGlobalStrings = undefined;
14
14
  class $5b160d28a433310d$export$c17fa47878dc55b6 {
15
15
  /** Returns a localized string for the given key and locale. */ getStringForLocale(key, locale) {
@@ -27,7 +27,7 @@ class $5b160d28a433310d$export$c17fa47878dc55b6 {
27
27
  return strings;
28
28
  }
29
29
  static getGlobalDictionaryForPackage(packageName) {
30
- if (typeof window === "undefined") return null;
30
+ if (typeof window === 'undefined') return null;
31
31
  let locale = window[$5b160d28a433310d$var$localeSymbol];
32
32
  if ($5b160d28a433310d$var$cachedGlobalStrings === undefined) {
33
33
  let globalStrings = window[$5b160d28a433310d$var$stringsSymbol];
@@ -41,14 +41,14 @@ class $5b160d28a433310d$export$c17fa47878dc55b6 {
41
41
  if (!dictionary) throw new Error(`Strings for package "${packageName}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);
42
42
  return dictionary;
43
43
  }
44
- constructor(messages, defaultLocale = "en-US"){
44
+ constructor(messages, defaultLocale = 'en-US'){
45
45
  // Clone messages so we don't modify the original object.
46
46
  // Filter out entries with falsy values which may have been caused by applying optimize-locales-plugin.
47
47
  this.strings = Object.fromEntries(Object.entries(messages).filter(([, v])=>v));
48
48
  this.defaultLocale = defaultLocale;
49
49
  }
50
50
  }
51
- function $5b160d28a433310d$var$getStringsForLocale(locale, strings, defaultLocale = "en-US") {
51
+ function $5b160d28a433310d$var$getStringsForLocale(locale, strings, defaultLocale = 'en-US') {
52
52
  // If there is an exact match, use it.
53
53
  if (strings[locale]) return strings[locale];
54
54
  // Attempt to find the closest match by language.
@@ -59,7 +59,7 @@ function $5b160d28a433310d$var$getStringsForLocale(locale, strings, defaultLocal
59
59
  let language = $5b160d28a433310d$var$getLanguage(locale);
60
60
  if (strings[language]) return strings[language];
61
61
  for(let key in strings){
62
- if (key.startsWith(language + "-")) return strings[key];
62
+ if (key.startsWith(language + '-')) return strings[key];
63
63
  }
64
64
  // Nothing close, use english.
65
65
  return strings[defaultLocale];
@@ -68,7 +68,7 @@ function $5b160d28a433310d$var$getLanguage(locale) {
68
68
  // @ts-ignore
69
69
  if (Intl.Locale) // @ts-ignore
70
70
  return new Intl.Locale(locale).language;
71
- return locale.split("-")[0];
71
+ return locale.split('-')[0];
72
72
  }
73
73
 
74
74
 
@@ -8,8 +8,8 @@
8
8
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
- */ const $5b160d28a433310d$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
12
- const $5b160d28a433310d$var$stringsSymbol = Symbol.for("react-aria.i18n.strings");
11
+ */ const $5b160d28a433310d$var$localeSymbol = Symbol.for('react-aria.i18n.locale');
12
+ const $5b160d28a433310d$var$stringsSymbol = Symbol.for('react-aria.i18n.strings');
13
13
  let $5b160d28a433310d$var$cachedGlobalStrings = undefined;
14
14
  class $5b160d28a433310d$export$c17fa47878dc55b6 {
15
15
  /** Returns a localized string for the given key and locale. */ getStringForLocale(key, locale) {
@@ -27,7 +27,7 @@ class $5b160d28a433310d$export$c17fa47878dc55b6 {
27
27
  return strings;
28
28
  }
29
29
  static getGlobalDictionaryForPackage(packageName) {
30
- if (typeof window === "undefined") return null;
30
+ if (typeof window === 'undefined') return null;
31
31
  let locale = window[$5b160d28a433310d$var$localeSymbol];
32
32
  if ($5b160d28a433310d$var$cachedGlobalStrings === undefined) {
33
33
  let globalStrings = window[$5b160d28a433310d$var$stringsSymbol];
@@ -41,14 +41,14 @@ class $5b160d28a433310d$export$c17fa47878dc55b6 {
41
41
  if (!dictionary) throw new Error(`Strings for package "${packageName}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);
42
42
  return dictionary;
43
43
  }
44
- constructor(messages, defaultLocale = "en-US"){
44
+ constructor(messages, defaultLocale = 'en-US'){
45
45
  // Clone messages so we don't modify the original object.
46
46
  // Filter out entries with falsy values which may have been caused by applying optimize-locales-plugin.
47
47
  this.strings = Object.fromEntries(Object.entries(messages).filter(([, v])=>v));
48
48
  this.defaultLocale = defaultLocale;
49
49
  }
50
50
  }
51
- function $5b160d28a433310d$var$getStringsForLocale(locale, strings, defaultLocale = "en-US") {
51
+ function $5b160d28a433310d$var$getStringsForLocale(locale, strings, defaultLocale = 'en-US') {
52
52
  // If there is an exact match, use it.
53
53
  if (strings[locale]) return strings[locale];
54
54
  // Attempt to find the closest match by language.
@@ -59,7 +59,7 @@ function $5b160d28a433310d$var$getStringsForLocale(locale, strings, defaultLocal
59
59
  let language = $5b160d28a433310d$var$getLanguage(locale);
60
60
  if (strings[language]) return strings[language];
61
61
  for(let key in strings){
62
- if (key.startsWith(language + "-")) return strings[key];
62
+ if (key.startsWith(language + '-')) return strings[key];
63
63
  }
64
64
  // Nothing close, use english.
65
65
  return strings[defaultLocale];
@@ -68,7 +68,7 @@ function $5b160d28a433310d$var$getLanguage(locale) {
68
68
  // @ts-ignore
69
69
  if (Intl.Locale) // @ts-ignore
70
70
  return new Intl.Locale(locale).language;
71
- return locale.split("-")[0];
71
+ return locale.split('-')[0];
72
72
  }
73
73
 
74
74
 
@@ -19,12 +19,12 @@ const $3e95fbf3429967d1$var$numberFormatCache = new Map();
19
19
  class $3e95fbf3429967d1$export$2f817fcdc4b89ae0 {
20
20
  /** Formats a localized string for the given key with the provided variables. */ format(key, variables) {
21
21
  let message = this.strings.getStringForLocale(key, this.locale);
22
- return typeof message === "function" ? message(variables, this) : message;
22
+ return typeof message === 'function' ? message(variables, this) : message;
23
23
  }
24
- plural(count, options, type = "cardinal") {
25
- let opt = options["=" + count];
26
- if (opt) return typeof opt === "function" ? opt() : opt;
27
- let key = this.locale + ":" + type;
24
+ plural(count, options, type = 'cardinal') {
25
+ let opt = options['=' + count];
26
+ if (opt) return typeof opt === 'function' ? opt() : opt;
27
+ let key = this.locale + ':' + type;
28
28
  let pluralRules = $3e95fbf3429967d1$var$pluralRulesCache.get(key);
29
29
  if (!pluralRules) {
30
30
  pluralRules = new Intl.PluralRules(this.locale, {
@@ -34,7 +34,7 @@ class $3e95fbf3429967d1$export$2f817fcdc4b89ae0 {
34
34
  }
35
35
  let selected = pluralRules.select(count);
36
36
  opt = options[selected] || options.other;
37
- return typeof opt === "function" ? opt() : opt;
37
+ return typeof opt === 'function' ? opt() : opt;
38
38
  }
39
39
  number(value) {
40
40
  let numberFormat = $3e95fbf3429967d1$var$numberFormatCache.get(this.locale);
@@ -46,7 +46,7 @@ class $3e95fbf3429967d1$export$2f817fcdc4b89ae0 {
46
46
  }
47
47
  select(options, value) {
48
48
  let opt = options[value] || options.other;
49
- return typeof opt === "function" ? opt() : opt;
49
+ return typeof opt === 'function' ? opt() : opt;
50
50
  }
51
51
  constructor(locale, strings){
52
52
  this.locale = locale;
@@ -13,12 +13,12 @@ const $6db58dc88e78b024$var$numberFormatCache = new Map();
13
13
  class $6db58dc88e78b024$export$2f817fcdc4b89ae0 {
14
14
  /** Formats a localized string for the given key with the provided variables. */ format(key, variables) {
15
15
  let message = this.strings.getStringForLocale(key, this.locale);
16
- return typeof message === "function" ? message(variables, this) : message;
16
+ return typeof message === 'function' ? message(variables, this) : message;
17
17
  }
18
- plural(count, options, type = "cardinal") {
19
- let opt = options["=" + count];
20
- if (opt) return typeof opt === "function" ? opt() : opt;
21
- let key = this.locale + ":" + type;
18
+ plural(count, options, type = 'cardinal') {
19
+ let opt = options['=' + count];
20
+ if (opt) return typeof opt === 'function' ? opt() : opt;
21
+ let key = this.locale + ':' + type;
22
22
  let pluralRules = $6db58dc88e78b024$var$pluralRulesCache.get(key);
23
23
  if (!pluralRules) {
24
24
  pluralRules = new Intl.PluralRules(this.locale, {
@@ -28,7 +28,7 @@ class $6db58dc88e78b024$export$2f817fcdc4b89ae0 {
28
28
  }
29
29
  let selected = pluralRules.select(count);
30
30
  opt = options[selected] || options.other;
31
- return typeof opt === "function" ? opt() : opt;
31
+ return typeof opt === 'function' ? opt() : opt;
32
32
  }
33
33
  number(value) {
34
34
  let numberFormat = $6db58dc88e78b024$var$numberFormatCache.get(this.locale);
@@ -40,7 +40,7 @@ class $6db58dc88e78b024$export$2f817fcdc4b89ae0 {
40
40
  }
41
41
  select(options, value) {
42
42
  let opt = options[value] || options.other;
43
- return typeof opt === "function" ? opt() : opt;
43
+ return typeof opt === 'function' ? opt() : opt;
44
44
  }
45
45
  constructor(locale, strings){
46
46
  this.locale = locale;
@@ -13,12 +13,12 @@ const $6db58dc88e78b024$var$numberFormatCache = new Map();
13
13
  class $6db58dc88e78b024$export$2f817fcdc4b89ae0 {
14
14
  /** Formats a localized string for the given key with the provided variables. */ format(key, variables) {
15
15
  let message = this.strings.getStringForLocale(key, this.locale);
16
- return typeof message === "function" ? message(variables, this) : message;
16
+ return typeof message === 'function' ? message(variables, this) : message;
17
17
  }
18
- plural(count, options, type = "cardinal") {
19
- let opt = options["=" + count];
20
- if (opt) return typeof opt === "function" ? opt() : opt;
21
- let key = this.locale + ":" + type;
18
+ plural(count, options, type = 'cardinal') {
19
+ let opt = options['=' + count];
20
+ if (opt) return typeof opt === 'function' ? opt() : opt;
21
+ let key = this.locale + ':' + type;
22
22
  let pluralRules = $6db58dc88e78b024$var$pluralRulesCache.get(key);
23
23
  if (!pluralRules) {
24
24
  pluralRules = new Intl.PluralRules(this.locale, {
@@ -28,7 +28,7 @@ class $6db58dc88e78b024$export$2f817fcdc4b89ae0 {
28
28
  }
29
29
  let selected = pluralRules.select(count);
30
30
  opt = options[selected] || options.other;
31
- return typeof opt === "function" ? opt() : opt;
31
+ return typeof opt === 'function' ? opt() : opt;
32
32
  }
33
33
  number(value) {
34
34
  let numberFormat = $6db58dc88e78b024$var$numberFormatCache.get(this.locale);
@@ -40,7 +40,7 @@ class $6db58dc88e78b024$export$2f817fcdc4b89ae0 {
40
40
  }
41
41
  select(options, value) {
42
42
  let opt = options[value] || options.other;
43
- return typeof opt === "function" ? opt() : opt;
43
+ return typeof opt === 'function' ? opt() : opt;
44
44
  }
45
45
  constructor(locale, strings){
46
46
  this.locale = locale;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internationalized/string",
3
- "version": "3.2.3-nightly.4623+b294de874",
3
+ "version": "3.2.3",
4
4
  "description": "Internationalized string formatting and locale negotiation",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -27,5 +27,5 @@
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "gitHead": "b294de874c16fad64bc4b930ccee1c9ffeb1c20f"
30
+ "gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
31
31
  }