Files
memos/web/src/utils/i18n.ts
2023-04-05 23:31:15 +08:00

8 lines
231 B
TypeScript

export const convertLanguageCodeToLocale = (codename: string): Locale => {
if (codename === "zh-TW" || codename === "zh-HK") {
return "hant";
}
const shortCode = codename.substring(0, 2);
return shortCode as Locale;
};