One new feature available in Alloy 1.2 is a command-line option to extract i18n strings from your TSS and JS files and append any missing keys to the default or a specific strings.xml
file. If the file doesn’t exist, it will even create it for you.
I think this is a pretty nice new feature of Alloy. I can now just use L()
without having to think about adding the key to the strings.xml
file(s) as well. There’s no documentation yet, but this is how it works:
1 2 3 4 5 6 7 8 |
// Displays the default i18n/en/strings.xml before and after extract alloy extract-i18n // Same as above, but actually writes to the file alloy extract-i18n --apply // Same as above, but compares with and writes to i18n/nl/strings.xml alloy extract-i18n nl --apply |
Check the JIRA ticket for more background information.
Even better
What it the feature lacks is the extraction i18n properties like textid
and titleid
from both JS/TSS as well as XML files. I’ve done a PR for this.
Another PR I just did adds a clean
option to comment out any un-used strings.