Dropdown with Dynamic Data and multilanguage

enriture 18 Mar, 2014
Hi everybody,

I have a dropdown field with values dinamically taken form a DB Table, used to present to the user a list of all the countries in the world.
Since my site is multilingual (italian and english), I'd like to know if it's possible to choose to load the list of countries in italian or in english, depending on the language in use.
The table already has two different fields, containing the names in the two languages.

Thank you in advance for your help!
GreyHead 18 Mar, 2014
Hi enriture,

If you load the table data using the ChronoForms DB Load action you can add PHP to the WHERE box to check the current language and select the values you need.

Bob
enriture 18 Mar, 2014
Thank you GreyHead,
about the PHP in the WHERE box, can you please give me any other clue?
In a previous topic I found this
<?php
$lang =& JFactory::getLanguage();
$form->data['lang_tag'] = $lang->getTag();
?>

that should add the current language tag to the form data array, is it correct?

And what about the code to select the correct values depending on that tag?
GreyHead 19 Mar, 2014
Hi enriture.

Assuming that you have used the language tags in your database table e.g. fr-FR, en-GB, etc. then your WHERE clause would be something like
`language` = '{lang_tag}'

Bob

I also have a paid Custom Select [GH] action that will handle this for you.
enriture 11 Jul, 2014
Hi GreyHead,
I'm back working on this project and in the meantime I've upgraded to Chronoforms 5. Does your action also work with this version of the component?
Thanks
GreyHead 11 Jul, 2014
Hi enriture,

Sorry, no it is for CFv4 only. I have so far only managed to upgrade one action to CFv5 - I've worked out how to do it now and more will follow when I have time.

Bob
This topic is locked and no more replies can be posted.