Multiple Languages

Last post 05-15-2009 11:00 PM by element109. 8 replies.

Sort Posts:

  • Multiple Languages

    07-22-2005, 9:21 AM
    • Member
      55 point Member
    • snufff
    • Member since 07-22-2005, 11:05 AM
    • Lisboa
    • Posts 11

    I'm trying to implement multiple languages in portal starter kit!

    1st

    I made Configuration an abstract class with virtual methods.

    2st

    i made 4 classes ConfigurationPor, ConfigurationEng, ConfigurationEsp and ConfigurationFra witch each one implements an abstract class Configuration. This is because the xml I want to read is different.

    It appears that now, I just to Implement the ascx and aspx files with the Configuration I want.

    I'm portuguese, so sorry about my english!

    Now the question?

    Do I Make any sense doing this???
    Is there other way to make this?

    Regards
    João Martins

  • Re: Multiple Languages

    07-22-2005, 9:40 PM
    • Participant
      904 point Participant
    • monu245
    • Member since 10-20-2004, 1:58 PM
    • Posts 177
    The best idea is to know about resource files. it is .resx file in .net. Let me give u little idea about how it will work.

    store all your static strings in .resx files. and whenever you want to display some contents pull it from resource file. All contents will come from database which can be saved in any language. (It will be saved in default localization language). now according this, suppose you have one button on web and you need to display "ãããããã", then store this string in .resx file and at the time of showing this button, pull this string from file and assign the value to appropriate variable. The best thing for using this is suppose, you want this site to be displayed in french, then you just need another .resx file which will be having all the same strings written in french. and the whole site will be seen in french.

    Monu245
    http://www.codaddict.com - A new way to share/store/bookmark your code snippets
  • Re: Multiple Languages

    07-26-2005, 10:29 AM
    • Member
      55 point Member
    • brownd12
    • Member since 06-30-2005, 2:29 PM
    • Posts 11
    Could you explain a little more on this?Cool [H]
  • Re: Multiple Languages

    07-27-2005, 10:41 AM
    • Member
      55 point Member
    • snufff
    • Member since 07-22-2005, 11:05 AM
    • Lisboa
    • Posts 11

    With ConfigurationPor,ConfigurationEsp,ConfigurationFra... deriving from Configuration I Finally get there!
    I did this, put the lang in Cache and voila, the language stays! even when i 'm administrating the portal!

    thanks for your help!

  • Re: Multiple Languages

    07-27-2005, 10:51 AM
    • Member
      55 point Member
    • brownd12
    • Member since 06-30-2005, 2:29 PM
    • Posts 11

    Can you show me how you did this? I sure would appreciate it. Did you put a control on the default page for the user to select a language?

     

    Thanks

     

    Dave

  • Re: Multiple Languages

    07-28-2005, 6:55 PM
    • Member
      55 point Member
    • snufff
    • Member since 07-22-2005, 11:05 AM
    • Lisboa
    • Posts 11
    Hi Dave

    It's a bit complicated to explain, but i will do my best.

    1 step

    - DesktopPortalBanner.ascx

    Add 2 or more imagebuttons with the flags you want to implement

    2 step

    - Configuration.cs

    Make abstract the Configuration class
    Make abstract the SaveSiteSettings() Method
    Remove static method GetSiteSettings() (This method will be necessary later)

    Make many classes as the languages as you want.

    - for a Portuguese language example:

    Make a class that inherits Configuration

    public Class ConfigurationPor : Configuration

    this class as two methods
    1- public static GetSiteSettings()
    2- public override SaveSiteSettings()

    this class points for an individual xml (PortalCfgPor.xml) each Configuration points to individual XML Config File

    3- Step
    Inside the if in GetSiteSettings and inside the if in SaveSiteSettings add the code:

    HttpContext.Current.Cache.Insert("PortalLang","por");

    this is because you need the lang setting to know the lang you use

    4- Step

    - DesktopPortalBanner.ascx

    Method ClickEvent on the flag
    add the folow lines of code to do enter in a different language

    Cache.Remove("SiteSettings");

    ConfigurationFra.GetSiteSettings();

    Response.Redirect(Request.RawUrl);

    If you are getting it i will continue...
    this is not all...

    João Martins

  • Re: Multiple Languages

    08-04-2005, 7:30 AM
    • Member
      55 point Member
    • snufff
    • Member since 07-22-2005, 11:05 AM
    • Lisboa
    • Posts 11

    The code before is not 100% correct, there was a bug, that I already resolved, if anyone goes to implement the same thing, I will explain again.

    Rergards

    João Martins

  • Re: Multiple Languages

    04-25-2008, 3:18 AM

    Hi Joao, 

     I m trying to implement the same , can just help me out.

    Thanks 

    Alok
  • Re: Multiple Languages

    05-15-2009, 11:00 PM
    • Member
      12 point Member
    • element109
    • Member since 05-15-2009, 10:57 PM
    • Posts 6

    I have created a new project called Language Resources that may help. http://languageresources.codeplex.com/

Page 1 of 1 (9 items)