0

Im trying to automate some of the translation of the PKP OCS CMS to Croatian language. There is a very similar translation already available for PKP OJS CMS and I would like to use those translations to reduce the time of translating all the values by hand. Not all keys exist in the OJS translation so I would like to use only the ones that exist in the translated version and leave the untranslated for manual translation.

My file localeOCS.xml looks something like this:

<message key="common.copy">Copy</message>
<message key="common.preview">Preview</message>
<message key="common.activate">Activate</message>
<message key="common.deactivate">Deactivate</message>

The file localeOJS.xml I would like to use the translations from looks something like this:

<message key="common.copy">Kopiraj</message>
<message key="common.preview">Prethodni pregled</message>
<message key="common.activate">Aktiviraj</message>

I would like to create a bash script that would search through both files, find the same keys i.e. key="common.copy" and replace the content of the first file (localeOCS.xml) so it would look like this:

<message key="common.copy">Kopiraj</message>
<message key="common.preview">Prethodni pregled</message>
<message key="common.activate">Aktiviraj</message>
<message key="common.deactivate">Deactivate</message>

In this case key="common.deactivate" is missing from the translated file localeOJS.xml so it would be left unchanged after the script went through the files. In this way I would only be left with keys that are unique to OCS system to translate by hand which would save me a lot of time.

Thanks!

  • A well formulated problem, but on StackOverflow, you're expected to have tried to solve your problem and include an attempt to solve it. Trouble with non-working code is the primary remit for S.O. Have you tried using `xslt` or a language that is `xml` aware? Add a tag for a language you can use and you may get some help. Good luck. – shellter Jan 10 '16 at 16:48
  • Maybe try the PKP support forum: http://forum.pkp.sfu.ca/ – asmecher Jan 11 '16 at 18:31

0 Answers0