【发布时间】:2010-01-18 06:02:19
【问题描述】:
在英语英国和瑞典语的 asp.net 多语言网站中,我有三个 rsources 文件
1. en-GB.resx
2. sv-SE.resx
3. Culture neutral file.
我创建了一个基类,所有页面都继承自该类。在那里我写了以下几行来设置 UICULTURE 和文化
1. Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentUICulture.Name;
2. Thread.CurrentThread.CurrentCulture = CultureInfo.CurrentCulture.Name;
问题:假设我的浏览器语言是瑞典语(sv-SE),那么这段代码会运行,因为它找到了CurrentUICulture and CurrentCulture values as sv-SE.
现在如果假设浏览器语言仅为瑞典语(sv),在这种情况下,值将设置为
CurrentUICulture = sv; and CurrentCulture = sv-SE
现在的问题是用户可以查看我保存为英文的文化中性资源文件中的所有文本,而所有小数点、货币和其他都将以瑞典语显示。 对 usr 来说,这看起来很混乱。
什么是正确的方法。我正在考虑以下解决方案。请纠正我?
1. i can create extra resource file for sv also.
2. I check value of CurrentUICulture in base class and if it is sv then replace it with sv-SE
请纠正我哪个是正确的方法或者还有其他好的方法吗?
【问题讨论】:
标签: asp.net multilingual