2

I am writing a module configuration page for a module. Is there a way to make variables submitted and saved by system_settings_form translatable?

0

I think there are two issues you have to think about...

  1. Is the item you are saving in the variable used for calculations?
  2. Is the item you are saving going to be displayed?

Note there is actually a variable translation module located in Localization Module, but it seems you would need to ask for these for each language supported.

In the case of #1, code may be require this variable to be a specific value. This will make it to whether you need to keep a record of all the available translated values of this item that can be entered and compared against.

In the case of #2, you could simply wrap a t() around the variable setting it up for translation, but if it is something like a text field, this will have to be done after one figures out what the item is... Select fields and others would be no problem as you have a finite number of possibilities.

With all that said, if the item is a free-formed text field, I would just allow your user to type in a different value for this item for each language he has enabled using the Variable Localization module.

0

You need to install Variable translation module. implement hook_variable_info where you define your variables.

Navigate to admin/config/regional/i18n/variable and make it multilingual.

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.