Hello,

I would love to translate the string in the subscription block, but I can't seem to be able to do that.

Is this because the string has been put in a variable_get() instead of a t() ? I'm no expert in this, so I can't tell.

I want to translate this: $name_action_long = variable_get('emf_default_name_action_long', 'If you subscribe to !name, we will keep you up to date by sending newsletters.');

Thanks in advance.
Cheers,
Danny

Comments

davyvdb’s picture

Status: Active » Fixed

You can use the multilingual variables feature to translate this: http://drupal.org/node/313272

Danny_Joris’s picture

Ah yes, tnx ! :)

Danny_Joris’s picture

I've made translations for the variable and it seems they are saved to the i18n_variable table correctly, but I don't see any changes in my actual subscription block. Only the original variable is visible in any language even after I changed that original variable too. I flushed all caches. Any idea what I might be doing wrong?

http://www.dannyjoris.be/files/fora/i18n_variable.png

I can't change the original variable either:
http://www.dannyjoris.be/files/fora/emf_list.png

davyvdb’s picture

Correct. My mistake. Forget about my previous solution.

The only way you can do this correctly now, is to do a form alter for the emf_subscription_list_form form. There you can wrap a t() around the string.

Make sure you use the english string in the settings.

Danny_Joris’s picture

Thanks, that worked. This is what I did:

<?php
/**
* Implementation of hook_form_alter()
*/

function custom_form_alter(&$form, $form_state, $form_id) {
	
  if ($form['#id'] == 'emf-subscription-list-form') {
  	$form['action_long']['#value'] = t('Feel free to subscribe to our newsletter if you want to be kept up to date.');
	//print dsm($form);
  }

}
?>

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Cyberwolf’s picture

Status: Closed (fixed) » Active

I think this should be reopened as it's still not possible to translate those texts, without workarounds.

What about integrating with i18n_strings, maybe that's a possible solution?