[CLOSED] Urgent: Ext.Net's support for localization and internationalization

Page 4 of 4 FirstFirst ... 234
  1. #31
    Quote Originally Posted by geoffrey.mcgill View Post
    The Date parsing issue has been fixed and committed to SVN.

    Setting a neutral culture ("fr") in the UICulture property of the @Page directive is not supported. You must set to a specific Culture. This is a limitation of ASP.NET.
    Yes, the Date parsing works correctly now, and I originally mis-understood the other statement regarding neutral cultures. ASP.NEt actually allows and supports specifying a neutral culture for the @Page directive, and it loads the correct resources.
    The problems arises when formatting things (like Dates etc), where .Net raises an exception if culture is neutral, because specific cultures based on the neutral culture can have different format strings (consider dates in en-US and en-UK).

    Quote Originally Posted by geoffrey.mcgill View Post
    You can use a neutral culture in the .Locale property of the <ext:ResourceManager>. This enables a work-around for the UICulture limitation noted above.

    Example

    <ext:ResourceManager runat="server" Locale="fr" />
    This still does not work, using the latest 3671 revision from SVN. Get the following exception:

    NotSupportedException: Culture 'en' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.]
       System.Globalization.CultureInfo.CheckNeutral(CultureInfo culture) +7480274
       System.Globalization.CultureInfo.get_DateTimeFormat() +28
       Ext.Net.Utilities.DateTimeUtils.ConvertNetToPHP(String format, CultureInfo culture) +351
       Ext.Net.Utilities.DateTimeUtils.ConvertNetToPHP(String format) +54
       Ext.Net.NetToPHPDateFormatStringJsonConverter.WriteJson(JsonWriter writer, Object value, JsonSerializer serializer) +174
       Ext.Net.ClientConfig.ToExtConfig(Object obj, ConfigOption configOption) +4554
       Ext.Net.ClientConfig.Process(Object obj) +832
    
    [Exception: Error during ClientConfig initialization. FormatProxy - Culture 'en' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.]
       Ext.Net.ClientConfig.Process(Object obj) +1060
       Ext.Net.ClientConfig.Serialize(Object obj, Boolean ignoreCustomSerialization) +1044
       Ext.Net.ClientConfig.Serialize(Object obj) +45
       Ext.Net.XControl.get_InitialConfig() +117
       Ext.Net.XControl.OnClientInit(Boolean reinit) +874
       Ext.Net.Observable.OnClientInit(Boolean reinit) +50
       Ext.Net.XControl.SetResources() +253
       Ext.Net.XControl.PreRenderAction() +98
       Ext.Net.Observable.PreRenderAction() +300
       Ext.Net.XControl.Render(HtmlTextWriter writer) +224
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
       System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
       System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
       Ext.Net.XControl.HtmlRender(HtmlTextWriter writer) +232
       Ext.Net.XControl.Render(HtmlTextWriter writer) +412
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter wri
    Quote Originally Posted by geoffrey.mcgill View Post
    It's a limitation when formatting and parsing DateTime objects and using the CurrentUICulture. Probably doesn't matter if set in @Page directive or code-behind.
    Yes, it does not matter if its @Page directive or code-behind. I misunderstood as explained above. I thought you were talking in general terms, while I now believe you were talking in spciific context of parsing date/times.

    Quote Originally Posted by geoffrey.mcgill View Post
    ok, I've committed (#3467) fix/work-around for the UICulture limitation when setting a neutral culture.

    The following is possible.

    Example

    <%@ Page Language="C#" UICulture="fr" %>
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
     
    <script runat="server">
    	protected void Button1_Click (object sender, DirectEventArgs e)
    	{
    		X.Msg.Notify("Selected date", this.DateField1.SelectedDate.ToLongDateString()).Show();
    	}
    </script>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
         
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />           
             
            <ext:DateField ID="DateField1" runat="server" />
             
            <ext:Button runat="server" Text="Submit" OnDirectClick="Button1_Click" />
        </form>
    </body>
    </html>
    As noted above, I still get an exception.

    However, I am not pursuing this further, because I have updated our code to NOT use neutral cultures, but use a specific culture if browser returns a neutral culture.
  2. #32
    To discuss this further (I am not requesting any immediate fixes), I did not notice earlier that in this thread, we actually resorted to using UICulture for serializing Date time strings.

    I should have been more vigilant in replying to this comment from vlad (http://forums.ext.net/showthread.php...ll=1#post50265), which says Culture control Date/time strings, which is actually correct.

    I am not sure what I was thinking about when I replied to that comment of vlad, but yes, the design of .Net framework is to use Culture for formatting Date/Time strings.

    I think I might have taken this in the wrong direction (and I am apologetic for the same), but the Ext.Net team might want to re-evaluate using UICulture for Date/Time as other ASP.NET users might be expecting Culture to be used for the purpose.
  3. #33
    Quote Originally Posted by geoffrey.mcgill View Post
    You can use a neutral culture in the .Locale property of the <ext:ResourceManager>. This enables a work-around for the UICulture limitation noted above.

    Example

    <ext:ResourceManager runat="server" Locale="fr" />
    Hope this helps.

    Using revision 3467

    This will give an exception on my DatePicker...

    I need <ext:ResourceManager runat="server" Locale="nl" /> This worked in a revision a week back. I will revert back to that revision in the meanwhile.

    Exception:

    Culture 'nl' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
    Exception Details: System.NotSupportedException: Culture 'nl' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.
    
    Source Error: 
    
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
    
    Stack Trace: 
    
    
    [NotSupportedException: Culture 'nl' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.]
       System.Globalization.CultureInfo.CheckNeutral(CultureInfo culture) +7484226
       System.Globalization.CultureInfo.get_DateTimeFormat() +28
       Ext.Net.Utilities.DateTimeUtils.ConvertNetToPHP(String format, CultureInfo culture) +258
       Ext.Net.Utilities.DateTimeUtils.ConvertNetToPHP(String format) +48
       Ext.Net.DatePicker.get_FormatProxy() +44
       Ext.Net.DatePicker.get_ConfigOptions() +2425
       Ext.Net.ClientConfig.Process(Object obj) +187
       Ext.Net.ClientConfig.Serialize(Object obj, Boolean ignoreCustomSerialization) +834
       Ext.Net.ClientConfig.Serialize(Object obj) +39
  4. #34
    Quote Originally Posted by geoffrey.mcgill View Post
    The Date parsing issue has been fixed and committed to SVN.

    Setting a neutral culture ("fr") in the UICulture property of the @Page directive is not supported. You must set to a specific Culture. This is a limitation of ASP.NET.

    Example

    // Fail
    <%@ Page Language="C#" UICulture="fr" %>
    
    // Pass
    <%@ Page Language="C#" UICulture="fr-FR" %>
    Hope this helps.

    This sounds not correct because if I look at: http://msdn.microsoft.com/en-us/libr...c508.aspx#Y950 I see


    To set the UI culture and culture for an individual page, set the Culture and UICulture attributes of the @ Page directive, as shown in the following example:


    <%@ Page UICulture="es" Culture="es-MX" %>
  5. #35
    Hi,

    For date parsing you cannot use neutral culture (therefore Microsoft set specific culture for Culture and neutral for UICulture)
    We fixed it already. Now if you set neutral culture (like, Locale="nl") then we automatically converts it specific culture (nl-NL)

    Please note that now parsing (date, time) is based on Locale property from ResourceManager
  6. #36
    Quote Originally Posted by Vladimir View Post
    Hi,

    For date parsing you cannot use neutral culture (therefore Microsoft set specific culture for Culture and neutral for UICulture)
    We fixed it already. Now if you set neutral culture (like, Locale="nl") then we automatically converts it specific culture (nl-NL)

    Please note that now parsing (date, time) is based on Locale property from ResourceManager


    Ok I downloaded latest svn and this seems to work now.
  7. #37
    Quote Originally Posted by Vladimir View Post
    Hi,

    For date parsing you cannot use neutral culture (therefore Microsoft set specific culture for Culture and neutral for UICulture)
    We fixed it already. Now if you set neutral culture (like, Locale="nl") then we automatically converts it specific culture (nl-NL)

    Please note that now parsing (date, time) is based on Locale property from ResourceManager
    Sorry to bug you with this one again ..

    But when you add this line to your web config:

    <globalization culture="nl-NL" uiCulture="nl"/>
    it will override the Locale="nl" in the resource manager.

    See this code without the global culture setting will work but not with it:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
    
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <ext:ResourceManager ID="ResourceManager1" runat="server" InitScriptMode="Linked" Locale="nl" />
    
            <ext:DatePicker ID="DatePickerCalendar" runat="server" Width="150">
    
            </ext:DatePicker>
            <ext:CalendarPanel ID="CalendarPanel1" runat="server" ActiveIndex="1" Border="false" Height="719" Width="800" ShowNavBar="true">
                <GroupStore ID="GroupStore1" runat="server">
                    <Groups>
                        <ext:Group CalendarId="1" Title="Home" />
                        <ext:Group CalendarId="2" Title="Work" />
                        <ext:Group CalendarId="3" Title="School" />
                    </Groups>
                </GroupStore>
                <WeekView ID="Weekview1" runat="server" Showheader="true" Showweeklinks="true" Showweeknumbers="true" DDMoveEventText="(not supported)" Split="true" DayCount="7" ShowTime="false" />
            </ext:CalendarPanel>
        </div>
        </form>
    </body>
    </html>
  8. #38
    Hi,

    Thank you for the report. Fixed in SVN
  9. #39
    Hi r_honey,

    Could you clarify can we mark this thread as closed?
Page 4 of 4 FirstFirst ... 234

Similar Threads

  1. Replies: 0
    Last Post: Aug 06, 2012, 3:59 AM
  2. need urgent help challenging job
    By grajaneesh in forum 1.x Help
    Replies: 1
    Last Post: Apr 08, 2011, 2:31 PM
  3. [CLOSED] Message Box Localization support
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Apr 07, 2011, 8:17 PM
  4. [CLOSED] Help urgent with fileupload
    By smart+ in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Oct 05, 2010, 12:13 PM

Posting Permissions