本地化DatePicker和TimePicker [英] Localization DatePicker and TimePicker

查看:82
本文介绍了本地化DatePicker和TimePicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


如何本地化DatePicker和TimePicker?



我们的用例是用户将在控制面板中设置语言,我们将尝试显示正确的datepicker / timepicker格式。



我尝试设置DatePicker / TimePicker语言属性,但它仍然是设置为英语,订单仍然是英文格式(月份日期年份)的日期选择器和(小时分钟上午/下午)时间戳。



我尝试了DatePicker.CalendarIdentifier,它确实改变了datepicker的日期格式。所以对于日语来说,它是正确设置的,但是时间选择器只有一个clockidentifier,所以它没有改变显示(AM / PM仍然是英文)。



这是否意味着我必须手动识别语言并设置calendaridentifer / clockidentifier?


提前致谢!





更新:


我确实发现了GlobalizationPreference和我可以将它设置为Date和TimePicker:


var calendar = Windows.System.UserProfile.GlobalizationPreferences.Calendars [0];

var clock = Windows。 System.UserProfile.GlobalizationPreferences.Clocks [0];


如果我将区域设置设置为日语,则时钟正确设置为24HourClock。但是日历仍然设置为GregorianCalendar。


这是一个错误还是有不同的方法设置日历,以便我可以正确检索GlobalizationPreferences.Calendar?





解决方案

同一个问题:

http://stackoverflow.com/questions/ 28981093 /本地化-日期选择器 - 和 - timepicker式 - 窗口室温

How do you localize the DatePicker and the TimePicker?

Our use case is that the user will set the language in the control panel and we will try to display the correct datepicker/timepicker format.

I tried setting the DatePicker/TimePicker Language property but it still is set to English and the order is still in english format (Month date year) for Date Picker and (Hour minutes AM/PM) for timepicker.

I did try the DatePicker.CalendarIdentifier and it did change the date format of the datepicker. So for a Japanese language, it was correctly set, but the timepicker only has a clockidentifier, so it did not change the display (AM/PM is still in english).

Does it mean that I have to identify the language and set the calendaridentifer/clockidentifier manually?

Thanks in advance!

UPDATE:

I did found out about the GlobalizationPreference and I could set it to the Date and TimePicker:

var calendar = Windows.System.UserProfile.GlobalizationPreferences.Calendars[0];
var clock = Windows.System.UserProfile.GlobalizationPreferences.Clocks[0];

If I set the region settings to Japanese, the clock is correctly set to 24HourClock. But the calendar is still set to GregorianCalendar.

Is this a bug or there is a different way to set the calendar so that I could retrieve correctly the GlobalizationPreferences.Calendar?


解决方案

A same question:
http://stackoverflow.com/questions/28981093/localize-datepicker-and-timepicker-in-windows-rt


这篇关于本地化DatePicker和TimePicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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