473,320 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Multiple-lanugage support in ASP.NET question

I know there is Culture feature with Asp.net, but what I want to know is
how to organize/design a web application that supports multiple languages.
What is the best approach? Do I use "If, then.." to display one block of
HTML in English, and then another block in French? Is there an easy way?

Also, "string" itself doesn't support multiple cultures, right? If I
write a "string" property in a class, how do I make the property support
multiple cultures?
Nov 19 '05 #1
3 1282
I will break this down into two parts :

- fixed strings for the UI could be taken from resources files. .NET
provides support for this. You could also take those values from a DB
(likely cached) or some other location in particular if translation should
be updatable "live" by someone... You'll have support for this in .NET 2.0.
See the doc for "resources".

- I'm not really sure about what you meant by the second part. If you meant
by the "property", a "data" entered by the user there is little you can do.
Either the application insulates each group of users (for example the app
manages multiple projects using each an official language). If not, the data
model for your application will have to make provision so that users are
able to entered a localized version for each of their "data"...

Patrice
--

"00_CuMPe3WaR3D12" <00**************@yahoo.com> a écrit dans le message de
news:pd********************@rogers.com...
I know there is Culture feature with Asp.net, but what I want to know is
how to organize/design a web application that supports multiple languages.
What is the best approach? Do I use "If, then.." to display one block of
HTML in English, and then another block in French? Is there an easy way?

Also, "string" itself doesn't support multiple cultures, right? If I
write a "string" property in a class, how do I make the property support
multiple cultures?

Nov 19 '05 #2
Tim
Hello,
This is a huge field (almost like saying "how do I make my ASP.Net app
secure?), but here are some things to get you started:
Your best bet may be to use Resource files. These are xml files of
name-value pairs that contain all the text-strings. The current culture of
the app then automatically picks which file to use.

Check out the Globalization Namespace
http://msdn.microsoft.com/library/de...balization.asp

Here are some tutorials to get you started:
http://samples.gotdotnet.com/quickstart/aspplus
http://msdn.microsoft.com/library/de...balization.asp
Also, "string" itself doesn't support multiple cultures, right? If I
write a "string" property in a class, how do I make the property support
multiple cultures? Depends. If your string just returns values from the Database, then you
don't need to do anything.
If it returns something that included concentation, dates, or currency
formats, then you'll need to pass the object the current culture, and send
that into the ToString() method used to generate the strings for your
property.

HTH,
Tim
http://timstall.dotnetdevelopersjournal.com/

"00_CuMPe3WaR3D12" wrote:
I know there is Culture feature with Asp.net, but what I want to know is
how to organize/design a web application that supports multiple languages.
What is the best approach? Do I use "If, then.." to display one block of
HTML in English, and then another block in French? Is there an easy way?

Also, "string" itself doesn't support multiple cultures, right? If I
write a "string" property in a class, how do I make the property support
multiple cultures?

Nov 19 '05 #3
Thanks for the "resources", I will look into that.

For Property.. this is what I meant, for example I am creating a Person
class:

public class Person
{
private string _FirstName;

public FirstName(string myFirstName)
{
_FirstName = myFirstName;
}
}

In ASP.NET, string, by default doesn't support multi-languages.

Person myPerson = new Person();
myPerson.FirstName("John");

// I want to do something like this:
myPerson.FirstName("Le John", new CultureInfo("fr-FR"));
myPerson.FirstName("John", new CultureInfo("en-US"));
My solution is to implement this by using Hash Table and Methods (not using
Properties), by putting CultureInfo name as the key of hashtable. It works,
but not sure if that's the best way. What do you think? Does ASP.NET has a
better way?

public class FirstName
{
private Hashtable _FirstName = new Hashtable();

public string GetFirstName(CultureInfo myCulture)
{
return _FirstName[myCulture.Name].ToString();
}

public void SetFirstName(string myFirstName, CultureInfo myCulture)
{
_FirstName[myCulture.Name] = myFirstName;
}
}
C.P.


"Patrice" <no****@nowhere.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I will break this down into two parts :

- fixed strings for the UI could be taken from resources files. .NET
provides support for this. You could also take those values from a DB
(likely cached) or some other location in particular if translation should
be updatable "live" by someone... You'll have support for this in .NET 2.0. See the doc for "resources".

- I'm not really sure about what you meant by the second part. If you meant by the "property", a "data" entered by the user there is little you can do. Either the application insulates each group of users (for example the app
manages multiple projects using each an official language). If not, the data model for your application will have to make provision so that users are
able to entered a localized version for each of their "data"...

Patrice
--

"00_CuMPe3WaR3D12" <00**************@yahoo.com> a écrit dans le message de
news:pd********************@rogers.com...
I know there is Culture feature with Asp.net, but what I want to know is how to organize/design a web application that supports multiple languages. What is the best approach? Do I use "If, then.." to display one block of HTML in English, and then another block in French? Is there an easy way?

Also, "string" itself doesn't support multiple cultures, right? If I
write a "string" property in a class, how do I make the property support
multiple cultures?


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Rolf Wester | last post by:
Hi, I have a form with a select element with multiple="true". When using the GET method (I suppose the same happens with the POST method) I can seen that the form sends channels=CH1&channels=CH2...
66
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
5
by: Morgan Cheng | last post by:
It seems no pattern defined by GoF takes advantage of multiple inheritance. I am wondering if there is a situation where multiple inheritance is a necessary solution. When coding in C++, should...
6
by: Ben Hallert | last post by:
Hi guys, I'm trying to figure out what bone headed mistake I made on something I put together. I've got a form (named 'context') that has a variable number of select-multiple inputs on it. ...
5
by: Neelesh Bodas | last post by:
This might be slightly off-topic. Many books on C++ consider multiple inheritence as an "advanced" concept. Bruce Eckel says in TICPP, volume 2 that "there was (and still is) a lot of...
2
by: areef.islam | last post by:
Hi, I am kinda new to javascript and I am having this problem with selecting multiple options from a select tag. Hope someone can help me out here. here is my code...
1
by: abhishekhs | last post by:
Hi all I have more than one multiple select lists in a page. Something like this <tr> <td> <select NAME="StrainList" ID="StrainList" SIZE="5" multiple="multiple" style="width: 150px"> <?...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
6
by: phpnewbie26 | last post by:
My current form has one multiple select drop down menu as well as few other drop down menus that are single select. Originally I had it so that the multiple select menu was first, but this created...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.