[英]How to get words “Month”, “Day” and “Year” in different languages from .net?
I have three dropdown lists for date of birth in my multilingual application. 在我的多语言应用程序中,我有三个下拉列表,用于列出出生日期。 I am able to get the month names in different languages and put them into dropdown list. 我可以使用不同的语言获取月份名称,并将其放入下拉列表中。
However I would like to add actual words "Month", "Day" and "Year" as a first item in the dropdowns. 但是我想在下拉列表中添加实际的单词“Month”,“Day”和“Year”作为第一项。 Of course, I could easily add string "Month" as first item, but I need this to be multilingual. 当然,我可以轻松添加字符串“Month”作为第一项,但我需要这是多语言。 I am trying to avoid long case statements and tons of strings (application supports 24 languages). 我试图避免使用大写的语句和大量的字符串(应用程序支持24种语言)。
Is there a way to do this in .net? .net中有没有办法做到这一点? I am not asking for how to output months names, but how to output actual words "Month", "Day", and "Year" in different languages. 我不是在问如何输出月份名称,而是在如何输出不同语言的实际单词“ Month”,“ Day”和“ Year”。
Thanks in advance. 提前致谢。
You should use Resource Strings to localize, you can translate any text to any language in this way. 您应该使用资源字符串进行本地化,您可以通过这种方式将任何文本翻译成任何语言。 It will always be a lot of work with 24 languages. 使用24种语言将一直是很多工作。
The same way as you would do it for any other word: localize your application. 与您对其他任何单词所做的操作相同:对应用程序进行本地化。 A good default approach to doing this (much better than case statements) is using resources . 一个很好的默认方法(比case语句要好得多)是使用resources 。 Obviously, you will not be able to avoid the tons of strings as there is no localization fairy. 显然,由于没有本地化的仙女,你将无法避免大量的弦乐。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.