Bug 567944

Summary: FirstDayOfWeek not parsed when creating culture-info-tables.h
Product: [Mono] Mono: Runtime Reporter: José Antonio Sánchez Lázaro <jasl>
Component: debugAssignee: Martin Baulig <martin>
Status: RESOLVED FIXED QA Contact: Mono Bugs <mono-bugs>
Severity: Normal    
Priority: P5 - None CC: atsushieno, forgotten_vxPDddArjq
Version: SVN   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description José Antonio Sánchez Lázaro 2010-01-04 08:56:07 UTC
Description of Problem:

FirstDayOfWeek is always Sunday for all cultures. 

Steps to reproduce the problem:
1. Just check FirstDateOfWeek from DateTimeFormat in any culture.
2. 


Actual Results:

Always Sunday

Expected Results:

Sunday, Monday, Saturday...

How often does this happen? 

Always

Additional Information:

This is a problem when parsing lang information in locale-builder.exe tool. The data seems to be available, but not parsed.

Here is the portion of code for Driver.cs of locale-builder to solve the problem. I only checked for Sunday, Monday and Saturday, as it seems no current culture starts in other day.

      private void LookupDateTimeInfo (XPathNavigator nav, CultureInfoEntry ci)
      ....

                ni2 = (XPathNodeIterator) ni.Current.Evaluate ("week/firstDay");
                                if (ni2.MoveNext ()) {
                                        XPathNavigator weekday_nav = ni2.Current;
                                        switch (weekday_nav.GetAttribute ("day", String.Empty)) {
                                        case "sun":
                                                df.FirstDayOfWeek = 0;
                                                Console.WriteLine(ci.Name+" Week starts on Sunday");
                                                break;
                                        case "mon":
                                                df.FirstDayOfWeek = 1;
                                                Console.WriteLine(ci.Name+" Week starts on Monday");
                                                break;
                                         case "sat":
                                                df.FirstDayOfWeek = 6;
                                                Console.WriteLine(ci.Name+" Week starts on Saturday");
                                                break;
                                        default:
                                                Console.WriteLine ("unknown first day of week:  " +
                                                                weekday_nav.GetAttribute ("day", String.Empty));
                                                break;
                                        }

                                }
Comment 1 Forgotten User vxPDddArjq 2010-01-04 19:39:10 UTC
CC'ing eno.
Comment 2 Atsushi Enomoto 2010-01-06 05:00:39 UTC
Applied the change at r149107. Thanks.