Core: Revert default i18n config

This commit is contained in:
Fuma Nama
2025-01-08 17:52:08 +08:00
parent 90a2057572
commit 14b280c1ee
2 changed files with 7 additions and 17 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-core': patch
---
Revert default i18n config
+2 -17
View File
@@ -40,24 +40,9 @@ type WithLocale<T> = T & {
async function getTokenizer(
locale: string,
): Promise<{ language: string } | { tokenizer: Tokenizer }> {
const mandarin = ['cn', 'zh'];
const language =
Object.keys(STEMMERS).find((lang) => STEMMERS[lang] === locale) ?? locale;
if (
mandarin.some((code) => locale === code || locale.startsWith(`${code}-`))
) {
const { createTokenizer } = await import(
'@orama/tokenizers/mandarin' as string
);
return {
tokenizer: await createTokenizer(),
};
}
return {
language,
language:
Object.keys(STEMMERS).find((lang) => STEMMERS[lang] === locale) ?? locale,
};
}