From 97adff3007a4e75ae0efa67923d61ab05eae94cd Mon Sep 17 00:00:00 2001 From: Jeremy Valentine <38669521+valentine195@users.noreply.github.com> Date: Thu, 4 May 2023 10:37:25 -0400 Subject: [PATCH] fix: fixes longitude i10n message --- src/l10n/locale.ts | 9 ++++----- src/l10n/locales/en.ts | 8 ++++---- src/l10n/locales/zh_CN.ts | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/l10n/locale.ts b/src/l10n/locale.ts index 4edbb53..65516b5 100644 --- a/src/l10n/locale.ts +++ b/src/l10n/locale.ts @@ -1,17 +1,16 @@ import en from "./locales/en"; import zhCN from "./locales/zh_CN"; - -const lang = window.localStorage.getItem('language'); +const lang = window.localStorage.getItem("language"); const localeMap: { [k: string]: Partial } = { en, - zh: zhCN, + zh: zhCN }; -const userLocale = localeMap[lang || 'en']; +const userLocale = localeMap[lang || "en"]; export default function t(str: keyof typeof en, ...inserts: string[]): string { - let localeStr = (userLocale && userLocale[str]) ?? en[str]; + let localeStr = (userLocale && userLocale[str]) ?? en[str] ?? str; for (let i = 0; i < inserts.length; i++) { localeStr = localeStr.replace(`%${i + 1}`, inserts[i]); diff --git a/src/l10n/locales/en.ts b/src/l10n/locales/en.ts index c2eb468..a71e7e5 100644 --- a/src/l10n/locales/en.ts +++ b/src/l10n/locales/en.ts @@ -13,10 +13,10 @@ export default { "Could not parse GeoJSON file": "Could not parse GeoJSON file", "Could not parse overlay radius. Please make sure it is in the format ` `.": "Could not parse overlay radius. Please make sure it is in the format ` `.", - "There was an error with the provided latitude. Using defaults.": - "There was an error with the provided latitude. Using defaults.", - "There was an error with the provided longitude. Using defaults.": - "There was an error with the provided longitude. Using defaults.", + "There was an error with the provided latitude. Using default.": + "There was an error with the provided latitude. Using default.", + "There was an error with the provided longitude. Using default.": + "There was an error with the provided longitude. Using default.", //loader.ts "There was an issue getting the image dimensions.": diff --git a/src/l10n/locales/zh_CN.ts b/src/l10n/locales/zh_CN.ts index 000e8e9..506de0b 100644 --- a/src/l10n/locales/zh_CN.ts +++ b/src/l10n/locales/zh_CN.ts @@ -13,9 +13,9 @@ export default { "Could not parse GeoJSON file": "无法解析 GeoJSON 文件", "Could not parse overlay radius. Please make sure it is in the format ` `.": "无法解析覆盖半径. 请确保格式为 `<长度> <单位>`.", - "There was an error with the provided latitude. Using defaults.": + "There was an error with the provided latitude. Using default.": "提供的纬度有误. 使用默认值.", - "There was an error with the provided longitude. Using defaults.": + "There was an error with the provided longitude. Using default.": "提供的经度有误. 使用默认值.", //loader.ts