Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
df167d87
Commit
df167d87
authored
May 13, 2024
by
Aarni Koskela
Browse files
fix: load i18n for /error page
parent
8e5f96e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
src/lib/i18n/index.ts
src/lib/i18n/index.ts
+1
-1
src/routes/+layout.svelte
src/routes/+layout.svelte
+10
-8
No files found.
src/lib/i18n/index.ts
View file @
df167d87
...
...
@@ -37,7 +37,7 @@ const createIsLoadingStore = (i18n: i18nType) => {
return
isLoading
;
};
export
const
initI18n
=
(
defaultLocale
:
string
)
=>
{
export
const
initI18n
=
(
defaultLocale
:
string
|
undefined
)
=>
{
let
detectionOrder
=
defaultLocale
?
[
'
querystring
'
,
'
localStorage
'
]
:
[
'
querystring
'
,
'
localStorage
'
,
'
navigator
'
];
...
...
src/routes/+layout.svelte
View file @
df167d87
...
...
@@ -21,20 +21,22 @@
onMount(async () => {
theme.set(localStorage.theme);
// Check Backend Status
const backendConfig = await getBackendConfig();
let backendConfig = null;
try {
backendConfig = await getBackendConfig();
console.log("Backend config:", backendConfig);
} catch (error) {
console.error("Error loading backend config:", error);
}
// Initialize i18n even if we didn't get a backend config,
// so `/error` can show something that's not `undefined`.
initI18n(backendConfig?.default_locale);
if (backendConfig) {
// Save Backend Status to Store
await config.set(backendConfig);
if ($config.default_locale) {
initI18n($config.default_locale);
} else {
initI18n();
}
await WEBUI_NAME.set(backendConfig.name);
console.log(backendConfig);
if ($config) {
if (localStorage.token) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment