Hi Devs,
I recently wrote a little script that I would like to share with you.
It automates the conversion of RoundCube language arrays to OASIS XLIFFs, which
is an international standard for translations.
These files may then be edited using Translation Memory Tools like Omega-T or
Sun's XLIFF-Editor. These provide a graphical interface, multi-translator
support, spell-checking aso. Long story short: it makes translations a lot
easier.
Accessing a XLIFF file from PHP is easy. Check this example:
function getArray($locale, $fileId)
{
$file = simplexml_load_file("languages/" . $locale . "/" . $fileId .
".xlf");
if (!($file instanceof SimpleXMLElement)) {
throw new InvalidArgumentException('File-id not valid: ' . $file);
}
$translations = array();
foreach ($file->xpath('//trans-unit') as $node)
{
$attributes = $node->attributes();
$translations[(string) $attributes['id']] = (string) $node->target;
}
return $translations;
}
You will find the script and an example XLIFF as an attachment to this message.
Check it out.
Regards,
Thomas Meyer
--- 8< --- detachments --- 8< ---
The following attachments have been detached and are available for viewing.
http://detached.gigo.com/rc/A4/h91Cf1uv/convertLanguageArray.php
http://detached.gigo.com/rc/A4/h91Cf1uv/labels.xlf
Only click these links if you trust the sender, as well as this message.
--- 8< --- detachments --- 8< ---
_______________________________________________
List info: http://lists.roundcube.net/dev/