web page in 2 languages

E

Eric Sabine

I have a web site that needs to exist in English and German. I certainly
could write it twice in both languages (one page for each language), but
what is the preferred method for multiple languages? I could be required
later to add a few more.

Thanks,
Eric
 
B

Bobby Ryzhy

I have a web site that needs to exist in English and German. I certainly
could write it twice in both languages (one page for each language), but
what is the preferred method for multiple languages? I could be required
later to add a few more.

Thanks,
Eric


Make all your text into labels. and then use a business layer class to read from the proper resx to fill out the label.text. Here is an
example of a localization class.

public class L10n
{
private static ResourceManager resourceManager = new ResourceManager("Business.L10n", Assembly.GetExecutingAssembly());
private static CultureInfo ci;

static L10n()
{
ci = GetCurrentCulture();
}

public static string GetString(string key)
{
resourceManager.IgnoreCase = true;
string text = resourceManager.GetString(key, ci);
if (text == null)
{
text = "String not found";
}
return text;
}

public static CultureInfo GetCurrentCulture()
{
string language = GetCurrentLanguageSetting();

switch (language.ToUpper())
{
default:
case "ENU":
return new CultureInfo("en-us");
case "CHS":
return new CultureInfo("zh-CN");
case "CHT":
return new CultureInfo("zh-TW");
case "FRA":
return new CultureInfo("fr-FR");
case "DEU":
return new CultureInfo("de-DE");
case "ITA":
return new CultureInfo("it-IT");
case "JPN":
return new CultureInfo("ja-JP");
case "PTB":
return new CultureInfo("pt-BR");
case "ESP":
return new CultureInfo("es-ES");
}
}
}
Bobby Ryzhy
bobby @ domain below
http://weekendtech.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top