Translating CCK Field Options

When building a multilingual site, it's important to ensure that the entire interface can be translated. All kinds of site elements are thrown into the mix including taxonomy terms, block titles, views labels, and dates.
Another important element is cck fields. While the labels and descriptions of cck fields are automatically passed through the translation function, options for these fields are not. These are the "allowed values" you enter when creating checkboxes, selectboxes or radio buttons.
In order to be able to translate these strings through Drupal, you need to expand the "PHP Code" fieldset when configuring the cck field. Then, include an array of key value pairs, with the value wrapped in the translation function.
<?php
return array(
'Per Course' => t('Per Course'),
'Per Year' => t('Per Year'),
'Per Generation' => t('Per Generation (for multi-year programs)')
);
?>


Commentaires
Thanks for this hint. It has
Thanks for this hint. It has been useful to me.
Thanks a lot for this tip!!!
Thanks a lot for this tip!!! It took me hours literally to find out how to make these CCK options translatable, until I've found your post.
Thank you for sharing this!
Hello!
Hello!
I build a multilingual site some time ago. This method worked for me and de development continues.
Just recently I've noticed that the code in the PHP code field is being ignored and it falls back to the allowed value list.
I figured it may had been some recent update or another module, do you have any insight on what could I check?