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!