使网站多语言的最佳方法 [英] Best way to make website for multiple languages

查看:147
本文介绍了使网站多语言的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用由网站( Asp.net,C#)及其在英语内容。
现在我有一个要求,使这个网站以这样的方式,是支持多国语言,即(德语,法语)。
拉布勒/文本框/字符串的所有值将发挥各自选择的​​语言
虽然寻找我才知道有喜欢

I have made a website using(Asp.net, c#) and its content in English. Now i have a requirement to make this website in such a way that is support multiple languages ie (German,French). Lable/Textbox/ string all values will display respective selected languages While searching i came to know there are some ways like


  • 使用本地化

  • 使用的资源文件。

  • 数据库(每一件事被保存在数据库中不同的语言)。

老实说我不跟第三个选项同意。

frankly speaking I am not agree with 3rd option.

我想知道这是最好的方式还是有其他更好的办法?

I want to know which is the best way to go or is there any other better way?

请注意:当前网站使用的 .NET框架4.0 / VS 2010 建。

Note:Current Website was built using .NET framework 4.0/ vs 2010.

感谢

推荐答案

样品code我一直在使用资源文件进行添加的Global.asax

Sample code i have done using resource file add global.asax

 void Application_BeginRequest(Object sender, EventArgs e)
        {
            // Code that runs on application startup
            HttpCookie cookie = HttpContext.Current.Request.Cookies["CultureInfo"];
            if (cookie != null && cookie.Value != null)
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(cookie.Value);
                System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(cookie.Value);
            }
            else
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");
                System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en");
            }
        }

博客文章:如何创建多语言网站的Asp.net C#

Blog Article : How to create multilanguage website in Asp.net C#

这篇关于使网站多语言的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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