Hello everyone,

Can anybody help me in this issue :

I use l10n and I translate every field except #default_value.
For exemple, with simplenews module I can't translate "Stay informed on our latest news!"
Or in search module, I can't translate "Search"

It's just my hook_form_alter to use js.

function search_box_modification_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'search_theme_form') {
	$form[$form_id] = array(
		'#title' => t(''),
		'#type' => 'textfield',
		'#size' => 15,
		'#default_value' => 'Search',
		'#attributes' => array('onblur' => "if(this.value=='')this.value='Search';", 'onfocus' => "if(this.value=='Search')this.value='';"),
	);
  $form['submit'] = array('#type' => 'submit', '#value' => t('OK'));
  $form['#submit'][] = 'search_box_form_submit';
  $form['#validate'][] = 'search_box_form_validate';
  }
}

Thanking you in advance !

Comments

keuvain33’s picture

I have a really problem and nobody talk about a solution.
Anyone could help me???

Thank you in advance !

keuvain33’s picture

Nobody have a solution?

keuvain33’s picture

Up please

derekahmedzai’s picture

You need to pass the text through the t() function in order for it to be translatable.
E.g.,

        '#default_value' => t('Search'),
keuvain33’s picture

Thank you for my "newbisme". Now it's working perfectly