如何使用app_GlobalResource或app_LocalResource? [英] How to use app_GlobalResource or app_LocalResource?

查看:428
本文介绍了如何使用app_GlobalResource或app_LocalResource?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用他们在一个ASP.NET Web应用程序项目?有什么区别?

How to use them in a ASP.NET Web Application project? Any difference?

非常感谢

推荐答案

本地资源:


  1. 本地资源是专用于单个网页并用于以不同的语言提供的Web页面的版本。

  2. 本地资源必须存储在App_LocalResources文件子文件。

  3. 本地资源,必须以格式[。外语/语言与文化的.resx命名。

例如:Default.aspx.resx-基地的资源文件。这是默认的,或备用,资源文件。

Ex: Default.aspx.resx- Base resource file. This is the default, or fallback, resource file.

Default.aspx.de.resx-德国资源文件等。

Default.aspx.de.resx- A resource file for German etc.

全球资源:

全球资源本地化的建议ASP.NET


  1. 全球资源,可从任何页面或code是在应用​​程序中读取。

  2. 全球资源必须在应用程序的根目录中存储在App_GlobalResources文件。

  1. Global resource can be read from any page or code that is in the application.
  2. Global resource must be stored in App_GlobalResources at the root of the application.

//获取全球资源的字符串。

// Get the global resource string.

 try
 { 
     globalresourcestring = (String)GetGlobalResourceObject("MyResource", "GlobalResourceString1"); 
 } 
 catch
 { 
     globalresourcestring = "Could not find global resource."; 
 }


这篇关于如何使用app_GlobalResource或app_LocalResource?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆