Today i need some weekdays output functions in my app and i met some issue.
I am in Russia, so i use RU locale, and my app is for RU
The method locale->getWeekDayNames() returns an array, that starts from Sunday. I googled that many countries have Sunday as their first day of week, but in some countries, Monday - the first. So this seems to be an issue of internationalization ? am i right ?
It seems for me to be correct to change the order of elements in array ‘weekDayNames’ in file i18n\data\ru.php
Yii developers, and others, please comment this topic
Yii uses the i18n data provided by http://cldr.unicode.org/index and I guess the week starts at sunday for all of the provided countries, which is indeed incorrect for some/most countries like you already noted.
But the data has to be formatted like this. Example: You get first day of week for russia that would be 0 => monday and save it in db. Than you want to display that day in another language that has sunday at start of week -> your saved day would change to sunday instead of monday. I hope you get the point.
Maybe the i18n data should contain something like “firstDayOfWeek” and then getWeekDayNames() should make use of it. Don’t know, but I also think this is a problem.
// Also it would be cool if the Yii i18 data would contain a list of all coutry codes with the related country names like provided by unicode.
I’m talking for my idea, I really don’t know why qiang do it like this but:
If you use the locale->getWeekDayNames() and use it with PHP function (where weeks start on 0=>Sunday) the PHP function will return you an index that is not correct with your local week day name…