Translate chronoconnectivity body

alterna 01 Mar, 2010
I am trying to have a chronoconnectivity report multilanguage.

If I enable mambots, will I be able to use joomfish to translate strings that I write in the body fields ?

And in this case, does someone know where I should put the language files ? ini files somewhere ? in the chrono components folder ?

Thanks for suggestions
GreyHead 01 Mar, 2010
Hi alterna,

I'm fairly certain that JoomFish won't work with ChronoConnectivity (though I haven't tried).

I'd suggest that you define the values in an array in the Header box using a switch statement linked to the language. Make the scope of the array global and then access the array from the Body box.

Header box:
<?php
$lang =& JFactory::getLanguage();
switch ( $lang->getTag() ) {
  case 'nl-NL':
    $lang_array = array(
      'xxx' => 'xxx in Dutch',
      'yyy' => 'yyy in Dutch',
      'zzz' => 'zzz in Dutch' );
    break;
  case 'en-GB':
    $lang_array = array(
      'xxx' => 'xxx in English',
      'yyy' => 'yyy in English',
      'zzz' => 'zzz in English' );
    break;
}
global $lang_array;
?>

In body
<?php 
global $lang_array;
?>
. . .
<td> <?php echo $lang_array['zzz']; ?></td>
. . .

Not tested, not sure if it will work exactly like this.

Bob
alterna 01 Mar, 2010
Thanks I see what you mean.

Is there a possibility to have the language strings in an ini file called from the header in place of an array ?
I could put the ini files in the joomla language folder and keep the forms simpler. I have a lot of strings to translate.
GreyHead 01 Mar, 2010
Hi alterna,

Yes, that should work. Test a few with JText::_() in a standard chronoconnectivity language file, that might work too.

You can import ini files, or arrays - whatever practically works for you.

Bob
alterna 01 Mar, 2010
Yes working very well with chronoconnectivity.ini files ! exactly what I needed 😀

Thanks a lot Bob
alterna 09 Mar, 2010
Ok for the people asking me, here is how I did it : :wink:

Just put this code in the header of your form :
<?php
$lang =& JFactory::getLanguage();
?>


Then in the body, at every place where you need a string to be translated, replace your string by :
<?php echo JText::_('STRING_1');?>


And finally, go in your joomla language folder and in every language folder you have to put an ini file called en-GB.com_chronoconnectivity.ini for english, fr-FR.com_chronoconnectivity.ini for french, and so on, just remember to save the files in UTF-8 for foreign languages.

in the ini files, just replace the strings by your translation like this:
STRING_1=the translation that I want...


That's all, and working very well. You only have one ini language file and you can put all of your strings in it. I have six forms on http://icontes.com working this way

Hope it helps, Jiri 😑
This topic is locked and no more replies can be posted.