Since I maintain a bunch of modules with a lot of variables that need to be translated, I figured it would be a good idea to set $conf['i18n_variables'] in hook_init() instead of making all of my users put them in their settings.php every time.

However, if i18n_variable_init() can't find a value for a variable, it sets it to the empty string. This isn't good for variables that have non-empty defaults, especially when those defaults are translated with t(). Certainly, the defaults of all these variables should be translated with t().

Patch uses NULL instead of '' when variables are not set yet. This lets variable_get() use the default like it's supposed to.

CommentFileSizeAuthor
unset_variables.patch576 bytesIsland Usurper

Comments

jose reyero’s picture

Status: Needs review » Fixed

Looks good, committed, thanks

Status: Fixed » Closed (fixed)

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

Island Usurper’s picture

I hate to ask, but when do you think you'll make a 1.2 release? I'm kind of waiting on that before I put all of the code into hook_init() for my modules. I'm just worried that most people won't get the dev version of i18n and then find that they can't see a bunch strings in English.

wimh’s picture

This issue is giving problems in the latest Ubercart (6.x-2.0-rc7, see #587750: Address field labels empty since rc7). I think a release with this patch would please a lot of people... ;-)