mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-29 00:24:39 +01:00
refac: browser language detection
This commit is contained in:
@@ -746,3 +746,10 @@ export const extractFrontmatter = (content) => {
|
||||
|
||||
return frontmatter;
|
||||
};
|
||||
|
||||
// Function to determine the best matching language
|
||||
export const bestMatchingLanguage = (supportedLanguages, preferredLanguages, defaultLocale) => {
|
||||
const languages = supportedLanguages.map((lang) => lang.code);
|
||||
const match = preferredLanguages.find((lang) => languages.includes(lang));
|
||||
return match || defaultLocale;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user