I have created a content type with a double field field configured as a Select list & Text field with a list of predefined allowed values for the Select List:

0|my option a
1|my option b
2|my option c

When I create a node for that content type in my default language, I get to choose between the 3 allowed values and can input some free text in the text field (as expected).

However when I translate my node, I am unable to translate the options from the select list (I can choose between them but can't change them).

I would like to be able to translate the allowed values list once somewhere (ideally at content type level, but I'm happy to have an alternative) and have those values enforced at node level when I translate.

For instance:

  • Default language (e.g English): I create 1 node with 1|my option b as the select value and some free text
  • Translation (e.g. Spanish): when I translate the node to Spanish, the select value becomes 1|mi opción b (which can't be changed) and I can translate the free text for the input field

Is there any way to automatically translate a double field select value (from one language to another), but not the free text (which can be translated freely) ?

1 Answer 1


Here is a simple workaround:

 * Implements hook_field_widget_form_alter().
function HOOK_field_widget_form_alter(&$element, &$form_state, $context) {
  if ($context['instance']['widget']['type'] == 'select_&_textfield') {
    foreach ($element['first']['#options'] as $key => $label) {
      $element['first']['#options'][$key] = t($label);
  • Thanks for the piece of code: can you explain how this is supposed to work?
    – Max
    Jan 2, 2014 at 10:17
  • It just iterates through select list options and process them with t() function.
    – ya.teck
    Jan 2, 2014 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.