Skip to content

Commit

Permalink
fix: fixes longitude i10n message
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed May 4, 2023
1 parent 4df1590 commit 97adff3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
9 changes: 4 additions & 5 deletions src/l10n/locale.ts
Original file line number Diff line number Diff line change
@@ -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<typeof en> } = {
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]);
Expand Down
8 changes: 4 additions & 4 deletions src/l10n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<length> <unit>`.":
"Could not parse overlay radius. Please make sure it is in the format `<length> <unit>`.",
"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.":
Expand Down
4 changes: 2 additions & 2 deletions src/l10n/locales/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<length> <unit>`.":
"无法解析覆盖半径. 请确保格式为 `<长度> <单位>`.",
"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
Expand Down

0 comments on commit 97adff3

Please sign in to comment.