Add support for changing language_default variable (see hook_domain_bootstrap_full, domain_variable_js_maintain etc.)

bforchhammer: Problem 1: Current value is not selected on variable form (no radio button selected). This seems to be a problem with the variable module, as it also happens with domain_variable and variable_realm disabled. See #1585946: language_default form element ignores existing value.

Problem 2: The reason why domain_variable_js_maintain etc. were initially added, is because the "javascript hash" for javascript translation files is also stored in the language_default variable. This means, that the language_default variable needs to be updated whenever the javascript hash changes... (background: #1271810: Default language gets changed).

Jose Reyero: About the language_default variable, I think we should keep it as an object because otherwise it will clash with any other module using this variable directly.

What we can do is changing this 'js hash' property on the fly wherever it is needed as default language is an object stored in the global $conf array.

Comments

bforchhammer’s picture

Version: » 7.x-1.x-dev

Changing the default language based on the domain is now working...

Not sure how to reliably reproduce and test the javascript issue. I'll investigate...

bforchhammer’s picture

Status: Active » Needs review
StatusFileSize
new2.33 KB

Still not sure about how to reproduce this reliably. The javascript hash can be invalidated for testing via a call to _locale_invalidate_js(), but unfortunately this doesn't seem to work all the time... It looks like it's only being rebuilt once every x minutes...

Attached patch tries to fix the issue. Would love some input, especially on the call to variable_realm_boot().

bforchhammer’s picture

Status: Needs review » Needs work

Various things have changed in respect to initializing variables, so the patch wll need another look...

bforchhammer’s picture

Status: Needs work » Fixed
StatusFileSize
new5.63 KB

I just committed the attached patch.

I tested the javascript-hash thing by changing respective values in the database and checking whether the language_default variable gets updated respectively. (It does!)

Using a domain-specific language_default variable now seems to be working fine, so I'm marking this as fixed. If anyone stumbles on any issues, please reopen...

Status: Fixed » Closed (fixed)

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