views:

175

answers:

4

hi all I have a question about localization how can i do localization lets say that i have a dropdown list that holds the available languages: English,french and arabic and I have a label which get it says "good morning",so i want to change the lang. according to selected lang. in drop down list so when the user chooses french label will say "bonjour" and when the user slect arabic the label will hold "صباح الخير" AND MOVE IT FROM THE LEFT OF THE PAGE TO THE RIGHT BECAUSE ARABIC IS WRITTEN FROM RIGHT TO LEFT ,, ANY HELP WILL BE HIGHLY APPERCAITED THNX IN ADVACE

A: 

you can create an http module that is going to read the html from the output stream and translate it,use RegEx and make sure not to translate html tags and JavaScript

Omu
This is surely a convoluted solution as ASP.NET (and .NET in general) supports native tools for localizing applications.
Dario Solera
thnx omu,,i want to change the page layout when the arabic language is selceted. so the page layout will be from right to left. that means if we have a table on the left side of the page, the table will flip to the right side of the page. so i need an advice,
hatemGamil
I think there should be something about this right left thing on MSDN
Omu
+2  A: 

In short, localization in ASP.NET is fully supported using resource files, e.g. files containing strings, images and other resources for each user interface language. They're named after the culture, for example MyResources.en-US.resx or MyCulture.fr-FR.resx.

The only thing that is a bit tricky is handling LTR and RTL languages and, as far as I know, must be done "manually", via code, or via CSS.

You might want to check some documentation on MSDN.

Dario Solera
A: 

there is also the asp.net standard (built-in) way, with resource files, just right click your project and click add items resource file, you must create a resource file for each language like for example: MUI.resx (that's the neutral one), MUI.fr.resx, MUI.es.resx, and you are going to use them in the web pages like this: MUI.keyword , that's if you are going to have one resx per language for all pages, you could also have one resx per language per webform. And the current language is in the System.Threading.CurrentThread.CurrentUICulture google it a little bit you will find more, at least now you know what to look for

Omu
+1  A: 

Have you ever saw the Localization video tutorials from ASP.NET website?

How Do I: Create a Multi-Lingual Site with Localization?

and

How Do I: Localize an ASP.NET AJAX Application?

They are great to get you started...

balexandre