Files
editor/src/i18n.ts
Hanjin Lee c3a35354f7 Added Korean language support (#1596)
Added Korean language support.

<img width="860" height="274" alt="image"
src="https://github.com/user-attachments/assets/e726d910-81cb-4cc7-8062-18f04592332f"
/>

To ensure accurate meaning, some terms were written following the
criteria below.

- Map → '맵' : 'Map' is rendered as '맵', which is more commonly used than
'지도' in GIS tools.
- Stops → '기준점' : Transliterating the term as '스톱' does not clearly
convey its meaning. Since it represents a reference point used for
interpolation, it is translated as '기준점'.
- Light → '라이트' : Literal translations such as '광원', '빛' or '조명' awkward
in a 3D rendering context, so the term is transliterated.
- Focus → '포커스' : The literal translation '초점' sounds awkward in a UI
context, so it has been transliterated for clarity.
- Terrain → '터레인' : In the context of 3D maps, '터레인' is a more commonly
used term than '지형'.
- Paint → '페인트' : The term is transliterated to preserve its meaning as
defined in the Style Specification.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Harel M <harel.mazor@gmail.com>
2025-12-17 08:27:22 +00:00

45 lines
1.4 KiB
TypeScript

import i18n from "i18next";
import detector from "i18next-browser-languagedetector";
import resourcesToBackend from "i18next-resources-to-backend";
import { initReactI18next } from "react-i18next";
export const supportedLanguages = {
"de": "Deutsch",
"en": "English",
"fr": "Français",
"he": "עברית",
"it": "Italiano",
"ja": "日本語",
"ko": "한국어",
"zh": "简体中文"
} as const;
i18n
.use(detector) // detect user language from browser settings
.use(
resourcesToBackend((lang: string, ns: string) => {
if (lang === "en") {
// English is the default language, so we don't need to load any resources for it.
return {};
}
return import(`./locales/${lang}/${ns}.json`);
})
)
.use(initReactI18next) // required to initialize react-i18next
.init({
supportedLngs: Object.keys(supportedLanguages),
keySeparator: false, // we do not use keys in form messages.welcome
nsSeparator: false,
interpolation: {
escapeValue: false // React already escapes for us
},
saveMissing: true, // this needs to be set for missingKeyHandler to work
fallbackLng: false, // we set the fallback to false so we can get the correct language in the missingKeyHandler
missingKeyHandler: (lngs, _ns, key) => {
if (lngs[0] === "en") { return; }
console.warn(`Missing translation for "${key}" in "${lngs.join(", ")}"`);
}
});
export default i18n;