A literal resource key #("Hallo"@de, "Hello"@en) currently contains only its translations (but no key—since it is never looked up in the translation tables).
However, if you want to use a literal resource key to save a translation entered via the GUI in the translation tables, it can be useful to also encode the key within the literal—the key under which the entered translations will later be stored (the key whose existing translations are to be overwritten by the new translations).
Usage
#!java
Builder builder = ResKey.builder("my.key");
builder.add(en(), "foo");
builder.add(de(), "bar");
ResKey key = builder.build();
Then ` key.getKey() ` returns the value ` my.key`.
In addition, a better XML format for resource keys is necessary if you want to use literal keys to export the current translations:
Instead of <a text='#("foo"@en, "bar"@de)'/>, use:
#!xml
<a>
<text>
<en>foo</en>
<de>bar</de>
</text>
</a>
This format can also store a target key:
#!xml
<a>
<text key="my.key">
<en>foo</en>
<de>bar</de>
</text>
</a>
Test
- test.com.top_logic.basic.util.TestResKeyXMLBinding