实现使用ASP.Net多语种网站 [英] Implementing Multilingual web site using ASP.Net
问题描述
我实现使用ASP.Net的多语种网站。这些语言是英语,法语和阿拉伯语。请注意,阿拉伯语的方向为RTL。什么是实现多语言支持的最佳途径。我计划使用.NET本地化功能,但该网站的文本存储在数据库中。对于控件(窗体控件),我可以使用的RESX文件。我是否需要建立两个不同的页面(一个用于LTR,另一个用于RTL)?或者,我可以有一个aspx文件的所有三种语言?
I am implementing an multilingual web site using ASP.Net. The languages are English,French and Arabic. Please note that Arabic's direction is RTL. What is the best way to implement the multilingual support. I am planning to use the .Net localization feature but the website texts are stored in DB. For the controls ( form controls) , I can used resx file. Do I need to build two different pages ( one for LTR and another for RTL )? Or can I have one ASPx file for all the three languages?
我想听听在执行这些类型的Web应用程序的最佳实践。
I would like to hear some best practices in implementing these kind of web applications.
在前进,结果谢谢
阿卜杜勒Olakara
Thanks in advance,
Abdel Olakara
推荐答案
一个无语言障碍的问题:
只是让将从页面类继承的BasePage类,把这种方法BasePage类和继承BasePage类在你的每一个aspx.cs页面来acheive全球化。
First Issue of Multilingual: Simply make a basepage class that will inherited from Page class, put this method in basepage class and inherit basepage class in your every aspx.cs page to acheive globalization.
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();
}
RTL和LTR的第二个问题:
在你的母版有像主分区。
Second Issue of RTL and LTR: in your masterpage there is main div like..
<div runat="Server" id="divPageDirection">
</div>
你需要改变方向,把这个在你的页面加载
you need to changed the direction and put this in your page load
divPageDirection.Attributes.Add("dir", "rtl");//rtl or ltr you will decide on which language is in your current session
请让我知道如果你的任何问题...
please let me know if you any issue...
这篇关于实现使用ASP.Net多语种网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!