Solved

How do I localize Images using a GlobalResource file (.resx) in asp.net?

Posted on 2009-07-16
2
347 Views
Last Modified: 2013-12-25
Hello, I have a banner in different languages for different versions of my website(english, french, etc) I have a .resx file for each language so it changes all the labels and textboxes to the selected language. However, I'd like to change the banner according to the selected language. Is there any way to do that?

0
Comment
Question by:CharLieYv
2 Comments
 
LVL 15

Assisted Solution

by:jinal
jinal earned 20 total points
ID: 24870628
Ues server side <asp:Image runat="server" ID='ControlImage' />

Generate resource file for each language you get ImageUrl property in that so set path over there. so it work that way.
0
 

Accepted Solution

by:
CharLieYv earned 0 total points
ID: 24871014
Well, thank you for your input Jinal. However, I find out a solution myself which is in code below... you only need to have an image folder and have each language image in each folder. I created a method that changes the image, depending on culture. Just call that method on PageLoad()


protected void Image_Chg()
    {
        string cul = Thread.CurrentThread.CurrentUICulture.Name;
        if (cul.Equals("en-US"))
           Image1.ImageUrl = "~/Images/en-US/CIDH_Banner_en.jpg";
        if (cul.Equals("es-ES"))
           Image1.ImageUrl = "~/Images/es-ES/CIDH_Banner.jpg";
        if (cul.Equals("pt-PT"))
           Image1.ImageUrl = "~/Images/pt-PT/CIDH_Banner_pt.jpg";
        if (cul.Equals("fr-FR"))
           Image1.ImageUrl = "~/Images/fr-FR/CIDH_Banner_fr.jpg";
 
    }

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question