[runtime] Use sleep (1) instead of sleep (0) in the native SIGSEGV suspend loop to...
[mono-project.git] / tools / locale-builder / CultureInfoEntry.cs
blobf03d93a8366fb4dbc91f2a7d5eab6877cbe99c72
1 //
2 // Mono.Tools.LocaleBuilder.CultureInfoEntry
3 //
4 // Author(s):
5 // Jackson Harper (jackson@ximian.com)
6 //
7 // (C) 2004 Novell, Inc (http://www.novell.com)
8 //
11 using System;
12 using System.Text;
13 using System.Collections.Generic;
14 using System.Globalization;
16 namespace Mono.Tools.LocaleBuilder
18 public class CultureInfoEntry : Entry
20 string language;
22 public string Script;
23 public string Territory;
25 public string EnglishName;
26 public string DisplayName;
27 public string NativeName;
28 public string ThreeLetterWindowsLanguageName;
29 public string TwoLetterISOLanguageName;
30 public string ThreeLetterISOLanguageName;
31 public string LCID;
32 public string ParentLcid;
33 public string SpecificLcid;
34 public RegionInfoEntry RegionInfoEntry;
35 public DateTimeFormatEntry DateTimeFormatEntry;
36 public NumberFormatEntry NumberFormatEntry;
37 public TextInfoEntry TextInfoEntry;
38 public int DateTimeIndex;
39 public int NumberIndex;
40 public string NativeCurrencyName;
41 public string NativeTerritoryName;
42 public string[] NativeCalendarNames = new string[Constants.NUM_CALENDARS];
44 public CalendarType CalendarType;
45 public GregorianCalendarTypes GregorianCalendarType;
47 public List<CultureInfoEntry> Children = new List<CultureInfoEntry> ();
49 public int Row;
51 public CultureInfoEntry ()
53 DateTimeFormatEntry = new DateTimeFormatEntry ();
54 NumberFormatEntry = new NumberFormatEntry ();
57 public string Language {
58 get {
59 return language;
61 set {
62 language = value;
66 public bool HasMissingLocale { get; set; }
68 public bool IsNeutral {
69 get {
70 return Territory == null;
74 public string OriginalName { get; set; }
76 public CultureInfoEntry Parent { get; set; }
78 public string Name {
79 get {
80 string s = language;
81 if (Script != null)
82 s = s + "-" + Script;
83 if (Territory != null)
84 s = s + "-" + Territory;
86 return s;
90 public string GetExportName ()
92 return OriginalName.Replace ('_', '-');
95 public override string ToString ()
97 StringBuilder builder = new StringBuilder ();
98 AppendTableRow (builder);
99 return builder.ToString ();
102 public void AppendTableRow (StringBuilder builder)
104 builder.Append ("\t{");
105 builder.Append (LCID).Append (", ");
106 builder.Append (ParentLcid).Append (", ");
108 int calendar_type = (int) CalendarType;
109 calendar_type <<= 8;
110 if (CalendarType == CalendarType.Gregorian)
111 calendar_type |= (int) GregorianCalendarType;
113 builder.Append (calendar_type).Append (", ");
114 builder.Append (RegionInfoEntry == null ? -1 : RegionInfoEntry.Index).Append (", ");
115 builder.Append (EncodeStringIdx (GetExportName ())).Append (", ");
116 builder.Append (EncodeStringIdx (EnglishName)).Append (", ");
117 builder.Append (EncodeStringIdx (NativeName)).Append (", ");
118 builder.Append (EncodeStringIdx (ThreeLetterWindowsLanguageName)).Append (", ");
119 builder.Append (EncodeStringIdx (ThreeLetterISOLanguageName)).Append (", ");
120 builder.Append (EncodeStringIdx (TwoLetterISOLanguageName)).Append (", ");
121 builder.Append (EncodeStringIdx (Territory)).Append (", ");
122 AppendNames (builder, NativeCalendarNames).Append (", ");
123 builder.Append (DateTimeFormatEntry.Row).Append (", ");
124 builder.Append (NumberFormatEntry.Row).Append (", ");
125 builder.Append (TextInfoEntry.ToString ());
126 builder.Append ('}');
129 private string ValuesString (int[] values)
131 StringBuilder builder = new StringBuilder ();
132 builder.Append ('{');
133 for (int i = 0; i < values.Length; i++) {
134 builder.Append (values[i].ToString ());
135 if (i + 1 < values.Length)
136 builder.Append (", ");
138 builder.Append ("}");
139 return builder.ToString ();