如何在asp.net语言站点 [英] how to make multilingual site in asp.net

查看:140
本文介绍了如何在asp.net语言站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发asp.net中多语言网站,但我不知道如何可以做到这一点,因为我们可以通过资源文件管理多语种的语言。我们这样做,但我的主要问题是,我们如何能够为特定的用户在运行时更改全球化。如果用户选择英语,那么他/她可以查看此我英语,如果B的用户选择西班牙语,那么他/她可以查看本网站的西班牙语。我们怎样才能做到这一点?或者我们如何可以选择特定的语言资源文件???

I am developing a site in asp.net in multiple languages but i didn't understand how this can be done because we can manage multilingual language by using resource files. we did this, but my major problem is that how we can change globalization at run time for a particular user. if A user choose English language then he/she can view this i English and if B user choose Spanish then he/she can view this site in Spanish. How we can do this? or how we can choose a particular language resource file???

推荐答案

使用此代码

protected override void InitializeCulture() 
{ 
    Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); //'en-US' these values are may be in your session and you  can use those
    Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");//'en-US' these values are may be in your session and you  can use those
    base.InitializeCulture(); 
}

这篇关于如何在asp.net语言站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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