Closed emmenko closed 5 years ago
I think this is a good idea. I think it would make sense to create a generic API that could take ICU messages plus metadata and output XLIFF. Then I could imagine an option on this plugin to output the "raw" JSON or XLIFF by passing the data it extracts to that generic ICU message --> XLIFF API.
I started looking a the XLIFF spec about a month ago, but never dug deep enough to come up with a plan on how to implement such a thing. I'm also not a localization expert, so my knowledge of the format is simply that it exists, is widely used, and an industry standard interchange format.
It would be great to get some guidance from people who are localization experts to know whether the 1.0 or 2.0 spec is what should be implemented, and which aspects of the spec are most supported, etc.
@ericf glad to see that my wasn't a dumb question :) Yeah, it would be great to get some feedback from someone that has some expertise on the topic.
If it can be of any help, this is what I've come up so far to generate the XLIFF files. https://github.com/emmenko/redux-react-router-async-example/blob/master/scripts/i18nToXliff.js PS: Of course, any suggestion would be much appreciated :)
I'm not sure what granularity XLIFF supports for breaking apart messages into their plural
, select
, etc. segments, but you can use intl-messageformat-parser to get the AST for the defaultMessage
.
Why can't we combine all the messages JSON files into one JSON, then extract message strings into a pure *.txt file and then use XLIFF2ICUConverter? Didn't try it myself though.
@bardt I want the extraction process to be as loss-less as possible and some build process might take the module which the strings originated into account. For this reason the extraction is 1:1 in terms of files and keeps the file system hierarchy. The files are easily merged into one with a grep + map + reduce step.
We now fully support icu format at https://locize.com (and plan to extend based on your feedback / demand):
Your feedback would be very welcome - also if someone could provide us with a file extracted we could look into supporting that for importing (beside xliff, json, ...)
close due to stale
I guess this is not the ideal place to ask such question but it kinda relates to this project I guess.
So after using this plugin we get the JSON files with the extracted messages, which is great. We can also then easily aggregate / transform all those messages into a single file or any other format by running scripts like this one.
In my company, but I guess in general, I'm evaluating the usage of the
XLIFF
format as it seems to be the preferred choice of translator agencies. I was wondering if you know any tool to help with that (so JSON -> XLIFF converter) or if you had some experiences with that. If yes, could you provide some hints which xml elements should be used based on the information extracted by the plugin (the XLIFF 2.0 spec)?Thanks in advance!