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


     

  • 相关阅读:
    java循环遍历map
    java获取天气信息
    java使用json抛出org.apache.commons.lang.exception.NestableRuntimeException解决方案
    eclipse中如何导入jar包
    ext之关键字mixins、statics、require
    ext等待提示
    java保留两位小数的方法
    js循环便利json数据
    java计算一个月有多少天和多少周
    python--decorator装饰器
  • 原文地址:https://www.cnblogs.com/RobotTech/p/875799.html
Copyright © 2011-2022 走看看