Opublikowane
2008-12-22 12:38
As the various localisations of CiviCRM get traction, the first localised versions of documentation pages begin to show up – and this brings us to the issue of how to internationalise these of the CiviCRM strings (texts) that contain links to documentation pages so that when a given string is translated to, say, German, it also refers to the German version of the documentation page (if such is present).
For previous and current CiviCRM versions (including the upcoming CiviCRM 2.2), when we internationalised a string, we wanted to leave the link to the documentation page outside of the string, like this:
{ts 1=http://wiki.civicrm.org/…}Read more at %1{/ts}
.
This approach has two major benefits:
- The translators are not bothered to retype the link letter-to-letter in their translations (any errors here would mean that the link stops working), and
- if the link ever changes, the string (‘Read more at %1’) doesn’t, and the translators don’t have to re-translate it.
- The code gets changed to
{ts link=http://wiki.civicrm.org/…}Read more at %link{/ts}
, i.e., the1
gets replaced withlink
, - the translators still see the ‘Read more at %link’ texts and so aren’t bothered with link maintenance,
- there is a separate PO file provided for each language,
civicrm-links.po
, which gathers all the links defined in this way inside the{ts}
andts()
calls.
civicrm-links.po
files, every language can maintain ‘translated’ links in a separate place from the actual strings referring the links. This means that the strings don’t change when the links do, while at the same time every language can maintain a separate lists of documentation pages that are translated into the given language (and the mechanism will fall back to the default American English pages if the given page is not localised into the language at hand).
In the future, if we somehow manage to tell Confluence (our wiki engine) to link the localised pages as being related to the original, the civicrm-links.po
files could be even generated automatically.
The issue tracking the implementation of the above solution is CRM-3941.
Thanks for reading and please share any comments you might have on the above solution. :)
Filed under