Translating Drupal CCK field values

Jan 20
1

Translating Drupal CCK field values

Tue, 2009-01-20 15:19 — budda

In order for a string to get translated it must be passed through the t() function in PHP code.

When defining the CCK field you need to generate the 'Allowed values' list via PHP code. The box for PHP code is just beneath the normal box. Use code similar to:

return array(
  'male' => t('Male'),
  'female' => t('Female')
);

Comments

Raji (not verified) says:

Thanks budda for the code.

I am new to drupal. can you suggest me the php code to access existing taxonomy terms.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].

More information about formatting options