Hi.
In addition to English, I need my site to be available in Spanish. Most things seem to be working except background images in my stylesheet.
I’ve set a “user_language” global variable for the english version in my index.php file:
$assign_to_config['global_vars'] = array(
'user_language' => 'en'
);I’ve also created a folder named “es” with a duplicate index.php file but with the “user_language” global variable set to “es”:
$assign_to_config['global_vars'] = array(
'user_language' => 'es'
);So when a user shows up to mysite.com, the global variable “user_language” is set to “en”
And when a user shows up to the mysite.com/es directory, the global variable “user_language” is set to “es”.
I then use the global variable to access the appropriate language channel field or image:
{{user_language}-body-copy}images/{user_langauge}-hero-img.jpgLike I said above, everything works well except when I try to use the {user_language} variable for the background property in my stylesheet:
background:url({site_url}images/{user_language}-home-img.jpg) no-repeat;When I look at the code inspector, what seems to be happening is that, even if the user goes to mysite.com/es, where the “user_language” variable should be set to “es”, the tag in the stylesheet is somehow acting as though the user landed at mysite.com where the variable is set to “en”, only showing the English version of the image when it should be showing the Spanish.
I am using
href="{path='site/stylesheet'}"to call my css so the tags are all parsing.
Not sure where to go from here. I’ve been trying to figure this out for two days.
Any help is appreciated.
Thanks,
Michael