Enhance MultiLanguageProperty : Add default language support#50
Open
Enhance MultiLanguageProperty : Add default language support#50
Conversation
Contributor
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.
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
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:DefaultLanguagesconfiguration to appsettings. - Introduced
MultiLanguagePropertySettingsand wired it into DI. - Updated
SemanticIdHandlerto 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.
.../AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRepository/SemanticIdHandler.cs
Outdated
Show resolved
Hide resolved
....DataEngine.UnitTests/ApplicationLogic/Services/SubmodelRepository/SemanticIdHandlerTests.cs
Outdated
Show resolved
Hide resolved
....DataEngine.UnitTests/ApplicationLogic/Services/SubmodelRepository/SemanticIdHandlerTests.cs
Outdated
Show resolved
Hide resolved
....DataEngine.UnitTests/ApplicationLogic/Services/SubmodelRepository/SemanticIdHandlerTests.cs
Outdated
Show resolved
Hide resolved
.../AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRepository/SemanticIdHandler.cs
Show resolved
Hide resolved
.../AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRepository/SemanticIdHandler.cs
Outdated
Show resolved
Hide resolved
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.
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.
|
Test & Coverage ReportTest Results Summary
Code CoverageUnit Tests Coverage
Minimum allowed line rate is Module Tests Coverage
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


