New config.json variable to set the ACS default language (#12863)

* New config.json variable to set the ACS default language

* Address review
This commit is contained in:
Henrique Sato 2026-04-13 14:37:45 -03:00 committed by GitHub
parent 5b696c0ec7
commit ed575cc0a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 3 deletions

View File

@ -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");

View File

@ -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"
}

View File

@ -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')
@ -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: {

View File

@ -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 => {
@ -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]
@ -85,6 +87,11 @@ async function applyDynamicCustomization (response) {
vueProps.$config.favicon = jsonConfig?.favicon ?? vueProps.$config.favicon
vueProps.$config.css = response?.css ?? null
if (vueProps.$config.defaultLanguage) {
vueProps.$localStorage.set('LOCALE', vueProps.$config.defaultLanguage)
loadLanguageAsync()
}
await applyStaticCustomization(vueProps.$config.favicon, vueProps.$config.css)
}