(core) updates from grist-core

This commit is contained in:
Paul Fitzpatrick
2023-02-06 08:51:26 -05:00
18 changed files with 914 additions and 45 deletions

View File

@@ -75,7 +75,12 @@ export function getCountryCode(locale: string) {
if (locale === 'en') { return 'US'; }
let countryCode = locale.split(/[-_]/)[1];
if (countryCode) { return countryCode.toUpperCase(); }
countryCode = locale.toUpperCase();
// Some defaults that we support and can't be read from language code.
countryCode = {
'uk': 'UA', // Ukraine
}[locale] ?? locale.toUpperCase();
// Test if we can use language as a country code.
if (localeCodes.map(code => code.split(/[-_]/)[1]).includes(countryCode)) {
return countryCode;