mirror of
https://github.com/open-webui/open-webui
synced 2024-11-07 09:09:53 +00:00
commit
66182bac75
@ -5,7 +5,6 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
|
||||||
## [0.3.7] - 2024-06-29
|
## [0.3.7] - 2024-06-29
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -750,6 +750,11 @@ export const extractFrontmatter = (content) => {
|
|||||||
// Function to determine the best matching language
|
// Function to determine the best matching language
|
||||||
export const bestMatchingLanguage = (supportedLanguages, preferredLanguages, defaultLocale) => {
|
export const bestMatchingLanguage = (supportedLanguages, preferredLanguages, defaultLocale) => {
|
||||||
const languages = supportedLanguages.map((lang) => lang.code);
|
const languages = supportedLanguages.map((lang) => lang.code);
|
||||||
const match = preferredLanguages.find((lang) => languages.includes(lang));
|
|
||||||
|
const match = preferredLanguages
|
||||||
|
.map((prefLang) => languages.find((lang) => lang.startsWith(prefLang)))
|
||||||
|
.find(Boolean);
|
||||||
|
|
||||||
|
console.log(languages, preferredLanguages, match, defaultLocale);
|
||||||
return match || defaultLocale;
|
return match || defaultLocale;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user