[CLOSED] Language switch

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] Language switch

    I'm using Ext.Net in MVC2 as you know.

    Now i'm thinking on the right way to implement the language switch....

    For now it's done as directevent - but I'm experiencing some troubles with....

    viewport (runat="server" script section at the top"

     
    // Change culture 
    protected void ChangeCulture(object sender, DirectEventArgs e)
    {
    string myLanguage = e.ExtraParams["myLanguage"];
    ResourceManager.GetInstance(this).Locale = myLanguage;
    this.Session["Culture"] = new System.Globalization.CultureInfo(myLanguage);
    }
    viewport

     
    <ext:Menu runat="server">
    <Items>
    <ext:CheckMenuItem ID="LanguageGerman" Text="German" Group="Language">
    <DirectEvents>
    <Click OnEvent="ChangeCulture">
    <ExtraParams>
    <ext:Parameter Name="myLanguage" Value="de" />
    </ExtraParams>
    </Click>
    </DirectEvents>
    </ext:CheckMenuItem>
    <ext:CheckMenuItem ID="LanguageEnglish" Text="English" Group="Language">
    <DirectEvents>
    <Click OnEvent="ChangeCulture">
    <ExtraParams>
    <ext:Parameter Name="myLanguage" Value="en" />
    </ExtraParams>
    </Click>
    </DirectEvents>
    </ext:CheckMenuItem>
    </Items>
    </ext:Menu>
    Problems

    1. After load the default (preset) language isn't marked as active, but if I change the language it's always marked

    2. After changing the language, the screen doesn't refresh (except portal portlets)

    Questions

    - Which approach is preferable to switch language?

    - How can further elements be marked refreshable like the portlets?

    Cheers
    Last edited by Daniil; Oct 13, 2010 at 12:13 PM. Reason: [CLOSED]
  2. #2
    Hi tiramisu,

    I haven't run tests to confirm this, but if you change the Locale/Culture, I think you're going to have to do a complete refresh of the Page. Basically a hard postback.
    Geoffrey McGill
    Founder
  3. #3
    Hi tiramisu,

    Please clarify can this thread be marked as solved?
  4. #4
    Not yet, i'm still thinking how to implement it the right way.

    - As directmethod?
    - As controller-action having a redirecttoaction return?

    What is your advice?

    p.s.
    Which culture specific properties must be set in the ext.net toolkit?
  5. #5
    Hi,

    I don't think that using direct method to switch the language is good idea because many controls don't support change labels after rendering (like grid's headers menu labels)

    Therefore reload the page (postback?) is required. May be to use some localization route. There are many articles about localization under ASP.NET MVC
    http://stackoverflow.com/questions/1...lization-route
    http://stackoverflow.com/questions/1...vc-application
    http://geekswithblogs.net/shaunxu/ar...ion-1-day.aspx

    Which culture specific properties must be set in the ext.net toolkit?
    It is individually for each control. Many controls have properties which must be localized manually but many stabdard properties for Ext.Net controls are already localized for many languages. Please see
    https://examples1.ext.net/#/Miscellaneous/Locale/Basic/
    https://examples1.ext.net/#/Miscella...ined_Language/
    https://examples1.ext.net/#/Miscella...User_Language/
    Last edited by geoffrey.mcgill; Oct 11, 2010 at 12:48 PM.
  6. #6
    Thank you for all the external articles. My implementation does already implement localization as described there - but I'm not sure where I have to put the "ChangeCulture" Method. For now it is in the Page Header as Directmethod. Further question is also if it's enough for Ext-Net to define the language in the resource manager?

     
        // Change culture 
        protected void ChangeCulture(object sender, DirectEventArgs e)
        {
            string myLanguage = e.ExtraParams["myLanguage"];
            ResourceManager.GetInstance(this).Locale = myLanguage;
            this.Session["Culture"] = new System.Globalization.CultureInfo(myLanguage);
        }

Similar Threads

  1. Replies: 6
    Last Post: Jul 08, 2012, 8:58 PM
  2. switch to custom theme
    By angusbeare in forum 1.x Help
    Replies: 3
    Last Post: Mar 21, 2012, 12:31 PM
  3. Is possible to switch Store DataSourceID ?
    By Aod47 in forum 1.x Help
    Replies: 1
    Last Post: Mar 14, 2012, 4:46 AM
  4. [CLOSED] [1.2] Switch panels?
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 01, 2011, 3:57 PM
  5. Replies: 1
    Last Post: May 28, 2010, 6:52 AM

Tags for this Thread

Posting Permissions