This is an automated email from the ASF dual-hosted git repository.

fabricio pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new ed575cc0a10 New config.json variable to set the ACS default language 
(#12863)
ed575cc0a10 is described below

commit ed575cc0a1071e50272ed7e3d3491b9aac669432
Author: Henrique Sato <[email protected]>
AuthorDate: Mon Apr 13 14:37:45 2026 -0300

    New config.json variable to set the ACS default language (#12863)
    
    * New config.json variable to set the ACS default language
    
    * Address review
---
 .../java/org/apache/cloudstack/gui/theme/GuiThemeServiceImpl.java  | 2 +-
 ui/public/config.json                                              | 3 ++-
 ui/src/components/header/TranslationMenu.vue                       | 3 ++-
 ui/src/utils/guiTheme.js                                           | 7 +++++++
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/server/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeServiceImpl.java 
b/server/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeServiceImpl.java
index 1cb80e3dc8d..6fb6a1235f7 100644
--- 
a/server/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeServiceImpl.java
+++ 
b/server/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeServiceImpl.java
@@ -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");
 
diff --git a/ui/public/config.json b/ui/public/config.json
index 3d50f981185..81d3938a5de 100644
--- a/ui/public/config.json
+++ b/ui/public/config.json
@@ -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"
 }
diff --git a/ui/src/components/header/TranslationMenu.vue 
b/ui/src/components/header/TranslationMenu.vue
index 4cd369d3bf6..f68d9e3849d 100644
--- a/ui/src/components/header/TranslationMenu.vue
+++ b/ui/src/components/header/TranslationMenu.vue
@@ -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: {
diff --git a/ui/src/utils/guiTheme.js b/ui/src/utils/guiTheme.js
index b1a7209fd27..6499539f052 100644
--- a/ui/src/utils/guiTheme.js
+++ b/ui/src/utils/guiTheme.js
@@ -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)
 }
 

Reply via email to