(core) updates from grist-core

This commit is contained in:
Paul Fitzpatrick
2023-01-05 09:06:54 -05:00
10 changed files with 2242 additions and 3 deletions

View File

@@ -8,10 +8,11 @@ export async function setupLocale() {
const supportedLngs = getGristConfig().supportedLngs ?? ['en'];
let lng = window.navigator.language || 'en';
// If user agent language is not in the list of supported languages, use the default one.
lng = lng.replace(/-/g, '_');
if (!supportedLngs.includes(lng)) {
// Test if server supports general language.
if (lng.includes("-") && supportedLngs.includes(lng.split("-")[0])) {
lng = lng.split("-")[0]!;
if (lng.includes("_") && supportedLngs.includes(lng.split("_")[0])) {
lng = lng.split("_")[0]!;
} else {
lng = 'en';
}