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

Neil: esl-lounge.com neil at esl-lounge.com
Sat Jul 28 00:04:39 UTC 2007


How can I use the t function to translate? If I put them into the Allowed 
Values field, they show up in the drop down. I tried it with one and my drop 
down became

<?php print t('Collecting') ?>
Watching TV
Family activites
Fishing

How can I use t strings in CCK fields without them showing up?

thanks

Neil

----- Original Message ----- 
From: "Zohar Stolar" <z.stolar at gmail.com>
To: <support at drupal.org>
Sent: Friday, July 27, 2007 10:09 PM
Subject: Re: [support] trying to use php to create multi-lingual CCK select 
lists


>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
> -- 
> [ Drupal support list | http://lists.drupal.org/ ]
> 



More information about the support mailing list