Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Translate Values List With Language System (JText) 06 Nov 2015 11:56 #13659

  • liubov
  • liubov's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
Hi cookers,

Has someone already translate Combo List of values with the natif Joomla3 Language System ?


The question is: where and how do I integrate the JText::_() ?

option 1
/views/single_item/view.html.php
                $model_id_statut = CkJModel::getInstance('Statuts', 'JbreedingModel');
                $model_id_statut->addGroupOrder("a.value");
                $lists['fk']['id_statut'] = $model_id_statut->getItems();

option 2 Any facilities to translate the values with jdomOptions ?
/views/single_item/tmpl/default_form.php
$fieldSet['jform_id_statut']->jdomOptions = array(
			'list' => $this->lists['fk']['id_statut']
		);

Thanks for help ...

Please Log in or Create an account to join the conversation.

Last edit: by liubov.

Translate Values List With Language System (JText) 06 Nov 2015 15:44 #13660

  • liubov
  • liubov's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
My custom code works. (option2)

But I would like to know if somebody has another (Jdom) method to manage Language translations of Combo List...
// Combo List of values Translation with JLanguage System
        for ($i=0, $n=count($this->lists['fk']['id_statut']); $i < $n; $i++):
                $Jtx_statut = $this->lists['fk']['id_statut'][$i]->value;
                unset($this->lists['fk']['id_statut'][$i]->value) ;
                $this->lists['fk']['id_statut'][$i]->value = JText::_($Jtx_statut);
        endfor;
        $fieldSet['jform_id_statut']->jdomOptions = array(
                        'list' => $this->lists['fk']['id_statut']
                );

tanslated result :

Please Log in or Create an account to join the conversation.

Translate Values List With Language System (JText) 06 Nov 2015 19:24 #13661

In a component which reads out shps I have created a table: Languages.
It has a label and a value (Dutch/nl, English/en etc)
You can then create another table for the values in the combo, which has an FK to the language.
Add a where statement with the language and you wille have your combo filled with the values from that language.

So, the combo is not a enum in the table, but an extra table.
Maybe not what you want or need, but you asked for another solution :D

Please Log in or Create an account to join the conversation.

Translate Values List With Language System (JText) 07 Nov 2015 12:20 #13664

  • liubov
  • liubov's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
thank you for your reply, never mind, it's a way to do ...
but i prefer to keep the Language System ...

Please Log in or Create an account to join the conversation.

Last edit: by liubov.
  • Page:
  • 1
Time to create page: 0.108 seconds

I jumped and started to work on a demo component... but 2 days later this demo component became the real component. I just showed today the end result to my customer and he turned to me and said... "this is more than I expected"... All of this is because Cook did cut about 70% of my work and provided me more ways to improve the usability of the component. The end result was 17 tables all related between than to generate a full dashboard for the travel agents. Thanks for Cook developers for such great tool. This component would not be possible to be done at short time with all the features in it
Griiettner (Forum)  

Get Started