Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class GuiThemeServiceImpl implements GuiThemeService {

protected Logger logger = LogManager.getLogger(getClass());

private static final List<String> ALLOWED_PRIMITIVE_PROPERTIES = List.of("appTitle", "footer", "loginFooter", "logo", "minilogo", "banner");
private static final List<String> ALLOWED_PRIMITIVE_PROPERTIES = List.of("appTitle", "footer", "loginFooter", "logo", "minilogo", "banner", "defaultLanguage");

private static final List<String> ALLOWED_ERROR_PROPERTIES = List.of("403", "404", "500");

Expand Down
3 changes: 2 additions & 1 deletion ui/public/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,6 @@
"message": "🤔 <strong>Sample Announcement</strong>: New Feature Available: Check out our latest dashboard improvements! <a href='/features'>Learn more</a>",
"startDate": "2025-06-01T00:00:00Z",
"endDate": "2025-07-16T00:00:00Z"
}
},
"defaultLanguage": "en"
}
3 changes: 2 additions & 1 deletion ui/src/components/header/TranslationMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import moment from 'moment'
import 'moment/locale/zh-cn'
import { loadLanguageAsync } from '@/locales'
import { vueProps } from '@/vue-app'

moment.locale('en')

Expand All @@ -63,7 +64,7 @@ export default {
}
},
mounted () {
this.language = this.$localStorage.get('LOCALE') || 'en'
this.language = this.$localStorage.get('LOCALE') || vueProps.$config?.defaultLanguage || 'en'
this.setLocale(this.language)
},
methods: {
Expand Down
5 changes: 5 additions & 0 deletions ui/src/utils/guiTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { vueProps } from '@/vue-app'
import { getAPI } from '@/api'
import { loadLanguageAsync } from '../locales'

export async function applyCustomGuiTheme (accountid, domainid) {
await fetch('config.json').then(response => response.json()).then(config => {
Expand Down Expand Up @@ -69,6 +70,7 @@ async function applyDynamicCustomization (response) {
vueProps.$config.logo = jsonConfig?.logo ?? vueProps.$config.logo
vueProps.$config.minilogo = jsonConfig?.minilogo ?? vueProps.$config.minilogo
vueProps.$config.banner = jsonConfig?.banner ?? vueProps.$config.banner
vueProps.$config.defaultLanguage = vueProps.$localStorage.get('LOCALE') ?? jsonConfig?.defaultLanguage ?? vueProps.$config.defaultLanguage

if (jsonConfig?.error) {
vueProps.$config.error[403] = jsonConfig?.error[403] ?? vueProps.$config.error[403]
Expand All @@ -85,6 +87,9 @@ async function applyDynamicCustomization (response) {
vueProps.$config.favicon = jsonConfig?.favicon ?? vueProps.$config.favicon
vueProps.$config.css = response?.css ?? null

vueProps.$localStorage.set('LOCALE', vueProps.$config.defaultLanguage)
loadLanguageAsync(vueProps.$config.defaultLanguage)
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadLanguageAsync(...) returns a Promise but is not awaited/handled here. Since main.js calls loadLanguageAsync() right after applyCustomGuiTheme, this can trigger duplicate concurrent locale fetches and a race on loadedLanguage/setLocaleMessage. Either await this Promise (and handle errors) or remove this call and rely on the main.js initialization load after setting LOCALE.

Suggested change
loadLanguageAsync(vueProps.$config.defaultLanguage)

Copilot uses AI. Check for mistakes.

await applyStaticCustomization(vueProps.$config.favicon, vueProps.$config.css)
}

Expand Down
Loading