Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CultureInfoEntry.cs « locale-builder « tools - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cf36ae8c2406e38d011786af017e7d4ff4ac88ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
// Mono.Tools.LocaleBuilder.CultureInfoEntry
//
// Author(s):
//  Jackson Harper (jackson@ximian.com)
//
// (C) 2004 Novell, Inc (http://www.novell.com)
//


using System;
using System.Text;

namespace Mono.Tools.LocaleBuilder {

        public class CultureInfoEntry : Entry {

                public string Language;
                public string Territory;
                public string EnglishName;
                public string DisplayName;
                public string NativeName;
                public string IcuName;
                public string Win3Lang;
                public string ISO2Lang;
                public string ISO3Lang;
                public string Lcid;
                public string ParentLcid;
                public string SpecificLcid;
                public DateTimeFormatEntry DateTimeFormatEntry;
                public NumberFormatEntry NumberFormatEntry;
                public int [] CalendarData = new int [5];
                public int DateTimeIndex;
                public int NumberIndex;
                
                
                public int Row;

                public CultureInfoEntry ()
                {
                        DateTimeFormatEntry = new DateTimeFormatEntry ();
                        NumberFormatEntry = new NumberFormatEntry ();
                }

                public string Name {
                        get {
                                if (Territory == null)
                                        return Language;
                                return Language + "-" + Territory;
                        }
                }

                public override string ToString ()
                {
                        StringBuilder builder = new StringBuilder ();
                        AppendTableRow (builder);
                        return builder.ToString ();
                }

                public void AppendTableRow (StringBuilder builder)
                {
                        builder.Append ("\t{");
                        builder.AppendFormat ("{0}, {1}, {2}, " +
                                        "{3}, {4}, {5}, " +
                                        "{6}, {7}, {8}, " +
                                        "{9}, {10}, " +
                                        "{11}, " +
                                        "{12}, {13}",
                                        Lcid, ParentLcid, SpecificLcid,
                                        EncodeStringIdx (Name), EncodeStringIdx (IcuName), EncodeStringIdx (EnglishName),
                                        EncodeStringIdx (DisplayName), EncodeStringIdx (NativeName), EncodeStringIdx (Win3Lang),
                                        EncodeStringIdx (ISO3Lang), EncodeStringIdx (ISO2Lang),
                                        ValuesString (CalendarData),
                                        DateTimeFormatEntry == null ? -1 : DateTimeFormatEntry.Row,
                                        NumberFormatEntry == null ? -1 : NumberFormatEntry.Row);
                        builder.Append ('}');
                }

                private string ValuesString (int [] values)
                {
                        StringBuilder builder = new StringBuilder ();
                        builder.Append ('{');
                        for (int i=0; i<values.Length; i++) {
                                builder.Append (values [i].ToString ());
                                if (i+1 < values.Length)
                                        builder.Append (", ");
                        }
                        builder.Append ("}");
                        return builder.ToString ();
                }
        }
        
}