@terraware/web-components 4.3.3-rc.2 → 5.0.0
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/package.json +1 -1
- package/strings/locales.d.ts.map +1 -1
- package/strings/locales.js +5 -1
package/package.json
CHANGED
package/strings/locales.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/strings/locales.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,EAAE,aAAa,EAK3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,8BAA4B,KAAG,aAAa,EACsB,CAAC;AAEvG;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,aAAa,EAAE,EAAE,QAAQ,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/strings/locales.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,EAAE,aAAa,EAK3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,8BAA4B,KAAG,aAAa,EACsB,CAAC;AAEvG;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,aAAa,EAAE,EAAE,QAAQ,MAAM,KAAG,aAQ1E,CAAC"}
|
package/strings/locales.js
CHANGED
|
@@ -33,6 +33,10 @@ const getSupportedLocales = (includeInDevelopment = false) => includeInDevelopme
|
|
|
33
33
|
* If none of the locales in the list matches, returns the first locale from the list. The list
|
|
34
34
|
* must not be empty.
|
|
35
35
|
*/
|
|
36
|
-
const findLocaleDetails = (locales, locale) => locales.reduce((bestMatch, candidate) =>
|
|
36
|
+
const findLocaleDetails = (locales, locale) => locales.reduce((bestMatch, candidate) =>
|
|
37
|
+
// The best match so far is only worth keeping if it's a prefix of the requested locale too.
|
|
38
|
+
// reduce() seeds with the first locale without checking it, so a leading 'en-US' would
|
|
39
|
+
// otherwise be treated as a match for 'en' and never replaced.
|
|
40
|
+
locale.startsWith(candidate.id) && (!locale.startsWith(bestMatch.id) || candidate.id.length > bestMatch.id.length) ? candidate : bestMatch);
|
|
37
41
|
|
|
38
42
|
export { findLocaleDetails, getSupportedLocales, supportedLocales };
|