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" %>


     

  • 相关阅读:
    一元试用一个月的备份服务,把编剧的套路彻底堵死
    微软开源 PowerShell 并支持 Linux 和 OS X
    MySQL Database on Azure 支持 5.7 版本啦!
    python把字典写入excel之一例
    python字典无序?有序?
    字典转化为有序列表
    对xml文件的sax解析(增删改查)之二
    对xml文件的sax解析(增删改查)之一
    XML中CDATA和#PCDATA的区别
    dtd文件中写的引用实体被xml文件引用后无法在浏览器中显示的问题
  • 原文地址:https://www.cnblogs.com/RobotTech/p/875799.html
Copyright © 2011-2022 走看看