ASP.NET to handle multiple languages

I have an ASP.NET project with multiple user controls. The controls use English at the moment and I want them to be reworked to handle multiple languages

When I started my project, I hard coded text in user controls and initially decided that I would make different versions  of the project in different languages but I have changed my mind and I now want to use localization.

I need to create a BasePage to handle the language functionality.

I have already added the resource file. I need the resource files populated and to also have the acsx files changed to function with the populated resource files (English only for now).
LVL 1
IdaracAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Paul MacDonaldDirector, Information SystemsCommented:
...is there a question?
0
IdaracAuthor Commented:
Yes how do I about adding the localization to pick up multi languages?
0
Miguel OzSoftware EngineerCommented:
have you read this walkthrough?
First you need to create not only the English resource file but your supported languages files as well. See section "To create a resource file".
Secondly, you need to use the resource strings (surfaced as properties) from your resource class as shown in section "To add a Label control to the page". Notice that you can assign the string in either the mark-up or code behind.
Lastly, test it you could change your preferred language setting in your browser.
Note: You will require translators to fill up the resource files for other languages. automatic translators are not that good especially for business words/sentences.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

IdaracAuthor Commented:
Can you tell me the difference between implicit and explicit ?
0
Miguel OzSoftware EngineerCommented:
Implicit localization
Create one resource file per page per language.
Specify that control properties should automatically be read from a resource file but you do not need to explicitly specify which properties are localized: Set the "control.property" item to localize in resource file.


Explicit localization
Create one resource file per site per language.
Specify which properties are localized: Set the property in code behind or mark-up with the associated resource value.

My preference is explicit because it gives you:
Direct control over which property is set.
the opportunity to encode the text before setting the property. (Far too many times I was caught with special characters that broke my html)
0
IdaracAuthor Commented:
Thanx Miguel I did the walk through as you indicated in an earlier message and I successfully got the mutli language to work using an ASPX file. But I am having trouble getting it to work on my ascx file.

I have 5 usercontrols and I need to get them all working with multi language. For example in Autos folder for example, I have the App_LocalResources folder that holds 3 resource files, one of which is Autos.aspx.en.resx. There is also the Autos.ascx user control file.

I had hard coded the controls to start but now I want localization. So do I have to replace the hard coded text with references like this throughout the user control:: Text="<%$ Resources:btnSearchAutos.Text %>"
0
Miguel OzSoftware EngineerCommented:
The text property seems OK, but you are missing associated resx file for every user control.
Example: Autos.ascx will require Autos.ascx.resx
And then delete temporary ASP.NET files and rebuild your site for the changes to work.

If you are having user controls, you are better off using Explicit localization, but as you probably are finding out creating a file for every page and user control on your site is going to be time consuming.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IdaracAuthor Commented:
All your answers together helped figure it out thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.