1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2024-10-27 20:34:29 +00:00
This commit is contained in:
FelisNivalis 2024-07-10 18:30:12 +08:00 committed by GitHub
commit 6ff3b5eb97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,7 +32,10 @@ function mapLanguageCodeToId(languageKey) {
// Try to match by key or short key // Try to match by key or short key
for (const id in LANGUAGES) { for (const id in LANGUAGES) {
const data = LANGUAGES[id]; const data = LANGUAGES[id];
const code = data.code.toLowerCase(); const shortCode = data.code.toLowerCase();
const region = data.region.toLowerCase();
const code = shortCode + (region ? "-" + region : "");
if (code === key) { if (code === key) {
console.log("-> Match", languageKey, "->", id); console.log("-> Match", languageKey, "->", id);
return id; return id;
@ -46,8 +49,7 @@ function mapLanguageCodeToId(languageKey) {
// If none found, try to find a better alternative by using the base language at least // If none found, try to find a better alternative by using the base language at least
for (const id in LANGUAGES) { for (const id in LANGUAGES) {
const data = LANGUAGES[id]; const data = LANGUAGES[id];
const code = data.code.toLowerCase(); const shortCode = data.code.toLowerCase();
const shortCode = code.split("-")[0];
if (shortCode === key) { if (shortCode === key) {
console.log("-> Desperate Match", languageKey, "->", id); console.log("-> Desperate Match", languageKey, "->", id);