Support .arb format
daniel-sc opened this issue · 3 comments
Angular is now allowing extraction to .arb format which is essentially a json and it seems it has all the same infor as .xlf format. Documentation is here https://angular.io/guide/i18n-common-translation-files#change-the-source-language-file-format and from there there is reference to .arb schema/format https://github.com/google/app-resource-bundle/wiki/ApplicationResourceBundleSpecification.
Originally posted by @co-dax in #44 (comment)
Anyone: Please upvote this issue if you'd be interested in using this library with the "arb" format!
@daniel-sc, I think the only thing that .xlf has but .arb does not have is the following tag in .xlf <target state="translated">Some translation...</target>
where state
attribute is indicating the current state of translation (whether it needs review, is it translated, needs works...) but it is not something strictly related to the traslation content and it is rather an "accessory" to improve translation workflow.
I am currently using ng-extract-i18n-merge to extract translation and translate the files, then I am using a tool to extract angular translation json file from the translated .xlf file and load the translation in Angular dynamically.
@co-dax I'm not quite sure how a meaningful workflow/translation process could work without a "state" information. This tool could of course remove/insert obsolete/new translations to the language file(s), but how could a translator find the texts that need to be translated? Additionally, a missing "source" text, will make it difficult to update translations for changed texts. Do you have an idea what I might be missing?
@daniel-sc I agree with you that without state
attribute in the target
tag there would be no way for translators to know when a source text has been changed. The only partial way around it would be adding a new/custom attribute in the generated source translation file but this would not make it easy for translators to identify updated source text so we may want to create a separate list with all the source text that have been changed and provide them to translators. I know it is not ideal but it is the intrinsic limitation of .arb file format. As for the new source text, it should be easy for translators to identify them as there would be no translation associate with them when they load the file on in some app/ui. Still I agree this is not ideal either.
...I don't know, but what I described above for me is the best compromise:
I am currently using ng-extract-i18n-merge to extract translation and translate the files, then I am using a tool to extract angular translation json file from the translated .xlf file and load the translation in Angular dynamically.
...since I am getting all the benefits from .xlf file (I am particularly referring to state
attribute in the target
tag which is missing in .arb file) and I am also getting angular translation json format as output at the end of the workflow so you may want to include that workflow...