Closed (fixed)
Project:
Variable
Version:
7.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
19 Apr 2012 at 16:06 UTC
Updated:
14 Aug 2013 at 16:21 UTC
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
Comment #1
alexweber commentedVariable 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 doingvariable_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?
Comment #2
mgiffordYes. 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.
Comment #4
Garrett Albright commentedI'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.
Comment #5
alexweber commented@Garret, that looks about right. Maybe you can export the "base" language ones using strongarm and use the variable module to export just translations.
Comment #6
jose reyero commented> 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).
Comment #7.0
(not verified) commentedclarification