CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • Integrate civicrm into drupals localization client (l10n client) ...
Pages: [1]

Author Topic: Integrate civicrm into drupals localization client (l10n client) ...  (Read 2931 times)

ositoblanco

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
Integrate civicrm into drupals localization client (l10n client) ...
March 06, 2009, 12:13:48 pm
Do you know the l10n_client module for drupal? Its user interface makes translation much more easy. It would be nice to have a feature like this in CiviCRM. That's why I want to try to integrate civicrm in the l10n client, so that the ts-strings are available to its UI. Facilitating the translation progress will hopefully improve the quality of civicrm translations.

I started by reviewing the code of the CRM_Core_I18n:ts -function. There I saw a feature I didn't notice before: By defining the variable $config->customTranslateFunction I am able to use a custom translation function. Is there Any documentation about this function? What about using drupals t -function as shown in the description of issue CRM-2808 (http://issues.civicrm.org/jira/browse/CRM-2808)? Are there any reasons not to invoke drupals t -function (like negative performance aspects)? What about compatibility between ts and t -function? Does Anybody have some experiences to use drupals t -function in the custom translate function?

My idea to get the l10n_client working with civicrm is, that the custom t -function calls a function (l10_client_add_string_to_page) to add the strings to the user interface and store it's translations in drupals database.

If I can use the t -function directly in the custom translate function there will be no need to export the translations. But in order to contribute them back to the civicrm translation I need to export them to a po file. Drupal itself will only export all strings to a po file (it does not know which ones comes from civicrm). Will such a po file be useful to civicrm anyway, as it will contain a lot of useless strings? Otherwise I have to find another way to get the translation into the civicrm po files. For drupal modules there exists a "translation template extractor" (http://drupal.org/project/potx), but this won't work out of the box, so I asked there if this could be implemented somehow (http://drupal.org/node/393418).

Any inspirations on this "project" (To the custom translation function, to the l10n_client or to the template extraction)?
Thanks.

Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Integrate civicrm into drupals localization client (l10n client) ...
March 16, 2009, 05:29:16 am
Thanks a lot for you interest and your ideas!

To address the general issue: We need CiviCRM to operate in more-or-less the same way inside Drupal, Joomla! and when standalone, and that’s why we can’t base the localisation solely on Drupal’s t() function – hence our custom ts() function (and {ts} Smarty block) to translate strings.

That said, your approach to add Drupal’s translation facilities as optional (through a custom ts() function) is most interesting, and might be a useful addition to our Pootle server[/tt]. Let me address the details below.

Quote from: ositoblanco on March 06, 2009, 12:13:48 pm
By defining the variable $config->customTranslateFunction I am able to use a custom translation function. Is there Any documentation about this function?

I’m not sure, probably not. If I remember correctly, this was done on request of somebody who already had their own version of ts()…

Quote
If I can use the t -function directly in the custom translate function there will be no need to export the translations. But in order to contribute them back to the civicrm translation I need to export them to a po file. Drupal itself will only export all strings to a po file (it does not know which ones comes from civicrm). Will such a po file be useful to civicrm anyway, as it will contain a lot of useless strings?

Yes, thanks to gettext’s utilities if you send us any PO file we can extract the strings (and their translations) that do interest us from there automatically.

In general, you should try creating your custom ts() function that calls the Drupal’s t() function (much like in that issue you linked) and see how it works; the only thing you’ll have to figure out how to handle are the plurals (I’m simply not sure how t() handles them). Both importing PO files into Drupal and exporting them back to us should be trivial.
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • Integrate civicrm into drupals localization client (l10n client) ...

This forum was archived on 2017-11-26.