locked
How to Add Reginoal Languges in Application RRS feed

  • Question

  • User-1720479301 posted

    Dear All ,

               we have an web application now we like to add new regional languges like PASHTO or Persian or URDU (which has option which languge do u like ) how to add these funcation could u any one tell me ,,, so do we need to change in Database tooo or not

    thanks

    Thursday, May 26, 2011 2:39 AM

Answers

  • User-276842610 posted

    Hi ismail.nasar,

    Thanks for your post.

    You can use resources to <o:p>customize your application for a chosen culture and locale</o:p>

    <o:p>At first, </o:p><o:p>create a set of resource files (.resx), one file for each language, stores localized text.</o:p>

    <o:p>Then, in your page, you indicate that controls should use resources for their property values. t</o:p><o:p>he following code example shows that lets users select their regional language from a drop-down list.</o:p>

    <o:p>
     <script runat="server">
            protected override void InitializeCulture()
            {
                if (Request.Form["ListBox1"] != null)
                {
                    String selectedLanguage = Request.Form["ListBox1"];
                    UICulture = selectedLanguage;
                    Culture = selectedLanguage;
    
                    Thread.CurrentThread.CurrentCulture =
                        CultureInfo.CreateSpecificCulture(selectedLanguage);
                    Thread.CurrentThread.CurrentUICulture = new
                        CultureInfo(selectedLanguage);
                }
                base.InitializeCulture();
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ListBox ID="ListBox1" runat="server">
                <asp:ListItem Value="ps-AF">Pashto</asp:ListItem>
                <asp:ListItem Value="fa">Persian</asp:ListItem>
                <asp:ListItem Value="ur">URDU</asp:ListItem>
            </asp:ListBox>
            <br />
            <asp:Button ID="Button1" runat="server" Text="Set Language" meta:resourcekey="Button1" />
            <br />
            <asp:Label ID="Label1" runat="server" Text="" meta:resourcekey="Label1" />
        </div>
    </o:p>

     

    At run time, the browser indicates the user's regional language, ASP.NET selects the appropriate .resx file, and the controls' property values are derived from the resource file.

    <o:p>Detailed culture information appears in the National Language Support (NLS) API Reference at the Go Global Developer Center.</o:p>

    <o:p>More details please refer: http://msdn.microsoft.com/en-us/library/c6zyy3s9.aspx</o:p>

    <o:p>Hope this helps, thanks.</o:p>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 27, 2011 4:18 AM
  • User-276842610 posted

    Hi ismail.nasar,

    thanks for your reply,

    above reply I explained how to localization the static content(for example: label) for application.

    for database content localization,  in my experience, you can define specific field in each table for different language or customize program to connect different dababase according the language chosen.

    also, I found a thread similar to your requirement , please refer: http://forums.asp.net/t/984430.aspx

    hope this helps, thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 30, 2011 2:25 AM

All replies

  • User-276842610 posted

    Hi ismail.nasar,

    Thanks for your post.

    You can use resources to <o:p>customize your application for a chosen culture and locale</o:p>

    <o:p>At first, </o:p><o:p>create a set of resource files (.resx), one file for each language, stores localized text.</o:p>

    <o:p>Then, in your page, you indicate that controls should use resources for their property values. t</o:p><o:p>he following code example shows that lets users select their regional language from a drop-down list.</o:p>

    <o:p>
     <script runat="server">
            protected override void InitializeCulture()
            {
                if (Request.Form["ListBox1"] != null)
                {
                    String selectedLanguage = Request.Form["ListBox1"];
                    UICulture = selectedLanguage;
                    Culture = selectedLanguage;
    
                    Thread.CurrentThread.CurrentCulture =
                        CultureInfo.CreateSpecificCulture(selectedLanguage);
                    Thread.CurrentThread.CurrentUICulture = new
                        CultureInfo(selectedLanguage);
                }
                base.InitializeCulture();
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ListBox ID="ListBox1" runat="server">
                <asp:ListItem Value="ps-AF">Pashto</asp:ListItem>
                <asp:ListItem Value="fa">Persian</asp:ListItem>
                <asp:ListItem Value="ur">URDU</asp:ListItem>
            </asp:ListBox>
            <br />
            <asp:Button ID="Button1" runat="server" Text="Set Language" meta:resourcekey="Button1" />
            <br />
            <asp:Label ID="Label1" runat="server" Text="" meta:resourcekey="Label1" />
        </div>
    </o:p>

     

    At run time, the browser indicates the user's regional language, ASP.NET selects the appropriate .resx file, and the controls' property values are derived from the resource file.

    <o:p>Detailed culture information appears in the National Language Support (NLS) API Reference at the Go Global Developer Center.</o:p>

    <o:p>More details please refer: http://msdn.microsoft.com/en-us/library/c6zyy3s9.aspx</o:p>

    <o:p>Hope this helps, thanks.</o:p>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 27, 2011 4:18 AM
  • User-1720479301 posted

    Dear Sir ,

                 i have application i have to add new languges the application is english i have to add Pashto will i have to make another database to get value from database or it will do by third party software ,,  i m really confused what to do ,,

    Monday, May 30, 2011 1:16 AM
  • User-276842610 posted

    Hi ismail.nasar,

    thanks for your reply,

    above reply I explained how to localization the static content(for example: label) for application.

    for database content localization,  in my experience, you can define specific field in each table for different language or customize program to connect different dababase according the language chosen.

    also, I found a thread similar to your requirement , please refer: http://forums.asp.net/t/984430.aspx

    hope this helps, thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 30, 2011 2:25 AM