web page in 2 languages

Discussion in 'ASP .Net' started by Eric Sabine, Jul 29, 2004.

  1. Eric Sabine

    Eric Sabine Guest

    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
     
    Eric Sabine, Jul 29, 2004
    #1
    1. Advertising

  2. Eric Sabine

    Bobby Ryzhy Guest

    On Thu, 29 Jul 2004 14:51:39 -0400, "Eric Sabine" <mopar41@hyotyt_mail_nounderscores.com> wrote:

    >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
     
    Bobby Ryzhy, Jul 29, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Reny J Joseph Thuthikattu
    Replies:
    1
    Views:
    562
    =?Utf-8?B?UHJha2FzaC5ORVQ=?=
    Dec 30, 2004
  2. Shapper
    Replies:
    10
    Views:
    581
    TDAVISJR
    Apr 25, 2005
  3. Karol Strugala

    two languages on jsp-page

    Karol Strugala, Apr 10, 2004, in forum: XML
    Replies:
    1
    Views:
    351
    Ashmodai
    Apr 13, 2004
  4. Jon F
    Replies:
    5
    Views:
    339
    Jon F
    Nov 24, 2008
  5. Replies:
    3
    Views:
    388
Loading...

Share This Page