Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.3.7 #3536

Merged
merged 24 commits into from
Jun 30, 2024
Merged

0.3.7 #3536

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift click to select a range
9111970
Update translation.json
aguvener Jun 28, 2024
3cc5da8
Update translation.json for minor change
aguvener Jun 28, 2024
57c3305
Fix: admin role for OIDC signup for first user
Jun 28, 2024
7d10dac
Fix: set jwt_token to cookie (instead of token from OIDC)
Jun 28, 2024
4d3e1ff
chore(deps): bump authlib from 1.3.0 to 1.3.1
dependabot[bot] Jun 28, 2024
269db07
fix: isInstance of streamingResponse but content-type is application/…
Peter-De-Ath Jun 28, 2024
8ab4b7a
i18n: Update Chinese translation
KarlLee830 Jun 28, 2024
2ef8992
added indonesian language
Naufal05R Jun 29, 2024
5b848dc
added indonesian language
Naufal05R Jun 29, 2024
45cb1c0
Updated Catalan Translation
Jun 29, 2024
6e03a1c
i18n: Updated Catalan Translation
Jun 29, 2024
776082d
i18n: Updated Catalan Translation
aleixdorca Jun 29, 2024
98ae064
Merge pull request #3525 from aleixdorca/dev
tjbck Jun 29, 2024
58398b6
Merge pull request #3514 from KarlLee830/translate
tjbck Jun 29, 2024
d3a67b4
Merge pull request #3499 from Semihal/fix-oauth-openid
tjbck Jun 29, 2024
27709c8
Merge pull request #3497 from aguvener/dev
tjbck Jun 29, 2024
73135b6
Merge pull request #3511 from Peter-De-Ath/ollama-chat-no-stream
tjbck Jun 29, 2024
61972ca
Merge pull request #3519 from Naufal05R/main
tjbck Jun 29, 2024
d056783
fix
tjbck Jun 30, 2024
16454c0
chore: format
tjbck Jun 30, 2024
41c55fb
enh: boilerplate
tjbck Jun 30, 2024
56137ac
Merge pull request #3507 from open-webui/dependabot/pip/authlib-1.3.1
tjbck Jun 30, 2024
df8d1da
refac: browser language detection
tjbck Jun 30, 2024
58d8dd9
chore: bump
tjbck Jun 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refac: browser language detection
  • Loading branch information
tjbck committed Jun 30, 2024
commit df8d1dacc4c57d4e91935759a68911cd33292d16
7 changes: 7 additions & 0 deletions src/lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
10 changes: 5 additions & 5 deletions src/routes/ layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 31,7 @@

import { WEBUI_BASE_URL, WEBUI_HOSTNAME } from '$lib/constants';
import i18n, { initI18n, getLanguages } from '$lib/i18n';
import { bestMatchingLanguage } from '$lib/utils';

setContext('i18n', i18n);

Expand Down Expand Up @@ -92,12 93,11 @@
// so `/error` can show something that's not `undefined`.

const languages = await getLanguages();
const browserLanguages = navigator.languages
? navigator.languages
: [navigator.language || navigator.userLanguage];

const browserLanguage = navigator.languages
? navigator.languages[0]
: navigator.language || navigator.userLanguage;

initI18n(languages.includes(browserLanguage) ? browserLanguage : backendConfig?.default_locale);
initI18n(bestMatchingLanguage(languages, browserLanguages, backendConfig.default_locale));

if (backendConfig) {
// Save Backend Status to Store
Expand Down
Loading