I am currently working on localizing my application which is based on the .net framework v3.5, which uses the jquery client side library.
I successfully localized most of my application, on screen text via resource files, client side text via a resource javascript file and html mark up images via .net c# code.
When localizing my images, the simple change is to update the path to image to include the cultures folder eg. For english – en, spanish – es etc. So a sample image path would be
/image/folder1/en/image.gif
/image/folder2/es/image.gif
I have achieved this in my .net code and all works fine.
However I have run in to an issue. Some of my images are background images set in css. Unfortunately this raises an issue as I am unable to localize something like this:
h1 {background-image:url("../../Images/folder1/<<culture>>/image1.gif");background-repeat:no-repeat;
So I am looking for suggestion as how I could resolve this. Could I pass a javascript variable value to the css file? I could create a httphandler and update my css prior to rendering but would prefer to go with this for last resort as I don’t want every css file being processed through iis.
Any tips would be great.
Another possibility is to set lang attribute for the body (or HTML element of your interest), so that rendered HTML page will show something like this:
Then you can use CSS lang pseudo-selector to localize the content:
This is standard (as in W3C recommended) way of localizing CSS files.