views:

591

answers:

1

Howdy,

I have a web application which needs to support multiple languages. We currently have quite a lot of images on the site with text in them. Im trying to find a way to localize these images with the least amount of hassle. What i have come up with so far is to add sub folders to the current /Images folder which relate to the required language. So for example /Images contains the default set of images and /Images/es-MX contains the Spanish-Mexican localised images.

All pretty standard so far i think. Now the issue i have is that in order for this new structure to work i need to add the following to all img tags:

<img ... src="/images/<%= GetGlobalResourceObject("MyResource","IMAGEPATH").ToString() %>image1.gif" ../>

Or in the case of asp:ImageButton i need to programmatically set their ImageURL in codebehind with a utility method that replaces the /Images/ with /Images/es-MX or whatever the culture happens to be.

All of this leaves me with messy markup and lots of codebehind calls just to correct the image path. I ask you dear reader, is there a better way?

+1  A: 

Here is a good article from MSDN on globalization in ASP.NET. It uses a resource file approach so I am not sure if that will work for you but here is the article:

http://msdn.microsoft.com/en-us/magazine/cc163566.aspx

Andrew Hare
I believe that you can also add image to the resource file.
Jedi Master Spooky
Yes you definitely can. I just meant that since all his images are currently stored on disk it may be difficult to move them all to resource files.
Andrew Hare
Thanks for the link. I do currently have resource files but even if i made the effort to place all the paths for the images into a resource file it still would not solve the issue i have regarding messy markup and codebehind.
Kaius