Implicit Localization Expressions : Resource file « I18N « ASP.NET Tutorial






File: LocalizablePageImplicit.aspx

Always create a default localization file. 
If you don't create a default localization file, other culture-specific localization files are ignored.


<%@ Page Language="C#" UICulture="auto" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        lblMessage.Visible = true;
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Localizable Page Implicit</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <asp:Button
        id="btnSubmit"
        meta:resourceKey="btnSubmit"
        Text="Click Me!"
        ToolTip="Click to show message"
        OnClick="btnSubmit_Click"
        Runat="server" />

    <br /><br />

    <asp:Label
        id="lblMessage"
        meta:resourceKey="lblMessage"
        Text="Thank You!"
        Visible="false"
        Runat="server" />

    </div>
    </form>
</body>
</html>


File: App_LocalResources\LocalizablePageImplicit.aspx.es.resx
Name                 Value
btnSubmit.Text       ttt
btnSubmit.ToolTip   tt
lblMessage.Text       t








22.6.Resource file
22.6.1.Explicit Localization Expressions
22.6.2.Implicit Localization Expressions
22.6.3.Using Local Resources with Page Properties
22.6.4.You also can use implicit resource expressions when setting the page title.
22.6.5.Retrieving Local Resources Programmatically