Skip to content

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

Open
hsato03 wants to merge 1 commit intoapache:mainfrom
scclouds:default-language-variable-config-json
Open

New config.json variable to set the ACS default language#12863
hsato03 wants to merge 1 commit intoapache:mainfrom
scclouds:default-language-variable-config-json

Conversation

@hsato03
Copy link
Member

@hsato03 hsato03 commented Mar 19, 2026

Description

This PR aims to extend the config.json file with the defaultLanguage variable to allow the definition of the default language used by ACS.

The default value of this variable is en, meaning the default language will be English. To change the variable's value to other languages, it must be set with the language code of the desired language. For example, to set the default ACS language to Brazilian Portuguese, the variable should have the value pt_BR.

Table of supported language codes
Language code Language
en English
hi Hindi
ja_JP Japanese
ko_KR Korean
zh_CN Chinese (Simplified)
ar Arabic
ca Catalan
de_DE German
es Spanish
fr_FR French
it_IT Italian
hu Hungarian
nl_NL Dutch
nb_NO Norwegian Bokmål
pl Polish
pt_BR Brazilian Portuguese
ru_RU Russian
el_GR Greek

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

  1. I modified the config.json file by setting the defaultLanguage variable to the value ja_JP. Then, I opened the ACS GUI in an incognito tab and verified that ACS was in Japanese;
  2. I created a public GUI theme using the new variable with the value pt_BR. Then, I opened the ACS GUI in an incognito tab and verified that ACS was in Brazilian Portuguese;
create guitheme name="pt_BR theme" jsonconfiguration='{"defaultLanguage": "pt_BR"}'
  1. I removed the GUI theme and the defaultLanguage variable from the config.json file. Then, I opened the ACS GUI in an incognito tab and verified that the English language was still used by default.

How did you try to break this feature and the system with this change?

@hsato03
Copy link
Member Author

hsato03 commented Mar 19, 2026

@blueorangutan package

@blueorangutan
Copy link

@hsato03 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 18.02%. Comparing base (b744824) to head (d59b3ed).

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12863      +/-   ##
============================================
- Coverage     18.02%   18.02%   -0.01%     
+ Complexity    16450    16448       -2     
============================================
  Files          5968     5968              
  Lines        537086   537090       +4     
  Branches      65961    65961              
============================================
- Hits          96819    96797      -22     
- Misses       429347   429373      +26     
  Partials      10920    10920              
Flag Coverage Δ
uitests 3.53% <ø> (+<0.01%) ⬆️
unittests 19.18% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17201

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a defaultLanguage setting to the UI configuration/theme flow so ACS can start in a configured locale by default (instead of always defaulting to English unless the user previously selected a locale).

Changes:

  • Adds defaultLanguage to ui/public/config.json (default en).
  • Propagates defaultLanguage through GUI theme application and persists it into LOCALE storage.
  • Allows defaultLanguage through the GUI theme JSON configuration API validation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
ui/src/utils/guiTheme.js Reads/sets defaultLanguage, writes LOCALE, and triggers locale loading during theme application.
ui/src/components/header/TranslationMenu.vue Uses configured default language when LOCALE isn’t present.
ui/public/config.json Adds new defaultLanguage config entry with default en.
server/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeServiceImpl.java Allows defaultLanguage in theme JSON primitive properties whitelist.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants