Skip to content

Make Metadata.File default language configurable - #3850

Open
tushabe wants to merge 1 commit into
OpenEMS:developfrom
Nearly-Free-Energy:feature/metadata-file-default-language
Open

Make Metadata.File default language configurable#3850
tushabe wants to merge 1 commit into
OpenEMS:developfrom
Nearly-Free-Energy:feature/metadata-file-default-language

Conversation

@tushabe

@tushabe tushabe commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Make the shared user language of Metadata.File configurable through its OSGi component configuration.

Metadata.File currently hardcodes German in a static field. As a result, Backend installations that use this metadata provider cannot choose another initial UI language, and changing the language affects all provider instances in the JVM.

This change:

  • adds a defaultLanguage OSGi setting, defaulting to DE for backwards compatibility
  • keeps language state scoped to each Metadata.File instance
  • creates the shared user with the configured language during activation
  • updates the current shared user immediately when updateUserLanguage() is called
  • documents the setting and all currently supported Language enum values
  • adds focused tests for configuration, instance isolation, and runtime language updates

Example:

path="/var/opt/openems/metadata.json"
defaultLanguage="EN"

Validation

Validated against the current upstream develop branch with:

./gradlew --no-daemon -Dorg.gradle.vfs.watch=false \
  :io.openems.backend.metadata.file:checkstyleMain \
  :io.openems.backend.metadata.file:checkstyleTest \
  :io.openems.backend.metadata.file:test \
  :io.openems.backend.metadata.file:jar

./gradlew --no-daemon -Dorg.gradle.vfs.watch=false \
  checkstyleAll build resolve --console=plain --warn

Both commands completed successfully.

The same implementation was also built into the Nearly Free Energy pilot Backend, deployed with defaultLanguage="EN", and verified through an actual UI logout/login and a Backend container restart. The UI opened in English and the configured default remained effective after restart.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #3850      +/-   ##
=============================================
+ Coverage      60.63%   60.65%   +0.03%     
  Complexity       105      105              
=============================================
  Files           3496     3496              
  Lines         153207   153212       +5     
  Branches       11691    11691              
=============================================
+ Hits           92887    92921      +34     
+ Misses         56824    56804      -20     
+ Partials        3496     3487       -9     
🚀 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.

@tushabe
tushabe force-pushed the feature/metadata-file-default-language branch from 74c36ca to 07b153e Compare July 24, 2026 14:24
@tushabe
tushabe marked this pull request as ready for review July 24, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant