zoukankan      html  css  js  c++  java
  • Resource 学习笔记

    //=============================================================
    <asp:Button ID="Button1" runat="server" Text="" ToolTip="" meta:resourcekey="Button1Resource1" />

    Name / Value
    Button1Resource1.Text / My Button
    Button1Resource1.ToolTip / My Custom Tooltip
    //=============================================================

    <%@ Page meta:resourcekey="PageResource1" Language="C#"......

    Name / Value
    PageResource1.Title / My Page Title

    //=============================================================

    The Culture value determines the results of culture-dependent functions, such as the date, number, and currency formatting, and so on.
    The UICulture value determines which resources are loaded for the page.

    //=============================================================
    <!--App_LocalResources-->
    <asp:localize ID="Localize1" runat="server" Text="<%$Resources:,description %>"></asp:localize>

    <!--App_GlobalResources : LocalizedText.resx-->
    <asp:Localize ID="Localize2" runat="server" Text="<%$resources:LocalizedText,Description %>"></asp:Localize>

    <!--App_LocalResources-->
    <asp:Label ID="Label1" runat="server" Text="<%$Resources:,SID %>"></asp:Label>
    //=============================================================

    <%@ Page UICulture="en-US" Culture="en-US" %>
    <%@ Page UICulture="zh-CN" Culture="zh-CN" %>
    <%@ Page UICulture="zh-TW" Culture="zh-TW" %>

    <%@ Page Language="C#" Theme="Classic" UICulture="zh-TW" Culture="zh-TW"......


    protected override void InitializeCulture()
        {
            System.Threading.Thread.CurrentThread.CurrentCulture =
                System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
            System.Threading.Thread.CurrentThread.CurrentUICulture =
                new System.Globalization.CultureInfo("en-US");

            //or
            Page.Culture = "zh-CN";
            Page.UICulture = "zh-CN";

            base.InitializeCulture();
        }


    protected void Page_PreInit(object sender, EventArgs e)
        {
            this.Theme = "Modern";
        }


    this.txtTest.Text = GetLocalResourceObject("BIRTHDAY").ToString();
    this.txtTest.Text += (String)GetGlobalResourceObject("LocalizedText", "Description");

    //To retrieve global resources using strong typing
    this.txtTest.Text += Resources.LocalizedText.Description;

    web.config:
    <system.web>
    ...
    <globalization culture="Auto" uiCulture="Auto" fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8"/>
    ...

    <%@ Page RequestEncoding="utf-8" ResponseEncoding="utf-8" %>


     

  • 相关阅读:
    《英语语法新思维初级教程》学习笔记(七)五种基本句型
    《英语语法新思维初级教程》学习笔记(六)实义动词与(情态)助动词
    《英语语法新思维初级教程》学习笔记(五)形容词
    《英语语法新思维初级教程》学习笔记(四)数量限定词和个体限定词
    C# Redis存Session Hash存对象
    MVC中Spring.net 对基类控制器无效 过滤器控制器无效
    C# datagridview列绑定类中类的属性
    商品评分效果JavaScript
    C# SQL数据库学习时遇到到一些异常
    C语言用一维数组打印杨辉三角(原:无意中想到)
  • 原文地址:https://www.cnblogs.com/RobotTech/p/875799.html
Copyright © 2011-2022 走看看