Motivation
One occasionally runs into cases where labels of other parties' packages have to be overridden, with the most prominent example being the Neos backend. (see https://jira.neos.io/browse/FLOW-61)Staus Quo
There are a few workarounds for doing this (see https://jira.neos.io/browse/NEOS-1258) that are mostly based on label override / replacement configuration.Why I consider this un-Neos-y
In the current state, all components (inspector, backend flash messages, modules, you name it) have to define their own configuration how to add or override labels. This doesn't look like fun, neither for developers having to consider implementing such mechanisms with every step they take, nor for integrators who have to set Yet Another Configuration Option™ in addition to providing the labels.Proposition: how to improve the situation
Flow should provide override capabilities within the internationalization component itself.Labels are, within the localization context, identified by three properties: the package they belong to, the source path within that package and their id (or value, which afaik is supported but disencouraged).
The current implementation derives package and source from XLIFF file’s position in the file system. This means that the labels one provides in one’s package can never leave that package scope and thus are incapable of overriding anything by themselves.
To improve this, XLIFF’s own structure can come in very handy. If you look at label files, you see some standard fields that have been ignored in the past:
<file original="" product-name="" source-language="en" datatype="plaintext" target-language="de">
The XLIFF specification for original is:
The original attribute specifies the name of the original file from which the contents of a element has been extracted.
This should be close enough to define the source.
Also product-name should do as a package reference:
The name of the product which uses this file.
With something like <file original="NodeTypes/Document" product-name="TYPO3.Neos" source-language="en" datatype="plaintext" target-language="de">
one could easily override the default labels, if Flow evaluates those parameters as an override for package name and file path where the XLIFF file is located. No reconfiguration of anything needed.