母版页的本地化 [英] Localization of master page

查看:74
本文介绍了母版页的本地化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好......!

我需要为Master页面和内容页面设置不同的UI文化..

可以帮助我解决这个问题..

谢谢..!

Hello...!
I need to set Different UI Cultures for Master page and content page..
could some one help me solving out this..
Thank you..!

推荐答案

您可以使用以下几行在任何时候设置当前文化:



You can set the current culture at any point using the following lines:

System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-GB");
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-GB");





如果你需要改变不同组件的文化,那么就没有简单的方法可以做到这一点。您将不得不改变每个组件中的文化。



由于事件架构,这将变得复杂。



因此,PreInit,Init,Load,PreRender,Render事件不会在每个组件的生命周期中按顺序触发。它们按顺序通过页面层次结构触发。因此,PreInit将在主页面中触发,然后是页面,然后是控件。所有其他事件都是一样的。因此,您必须为每个事件更改每个组件的文化。



最好的方法是尽量减少交叉问题,这是使用面向方面编程(AOP)。



我建议PostSharp。这是Visual Studio的免费编译时AOP添加。



下面的文章更详细地解释了ASP.Net中的cutlure行为。



http: //stackoverflow.com/questions/4876520/programmatically-set-culture-of-user-controls-in-asp-net [ ^ ]


这篇关于母版页的本地化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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