Skip to content

Add translation injection support for bilingual knxprod generation#2

Open
akrabi wants to merge 2 commits into
OpenKNX:mainfrom
akrabi:translations
Open

Add translation injection support for bilingual knxprod generation#2
akrabi wants to merge 2 commits into
OpenKNX:mainfrom
akrabi:translations

Conversation

@akrabi

@akrabi akrabi commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Add TranslationHelper class that loads translation JSON files and injects
blocks into expanded XML before signing. SignHelper gains a
translationsPath parameter on ExportKnxprod/ExportKnxprodAsync - when set,
translations are injected in memory before SplitXml, producing bilingual
knxprod files following the KNX standard TranslationUnit/TranslationElement
structure.

Key details:

  • LoadTranslations: accepts file or directory path, merges all JSON files
  • InjectTranslations: walks translatable elements (Parameters, ComObjects,
    CatalogItems, etc.), creates Translation entries for matching text
  • Multiple attributes per element supported (Text, Name, FunctionText, etc.)
  • Original cached XML is never modified (temp file used and cleaned up)
  • Backward compatible: empty translationsPath = existing behavior unchanged

akrabi added 2 commits April 25, 2026 12:25
Add TranslationHelper class that loads translation JSON files and injects
<Languages> blocks into expanded XML before signing. SignHelper gains a
translationsPath parameter on ExportKnxprod/ExportKnxprodAsync - when set,
translations are injected in memory before SplitXml, producing bilingual
knxprod files following the KNX standard TranslationUnit/TranslationElement
structure.

Key details:
- LoadTranslations: accepts file or directory path, merges all JSON files
- InjectTranslations: walks translatable elements (Parameters, ComObjects,
  CatalogItems, etc.), creates Translation entries for matching text
- Multiple attributes per element supported (Text, Name, FunctionText, etc.)
- Original cached XML is never modified (temp file used and cleaned up)
- Backward compatible: empty translationsPath = existing behavior unchanged
Covers LoadTranslations (file, directory, recursive, merge, malformed JSON,
empty values, nonexistent path) and InjectTranslations (parameter text,
multi-attribute, catalog items, language identifier, element/attribute types,
existing languages merge, duplicate suppression, null/missing root safety).

Also updates .gitignore to use non-rooted patterns so bin/obj are excluded
in subdirectories too.
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