How does the Variable module compare with http://drupal.org/project/strongarm

Also curious about how Variable plays with $var['i18n_variable_list'] & $var['i18n_variable_conf'] to set field variables that are user translatable.

Seems like there aren't a lot of multi-lingual (2 or more languages) sites that have been set up with Drupal 7....

Comments

alexweber’s picture

Category: bug » support
Status: Active » Fixed

Variable is used to declare variables used by modules, including type and default value, enables administration forms for editing those variables and also makes translating them easier.

When using variable you can do variable_get_value('varname') and it will automatically fallback to the default specified in the variable definition if the variable is empty. This is much more convenient than doing variable_get('varname', 'default') every time.

Strongarm, on the other hand, despite also dealing with variables has a completely different (and complementary) purpose: it allows variable values to be exported and persisted in code. It is ideally used with Features.

For example: For a given variable 'varname' who's default value is 'foo' (declared in hook_variable_info()), you can override that default to make it 'bar', using strongarm. This override can be exported as a feature and persisted in code.

Make sense?

mgifford’s picture

Yes. And to confirm Strongarm only works on strings that are either wrapped in t() or are defined in variables in the Variables module.

We were looking to override some strings in Search404 that hadn't been defined in the Variables module or wrapped in a t() and it was giving us some grief.

Status: Fixed » Closed (fixed)

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

Garrett Albright’s picture

Status: Closed (fixed) » Active

I'd like to re-open for a bit of discussion, if I may be so bold.

I'm building a multilingual site with Features currently. I'm pretty familiar with Features, but this is my first time using Variable. I see that Variable can export values in Feature modules as well as Strongarm now. I'm presuming that I should use Variable to export all variables that need to be translatable for and Strongarm for the ones where translation isn't necessary. Is this correct? Or am I better off using Variable to export everything? A bit of clarification would be appreciated.

alexweber’s picture

@Garret, that looks about right. Maybe you can export the "base" language ones using strongarm and use the variable module to export just translations.

jose reyero’s picture

Status: Active » Fixed

> I should use Variable to export all variables that need to be translatable for and Strongarm for the ones where translation isn't necessary. Is this correct?

Yes, that should work, since you can select which variables belong to realms (and we export full realms) you just need to be careful of not exporting the variable with both.
But anyway, just selecting all the variables with strongarm, and then exporting specific realms on top of that should work too, as variable realm values should override the defaults (filled in by strongarm).

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

clarification