如何使Windows应用程序与不同的文化兼容
问题描述:
我做了一个Windows应用程序。因为我正在使用一些convert.toint,convert.todouble,convert.tostring()和一些timepan和datetime。它正在使用英语,但不支持德语。是否有任何API或功能使用我可以检查它是英语还是德语并根据操作系统输入条件。以及如何将所有这些转换从英语转换为德语。
谢谢
Hi,
i made an windows application. in that i am using some convert.toint,convert.todouble,convert.tostring() and some timespan and datetime. it is working with english language but not supporting in german. is there any api or function by using that i can check whether it is english or german and put condition according to os. and how to convert all these conversion from english to german.
Thanks
答
至于我知道德国日期格式是:dd.mm.yy
,英语是:mm / dd / yyyy
。要将其转换为正确的日期,您需要设置/更改本地化 [ ^ ]。
如需了解更多信息,请参阅:
全球化和本地化.NET Framework应用程序 [ ^ ]
比较和排序特定文化的数据 [ ^ ]
如何:为ASP.NET Web Page Glo设置文化和UI文化balization [ ^ ] b $ b
我发现非常有趣的网站:全球化循序渐进 [ ^ ]。在那里你可以找到有关日期格式和转换的信息;)
[/ EDIT]
As far as i know german format of date is:dd.mm.yy
and english is:mm/dd/yyyy
. To convert it to a proper date, you need to set/change localization[^].
For further information, please see:
Globalizing and Localizing .NET Framework Applications[^]
Comparing and Sorting Data for a Specific Culture[^]
How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization[^]
I found very interesrting site: Globalization Step-by-Step[^]. There you'll find information about date formatting and converting ;)
[/EDIT]
使用相应数据类型的Parse函数,例如: double.Parse或double.TryParse而不是Convert。
Use the Parse functions of the corresponding datatypes, e.g. double.Parse or double.TryParse instead of Convert.