Out of the box the localization and translation functionalities of Drupal can translate only the titles of each field created with the Content Construction Kit (CCK). Unfortunately at the moment no translation module (Locale, Localizer, i18n) offers direct support for the translation of cck fields, so we have to fix this ourselves.
In order for a string to get translated it must be enveloped by the t() function in the PHP code. We have to do this manually. Currently, your 'Allowed values' list probably looks like:
Apples
OrangesFirst you'd better chage it to::
apples|Apples
oranges|OrangesTo the left of the pipe is what's stored in the DB. To the right is what's shown to the User. Without this distinction between the value stored in the DB and the string shown to the user there's no sense in translating.
The next step is to generate this 'Allowed value' list via PHP code instead. The box for PHP code is just beneath the normal box. Use code similar to:
return array(
'apples' => t('Apples'),
'oranges' => t('Oranges')
);Now all we have to do is to look for our strings in Locale and proceed with their translation as usual.
Thanks mooffie for pointing this out.
| September 2010 | ||||||
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | ||
Thanks! Very helpful :-)
Thanks! Very helpful :-)
Post new comment