XLIFF, versioning or translation updates process (Diff Leverage step)

浪子不回头ぞ 提交于 2019-12-07 07:37:24

问题


I am considering using XLIFF to standardize localization efforts within the enterprise. I am very new to xliff and having done some research I figured the following general process to use it:

  1. Extract strings from development project resources (.resx for .Net, .properties for Java) - the good way to do it as I found is to use Rainbow from Okapi Localization Toolbox - and use "Utilities => Translation Kit Creation" command
  2. Then translate the extracted file, like it is described at http://www.opentag.com/okapi/wiki/index.php?title=How_to_Translate_XLIFF_Documents for example using Virtaal application
  3. And finally convert the translated xliff back into original format (resx/properties) - which is possible to do with Rainbow as well "Utilities => Translation Kit Post-Processing"

So far everything is clear, however I would like to know what are the best practices when adding or modifying the string resources? I would prefer not to have all resources to be re-translated every time there is a new string added to the string resources in original format (resx/properties)

That will be also great if there is a versioning support for the translations - so that multiple languages translations will be consolidated (provide the same set of strings) if they are marked with the same version. And version is updated when new string are added or existing strings are modified.

Is there a ready to use solution for this? Or is it something we will have to build on our own?

EDIT:

I found the Diff Leverage step in Okapi Rainbow's Pipeline library, but I have a difficulty to get it working. Here are two xliff files. First one was the first version of the resources that was translated in French, the second one is an file generated from new version of resources with the following changes:

  • 1 string updated (AdminTitleResource is now Administration Resource)

  • 1 string removed (HomeLinkResource is gone)

  • 2 new strings added (Project and Company)

But running Diff Leverage pipeline doesn't produce a smart merge of the translations. Any ideas why?

The translated xliff for previous version of resources:

<?xml version="1.0" encoding="windows-1252"?><xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:okp="okapi-framework:xliff-extensions" version="1.2">
<file original="/Messages.resx" source-language="en-us" target-language="fr-fr" datatype="xml">
<body>
<trans-unit id="1" resname="AccessDenied" xml:space="preserve" approved="yes">
<source xml:lang="en-us">Access denied</source>
<target xml:lang="fr-fr" state="translated">Accès refusé    </target>
<note>Error message</note>
</trans-unit>
<trans-unit id="2" resname="AdminTitleResource" xml:space="preserve" approved="yes">
<source xml:lang="en-us">Administration</source>
<target xml:lang="fr-fr" state="translated">Administration</target>
<note></note>
</trans-unit>
<trans-unit id="3" resname="HomeLinkResource" xml:space="preserve" approved="yes">
<source xml:lang="en-us">Main page</source>
<target xml:lang="fr-fr" state="translated">Page web principale</target>
<note></note>
</trans-unit>
<trans-unit id="4" resname="SelectCategoriesResource" xml:space="preserve" approved="yes">
<source xml:lang="en-us">Categories</source>
<target xml:lang="fr-fr" state="translated">Catégories</target>
<note></note>
</trans-unit>
<trans-unit id="5" resname="SelectConfigResource" xml:space="preserve">
<source xml:lang="en-us">Configuration</source>
<target xml:lang="fr-fr" state="needs-review-translation">Paramètres</target>
<note></note>
</trans-unit>
<trans-unit id="6" resname="SelectGroupsResource" xml:space="preserve">
<source xml:lang="en-us">User groups</source>
<target xml:lang="fr-fr" state="needs-review-translation">Utiliser le groupe</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>

How do I get XLIFF file with only strings that need to be translated?

The new file with changes listed above:

<?xml version="1.0" encoding="windows-1252"?><xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:okp="okapi-framework:xliff-extensions" version="1.2">
<file original="/Messages_v2.resx" source-language="en-us" target-language="fr-fr" datatype="xml">
<body>
<trans-unit id="1" resname="AccessDenied" xml:space="preserve">
<source xml:lang="en-us">Access denied</source>
<target xml:lang="fr-fr">Access denied</target>
<note>Error message</note>
</trans-unit>
<trans-unit id="2" resname="AdminTitleResource" xml:space="preserve">
<source xml:lang="en-us">Administration Resource</source>
<target xml:lang="fr-fr">Administration Resource</target>
<note></note>
</trans-unit>
<trans-unit id="3" resname="SelectCategoriesResource" xml:space="preserve">
<source xml:lang="en-us">Categories</source>
<target xml:lang="fr-fr">Categories</target>
<note></note>
</trans-unit>
<trans-unit id="4" resname="SelectConfigResource" xml:space="preserve">
<source xml:lang="en-us">Configuration</source>
<target xml:lang="fr-fr">Configuration</target>
<note></note>
</trans-unit>
<trans-unit id="5" resname="SelectGroupsResource" xml:space="preserve">
<source xml:lang="en-us">User groups</source>
<target xml:lang="fr-fr">User groups</target>
<note></note>
</trans-unit>
<trans-unit id="6" resname="Project" xml:space="preserve">
<source xml:lang="en-us">Project</source>
<target xml:lang="fr-fr">Project</target>
<note></note>
</trans-unit>
<trans-unit id="7" resname="Company" xml:space="preserve">
<source xml:lang="en-us">Company</source>
<target xml:lang="fr-fr">Company</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>

回答1:


There is an answer for this here: http://tech.groups.yahoo.com/group/okapitools/message/2494


EDIT: content of linked message

Hi Paul,

I am trying to figure out how to use the diff leverage to improve the translation experience and get an update xliff file when merging/leveraging existing translation with new version of the document with added/modified/removed strings.

As Jim noted, with XLIFF files you may be able to take advantage of ID-based steps.

But the Diff leverage step would work too. Here is how to do it:

I've assumed you have the XLIFF files and just want to update them. You could create pipelines that do additional things like create a translation kit etc. but this will keep things simple.

First you need to put the new source file in the Input List 1 and the translated file in the Input List 2.

Then you can create the following pipeline:

  • Raw document to Filter Events
  • Diff Leveraging
  • Filter Events to Raw Document

In the parameters for the Diff Leverage step: make sure the option "Copy to/over the target" is set.

Then execute the pipeline.

I've attached a comparison (compare_out.html) between the original new file and the output file. As you can see all the text that could be leveraged is now in the output. Your entry 'AdminTitleResource' is not translated because it's the source in the translated file is different, and your two new entries are also not translated.

You'll also note the new attributes approved='yes' that are there to indicate the translation was done. That extra flag can be used to differentiate entries that need translation from the one that have been leveraged.

For some reason two of the leveraged entries do not have it: I'll have to look at that and report back. It may be a bug or some condition I don't recall (maybe Jim does).

The Id-Based Copy step could almost be better. It would copy the translated text by matching in the resname of the entries. I say almost because currently it does not look at the source texts, so you get the translation even if the new source is different (it's not a 'leveraging' step). But we could add an option to make that extra check and that would make the step work like a leveraging step. I'll try to find the time do this.

Hope this helps, -yves



来源:https://stackoverflow.com/questions/8508066/xliff-versioning-or-translation-updates-process-diff-leverage-step

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!