Skip to content

Feature request: generate translations from node-type #47

Open
@PRGfx

Description

When creating translated node-types I often find myself writing down the definition with all the "i18n" labels and later open both the node-type and a translation file side-by-side to see which strings I need – sometimes trying to remember what that label of the node-creation-dialog label was etc.

I think it would be really handy to have a context action on node-type definitions to generate xlf files, maybe even on a "label"-basis.

For each language (i.e. folder in Resources/Private/Translations) it would create a file based on the node-type name and stub all properties etc. (e.g. everything with "label: i18n" (or help.message, formatting.placeholder etc.) and a "mappable" path (i.e. we know how to map ui.label, properties.*.ui.label etc. but would maybe ignore other paths).

The default-language could be configurable in the plugin settings. Maybe it would make sense to have the stub configurable as well.

I recognize that it's more difficult to update a translation file (i.e. reading the XML and writing it back - in the best case while preserving comments or whitespaces).
If that would be possible however, it would be a cool context-action to of course just update the translation file and "extract a string" into a translation.
In any case I think it might be possible to get the "content" of /xliff/file/body as string, write it back and append trans-units for new properties/translatables if no matching trans-unit id was found in the file.

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions