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) »
  • Translation function missing
Pages: [1]

Author Topic: Translation function missing  (Read 893 times)

Pierre Coutant - Cyim

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7
  • MySQL version: 5.1.65-community
  • PHP version: 5.3
Translation function missing
June 13, 2013, 08:03:57 am
Hi everybody,

I am currently working on translation and i spotted two types of problems.

The first one is the translation isn't done in the template file.
Example : Adress.tpl (l.33) :
Quote
{$title}
shouldn't it be translated like this :
Quote
{ts}{$title}{/ts}

The second one is the function translate is not used on the key and the word is not translated.
Example : UpdateConfigBackend.php (l.63) :
Quote
$this->addElement('submit', $this->getButtonName('next', 'cleanup'), 'Cleanup Caches', array('class' => 'form-submit', 'id' => 'cleanup-cache'));
Shouldn't it be translated like this :
Quote
$this->addElement('submit', $this->getButtonName('next', 'cleanup'), ts('Cleanup Caches'), array('class' => 'form-submit', 'id' => 'cleanup-cache'));
         
Do you think this is a good way to do ?

Thank you in advance !

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Translation function missing
June 13, 2013, 12:54:27 pm
Hi,

ts functions are meant for static texts, so ts("whatever") makes sense ts($avariable) doesn't (in 99% of the cases)

in your example, the $title is likely a dynamic content written by the user for a specific entity, it wouldn't make sense to try to see if it exist a translation of this user entered content in the list of static label pre-defined.

For the add element. it seems a miss indeed. can you confirm by using a non us version that the text isn't translated?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pierre Coutant - Cyim

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7
  • MySQL version: 5.1.65-community
  • PHP version: 5.3
Re: Translation function missing
June 14, 2013, 12:08:33 am
Hi,

I use a fr_FR version of CiviCRM and I confirm the "Cleanup Caches" button isn't translated.

In my case, $title is used for the accordion header of Address.tpl (New Individual in CiviCRM).
If it's a dynamic content where should I translate/modify it?
If it's not can I use the ts function?


Thanks for you advice.



mathieu

  • Administrator
  • Ask me questions
  • *****
  • Posts: 620
  • Karma: 36
    • Work
  • CiviCRM version: 4.7
  • CMS version: Drupal
  • MySQL version: MariaDB 10
  • PHP version: 7
Re: Translation function missing
June 14, 2013, 06:39:08 am
Those accordeon headers are an issue for me too (Address, Communication Preferences). I usually install CiviCRM in English first, then switch to French.

I think that if you install directly in French, it will be correctly translated (the title comes from the "option group" title, which is sometimes exposed in the hidden screen at: /civicrm/admin/options?reset=1. Most of the accordeons are in "Contact Edit Options" (address, comm preferences, sociodemographic).

The "Settings - Display Preferences" is already rather cluttered, but adding a direct link to that screen could be useful?
CiviCamp Montréal, 29 septembre 2017 | Co-founder / consultant / turn-key CiviCRM hosting for Quebec/Canada @ SymbioTIC.coop

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • Translation function missing

This forum was archived on 2017-11-26.