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.078 seconds

This is what you call a component builder. I was able to master using this in a very short time and the resulting component works like a charm. Not just a basic component builder but a fully working component builder with forms fields tables all ready to go. You can make the list and item views to display in the front and back end. Also there is a great forum just starting to evolve and I'm sure this will grow very rapidly when you all realise how good this tool is.
Kevin (JED)

         

Get Started