This repository has been archived by the owner on Jul 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGetListItemText_tr_TR.cs
237 lines (219 loc) · 8.97 KB
/
GetListItemText_tr_TR.cs
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/***************************************************************************
Copyright (c) Microsoft Corporation 2012-2013.
This code is licensed using the Microsoft Public License (Ms-PL). The text of the license can be found here:
http://www.microsoft.com/resources/sharedsource/licensingbasics/publiclicense.mspx
Published at http://OpenXmlDeveloper.org
Resource Center and Documentation: http://openxmldeveloper.org/wiki/w/wiki/powertools-for-open-xml.aspx
Developer: Ayberk CAL
Coordinator: Eric White
Blog: http://www.ericwhite.com
Twitter: @EricWhiteDev
Email: [email protected]
Version: 2.6.03
* Initial implementation of Turkish
***************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenXmlPowerTools
{
public class ListItemTextGetter_tr_TR
{
private static string[] RomanOnes =
{
"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"
};
private static string[] RomanTens =
{
"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"
};
private static string[] RomanHundreds =
{
"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "M"
};
private static string[] RomanThousands =
{
"", "M", "MM", "MMM", "MMMM", "MMMMM", "MMMMMM", "MMMMMMM", "MMMMMMMM",
"MMMMMMMMM", "MMMMMMMMMM"
};
private static string[] OneThroughNineteen = {
"bir", "iki", "üç", "dört", "beş", "altı", "yedi", "sekiz",
"dokuz", "on", "onbir", "oniki", "onüç", "ondört",
"onbeş", "onaltı", "onyedi", "onsekiz", "ondokuz"
};
private static string[] Tens = {
"on", "yirmi", "otuz", "kırk", "elli", "altmış", "yetmiş",
"seksen", "doksan"
};
private static string[] OrdinalOneThroughNineteen = {
"birinci", "ikinci", "üçüncü", "dördüncü", "beşinci", "altıncı",
"yedinci", "sekizinci", "dokuzuncu", "onuncu", "onbirinci", "onikinci",
"onüçüncü", "ondördüncü", "onbeşinci", "onaltıncı",
"onyedinci", "onsekizinci", "ondokuzuncu"
};
private static string[] TwoThroughNineteen = {
"", "iki", "üç", "dört", "beş", "altı", "yedi", "sekiz",
"dokuz", "on", "onbir", "oniki", "onüç", "ondört",
"onbeş", "onaltı", "onyedi", "onsekiz", "ondokuz"
};
private static string[] OrdinalTenths = {
"onuncu", "yirminci", "otuzuncu", "kırkıncı", "ellinci",
"altmışıncı", "yetmişinci", "sekseninci", "doksanıncı"
};
public static string GetListItemText(string languageCultureName, int levelNumber, string numFmt)
{
#region
if (numFmt == "decimal")
{
return levelNumber.ToString();
}
if (numFmt == "decimalZero")
{
if (levelNumber <= 9)
return "0" + levelNumber.ToString();
else
return levelNumber.ToString();
}
if (numFmt == "upperRoman")
{
int ones = levelNumber % 10;
int tens = (levelNumber % 100) / 10;
int hundreds = (levelNumber % 1000) / 100;
int thousands = levelNumber / 1000;
return RomanThousands[thousands] + RomanHundreds[hundreds] +
RomanTens[tens] + RomanOnes[ones];
}
if (numFmt == "lowerRoman")
{
int ones = levelNumber % 10;
int tens = (levelNumber % 100) / 10;
int hundreds = (levelNumber % 1000) / 100;
int thousands = levelNumber / 1000;
return (RomanThousands[thousands] + RomanHundreds[hundreds] +
RomanTens[tens] + RomanOnes[ones]).ToLower();
}
if (numFmt == "upperLetter")
{
string a = "ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ";
//string a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int c = (levelNumber - 1) / 29;
int n = (levelNumber - 1) % 29;
char x = a[n];
return "".PadRight(c + 1, x);
}
if (numFmt == "lowerLetter")
{
string a = "abcçdefgğhıijklmnoöprsştuüvyz";
int c = (levelNumber - 1) / 29;
int n = (levelNumber - 1) % 29;
char x = a[n];
return "".PadRight(c + 1, x);
}
if (numFmt == "ordinal")
{
string suffix;
/*if (levelNumber % 100 == 11 || levelNumber % 100 == 12 ||
levelNumber % 100 == 13)
suffix = "th";
else if (levelNumber % 10 == 1)
suffix = "st";
else if (levelNumber % 10 == 2)
suffix = "nd";
else if (levelNumber % 10 == 3)
suffix = "rd";
else
suffix = "th";*/
suffix = ".";
return levelNumber.ToString() + suffix;
}
if (numFmt == "cardinalText")
{
string result = "";
int t1 = levelNumber / 1000;
int t2 = levelNumber % 1000;
if (t1 >= 1)
result += OneThroughNineteen[t1 - 1] + " yüz";
if (t1 >= 1 && t2 == 0)
return result.Substring(0, 1).ToUpper() +
result.Substring(1);
if (t1 >= 1)
result += " ";
int h1 = (levelNumber % 1000) / 100;
int h2 = levelNumber % 100;
if (h1 >= 1)
result += OneThroughNineteen[h1 - 1] + " bin";
if (h1 >= 1 && h2 == 0)
return result.Substring(0, 1).ToUpper() +
result.Substring(1);
if (h1 >= 1)
result += " ";
int z = levelNumber % 100;
if (z <= 19)
result += OneThroughNineteen[z - 1];
else
{
int x = z / 10;
int r = z % 10;
result += Tens[x - 1];
if (r >= 1)
result += /*"-" + */OneThroughNineteen[r - 1];
}
return result.Substring(0, 1).ToUpper() +
result.Substring(1);
}
#endregion
if (numFmt == "ordinalText")
{
string result = "";
int t1 = levelNumber / 1000;
int t2 = levelNumber % 1000;
if (t1 >= 1 && t2 != 0)
result += TwoThroughNineteen[t1 - 1] + "bin";
if (t1 >= 1 && t2 == 0)
{
result += TwoThroughNineteen[t1 - 1] + "bininci";
return result.Substring(0, 1).ToUpper() +
result.Substring(1);
}
//if (t1 >= 1)
// result += " ";
int h1 = (levelNumber % 1000) / 100;
int h2 = levelNumber % 100;
if (h1 >= 1 && h2 != 0)
result += TwoThroughNineteen[h1 - 1] + "yüz";
if (h1 >= 1 && h2 == 0)
{
result += TwoThroughNineteen[h1 - 1] + "yüzüncü";
return result.Substring(0, 1).ToUpper() +
result.Substring(1);
}
//if (h1 >= 1)
// result += " ";
int z = levelNumber % 100;
if (z <= 19)
result += OrdinalOneThroughNineteen[z - 1];
else
{
int x = z / 10;
int r = z % 10;
if (r == 0)
result += OrdinalTenths[x - 1];
else
result += Tens[x - 1];
if (r >= 1)
result += OrdinalOneThroughNineteen[r - 1]; //result += "-" + OrdinalOneThroughNineteen[r - 1];
}
return result.Substring(0, 1).ToUpper() +
result.Substring(1);
}
if (numFmt == "0001, 0002, 0003, ...")
{
return string.Format("{0:0000}", levelNumber);
}
if (numFmt == "bullet")
return "";
return levelNumber.ToString();
}
}
}