2 // Mono.Tools.LocaleBuilder.CultureInfoEntry
5 // Jackson Harper (jackson@ximian.com)
7 // (C) 2004 Novell, Inc (http://www.novell.com)
13 using System
.Collections
.Generic
;
14 using System
.Globalization
;
16 namespace Mono
.Tools
.LocaleBuilder
18 public class CultureInfoEntry
: Entry
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
;
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
> ();
51 public CultureInfoEntry ()
53 DateTimeFormatEntry
= new DateTimeFormatEntry ();
54 NumberFormatEntry
= new NumberFormatEntry ();
57 public string Language
{
66 public bool HasMissingLocale { get; set; }
68 public bool IsNeutral
{
70 return Territory
== null;
74 public string OriginalName { get; set; }
76 public CultureInfoEntry Parent { get; set; }
83 if (Territory
!= null)
84 s
= s
+ "-" + Territory
;
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
;
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 ();