[support] trying to use php to create multi-lingual CCK select lists

Zohar Stolar z.stolar at gmail.com
Fri Jul 27 20:09:46 UTC 2007


I guess you should call the global language variable too.
Why don't you use the t function to translate the options?



Neil: esl-lounge.com wrote:

> I want a drop down "Hobbies" list in my node profile that I'm using 
> CCK to create.
>  
> Unfortunately, I discovered that "Manage Strings" in Localization 
> can't help me to translate that select list, so now I'm looking at 
> using PHP in the Allowed Values section.
>  
> So far I have this:
>  
> global $user;
> $HobbiesEnglish = array (1 => One, 2 => Two, 3 => Three, 4 => Four);
> $HobbiesItaliano = array (1 => Uno, 2 => Due, 3 => Tre, 4 => Quattro);
> if ($Language->language == "it")
> {
> return $HobbiesItaliano;
> }
> else
> {
> return $HobbiesEnglish;
> }
>  
> Just trying to get the English and Italian numbers showing up before 
> going the whole hog! The language conditional statement is working 
> fine on another part of the site, but I can only get the English 
> numbers appearing for now.
>  
> thanks in advance
>  
> Neil


More information about the support mailing list