简体   繁体   English

如何从.net获取不同语言的单词“月”,“日”和“年”?

[英]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.

相关问题 如何在asp.net的文本框中的下拉列表中输入日,月和年 - how to enter day , month & year in dropdownlist from textbox in asp.net 我无法从我的ASP.NET MVC3 ViewModel获取我的月,日,年下拉列表 - I can't get my Month, Day, Year dropdown lists to work from my ASP.NET MVC3 ViewModel 如何将日期纠察日期格式更改为与数据库日期格式一致(从月/日/年更改为日/月/年) - how to change the date picket date format to be consistent with the database date format (from month/day/year to be day/Month/year) 拆分字符串(生日)以获取日,月,年 - Split string (birthday) to get day, month, year 从asp.net中的textBox获取月份和年份 - Get Month and Year from textBox in asp.net 如何从数据表“日期”列中筛选月份和年份,并在ASP.Net中获取匹配的筛选器行 - How to filter month and year from datatable “Date” column and get matching filter rows in ASP.Net 如何从以文本模式属性作为月份的文本框中获取sql中的月份和年份值? ASP.NET C# - how to get only month and year value in sql from textbox with textmode property as month? asp.net c# 在 ASP.NET MVC 中存储来自 3 DropDownListFor(日、月、年)的 DateTime - Store DateTime from 3 DropDownListFor (day, month, year) in ASP.NET MVC 如何获得当前的月份和年份 - how to get current month and year ASP.NET vb.net将月/日/年中的日历日期格式转换为具有日/月/年的日期对象 - ASP.NET vb.net convert calendar date format in Month/Day/Year to Date object with Day/Month/Year
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM