I'm using a settings form for my module and I'm trying to make some of the fields multilingual.
I've declared the multilingual variables with hook_variable_variable_info (and with hook_variable_group_info for my custom group):
function MYMODULE_variable_info() {
$variable['my_variable_name'] = array(
'type' => 'string',
'title' => t('My title'),
'default' => MY_DEFAULT_VALUE,
'description' => t('My description.'),
'localize' => TRUE,
'group' => 'my_group'
);
return $variable;
}
I've added my settings form (one field for example)
function MYMODULE_settings_form() {
$form = array();
$form['my_variable_name'] = array(
'#type' => 'textfield',
'#title' => t('My title'),
'#title_display' => 'before',
'#default_value' => variable_get_value('my_variable_name'),
);
return system_settings_form($form);
}
And as you can see I've used system_settings_form($form) to save my form fields as variables.
I've checked my new variable at 'admin/config/regional/i18n/variable' and the form shows that it's a multilingual form and multilingual field, but when I'm switching to another language the value isn't saved. (Only the English version saves and changes the value for all languages)
Thanks.