locked
Globalization/localization help needed RRS feed

  • Question

  • User765438783 posted

    Hi Friends,

    I am new (zero) to globalization/localization concept.

    I need your help.

    I did go through a lot of examples, but I could not make my web application work :(

    1) Creating Resource files (French)

    File name: LangueResource.fr-CA.resx

    Key & Value: WelcomeMessage & Bonjour

    2) Binding control with the ResouceKey in Design

    <form id="form1" runat="server">
     <table>
      <tr>
       <td>
        <asp:label id="lbl" runat="server" Text="<%$ Resources:LangueResource, WelcomeMessage%">     
        </asp:label>
       </td>
      </tr>
     </table>
    </form>


    3) Setting the Culture & UICulture in Code behind

    // The following namespaces were added
    using System.Globalization;
    using System.Threading;
    
    public partial class _Default : System.Web.UI.Page 
    {
        protected override void InitializeCulture()
        {
            base.InitializeCulture();
            
            Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-CA");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-CA");
        }
    
        protected void Page_Load(object sender, EventArgs e)
        {
    
        }
    }

    I don't know what else I missed here, but I don't see any thing on my web page, when I try to run it.

    Please advise.

    Thank you very much!

    Disregard, What I just said. It seems to work, not sure though!
     

    Tuesday, August 28, 2012 2:49 PM

All replies

  • User1771049139 posted

    See articles/Examples at following URL if that can help you :

    Set the Culture
    Globalization and Localization in .NET

    Thursday, August 30, 2012 12:21 PM
  • User2105670541 posted

    change your code to below:

    // The following namespaces were added
    using System.Globalization;
    using System.Threading;
    
    public partial class _Default : System.Web.UI.Page 
    {
        protected override void InitializeCulture()
        {        
            Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-CA");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-CA");
            base.InitializeCulture();
        }
    
        protected void Page_Load(object sender, EventArgs e)
        {
    
        }
    }



    Friday, August 31, 2012 2:16 PM
  • User765438783 posted

    Actually, I have deployed this website on the Server.

    I have mapped the project folder(shared folder) to my computer.

    When I open the website in Visual Studio from the shared folder and run the website, it works fine.

    But, when I browse deployed website through URL directly, it does not work.

    I get the below error message:

     

    Server Error in '/' Application.


    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: The resource object with key 'LangueLink' was not found.

    Source Error:

    Line 40:                 <td>
    Line 41:                     <%--<a href="#" id="lnkLang" onclick="ChangeLang()" runat="server">fr</a>--%>
    Line 42: <asp:linkbutton id="lbLang" runat ="server" onclick="lbLang_Click" Text="<%$ Resources:GlobalizationDemo, LangueLink %>" ></asp:linkbutton> Line 43:                 </td>
    Line 44:             </tr>
    Friday, October 19, 2012 4:27 PM