Skip to content

Enhance MultiLanguageProperty : Add default language support#50

Open
mm-hsh wants to merge 9 commits intodevelopfrom
feature/455-Configurable-Multi-Language
Open

Enhance MultiLanguageProperty : Add default language support#50
mm-hsh wants to merge 9 commits intodevelopfrom
feature/455-Configurable-Multi-Language

Conversation

@mm-hsh
Copy link
Contributor

@mm-hsh mm-hsh commented Feb 16, 2026

  • Introduced a new MultiLanguageProperty configuration section for specifying default languages in appsettings.json.
  • Added MultiLanguagePropertySettings class and updated dependency injection.
  • Modified SemanticIdHandler to ensure MultiLanguageProperty elements always include values for configured default languages, improving consistency and localization.
  • Added unitTest

Introduced a new MultiLanguageProperty configuration section for specifying default languages in appsettings.json. Added MultiLanguagePropertySettings class and updated dependency injection. Modified SemanticIdHandler to ensure MultiLanguageProperty elements always include values for configured default languages, improving consistency and localization.
Add support for default languages in SemanticIdHandler via MultiLanguagePropertySettings. Update logic to merge template and default languages, and log at Information level. Expand unit tests to cover various default language scenarios and improve TestData helpers for multi-language cases. Improves robustness and test coverage for MultiLanguageProperty handling.
@github-actions
Copy link

github-actions bot commented Feb 16, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link

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 configurable default-language behavior for MultiLanguageProperty handling so extracted semantic trees and filled templates consistently include a configured set of languages.

Changes:

  • Added MultiLanguageProperty:DefaultLanguages configuration to appsettings.
  • Introduced MultiLanguagePropertySettings and wired it into DI.
  • Updated SemanticIdHandler to merge configured default languages into extracted nodes and template fill-out logic; added/updated unit tests and test data.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
source/AAS.TwinEngine.DataEngine/appsettings.json Adds MultiLanguageProperty.DefaultLanguages defaults.
source/AAS.TwinEngine.DataEngine/appsettings.development.json Mirrors default-language config for development.
source/AAS.TwinEngine.DataEngine/ServiceConfiguration/InfrastructureDependencyInjectionExtensions.cs Binds MultiLanguagePropertySettings from configuration into options.
source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRepository/SemanticIdHandler.cs Merges default languages during extract/fill-out for MultiLanguageProperty.
source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRepository/Config/MultiLanguagePropertySettings.cs New options class for default languages configuration.
source/AAS.TwinEngine.DataEngine.UnitTests/ApplicationLogic/Services/SubmodelRepository/TestData.cs Adds test fixtures covering multi-language + default language scenarios.
source/AAS.TwinEngine.DataEngine.UnitTests/ApplicationLogic/Services/SubmodelRepository/SemanticIdHandlerTests.cs Adds/updates tests for default-language behavior.

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

Refactored language collection logic to maintain insertion order and uniqueness in MultiLanguageProperty nodes. Tests now sort and assert explicit language order. Default languages are appended in order only if missing. Renamed a test for clarity and fixed potential null reference by using FirstOrDefault. These changes improve predictability and correctness of language handling.
Updated MultiPluginDataHandler to only check for missing semantic IDs on nodes with cardinalities One or OneToMany, excluding ZeroToOne and ZeroToMany. Also, set the DefaultLanguages array in appsettings.json to empty, removing "de" and "en" as defaults.
Removed [InlineData] cases for Cardinality.ZeroToOne and Cardinality.ZeroToMany from the SplitByPluginManifests_ShouldThrow_WhenRequiredSemanticIdNotSupported test. The test now only runs for Cardinality.One and Cardinality.OneToMany.
@mm-hsh mm-hsh requested review from mcn-mm and mm-asha February 16, 2026 09:12
mm-hsh and others added 4 commits February 16, 2026 17:02
Introduce MultiLanguagePropertySettingsValidator to enforce BCP-47 compliance for DefaultLanguages, using regex and CultureInfo checks. Register the validator in DI and update options binding to use AddOptions and ValidateOnStart. Refactor SemanticIdHandler to use HashSet for language handling and remove logging of added default languages. Update MultiLanguagePropertySettings to use init-only IList<string>. Add comprehensive unit tests for the validator. Adjust test data namespaces for consistency and apply minor code improvements.
Moved validator and tests to .Helper namespace for clarity. Simplified IsValidBcp47LanguageTag to use only regex validation, removing CultureInfo checks. Updated using directives and improved error message formatting and XML documentation.
@sonarqubecloud
Copy link

@github-actions
Copy link

Test & Coverage Report

Test Results Summary

Metric Count
✅ Passed 488
❌ Failed 0
⏭️ Skipped 0

View Detailed Test Results


Code Coverage

Unit Tests Coverage

Package Line Rate Branch Rate Complexity Health
AAS.TwinEngine.DataEngine 90% 81% 1212
Summary 90% (2086 / 2311) 81% (860 / 1068) 1212

Minimum allowed line rate is 80%

Module Tests Coverage

Package Line Rate Branch Rate Complexity Health
AAS.TwinEngine.DataEngine 56% 40% 1212
Summary 56% (1295 / 2311) 40% (429 / 1068) 1212

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.

2 participants

Comments