2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FLclLocale.cpp
19 * @brief This is the implementation file for Locale class.
22 #include <unique_ptr.h>
24 #include <FBaseSysLog.h>
25 #include <FLclLocale.h>
26 #include <FApp_AppInfo.h>
28 #include "FBase_StringConverter.h"
29 #include "FLcl_LocaleImpl.h"
31 using namespace Tizen::Base;
33 namespace Tizen { namespace Locales
35 static const char* LanguageCodeString3LetterArray[LANGUAGE_MAX+2] =
38 "abk", /**< Abkhazian */
39 "ace", /**< Achinese */
41 "ada", /**< Adangme */
42 "ady", /**< Adyghe; Adygei */
43 "afa", /**< Afro-Asiatic languages */
44 "afh", /**< Afrihili */
45 "afr", /**< Afrikaans */
48 "akk", /**< Akkadian */
49 "sqi", /**< Albanian */
51 "alg", /**< Algonquian languages */
52 "alt", /**< Southern Altai */
53 "amh", /**< Amharic */
54 "ang", /**< English, Old (ca.450-1100) */
56 "apa", /**< Apache languages */
58 "arc", /**< Official Aramaic (700-300 BCE); Imperial Aramaic (700-300 BCE) */
59 "arg", /**< Aragonese */
60 "hye", /**< Armenian */
61 "arn", /**< Mapudungun; Mapuche */
62 "arp", /**< Arapaho */
63 "art", /**< Artificial languages */
65 "asm", /**< Assamese */
66 "ast", /**< Asturian; Bable; Leonese; Asturleonese */
67 "ath", /**< Athapascan languages */
68 "aus", /**< Australian languages */
70 "ave", /**< Avestan */
73 "aze", /**< Azerbaijani */
74 "aze-arab", /**< Azerbaijani (Arabic) */
75 "aze-cyrl", /**< Azerbaijani (Cyrillic) */
76 "aze-latn", /**< Azerbaijani (Latin) */
77 "bad", /**< Banda languages */
78 "bai", /**< Bamileke languages */
79 "bak", /**< Bashkir */
80 "bal", /**< Baluchi */
81 "bam", /**< Bambara */
82 "ban", /**< Balinese */
85 "bat", /**< Baltic languages */
86 "bej", /**< Beja; Bedawiyet */
87 "bel", /**< Belarusian */
89 "ben", /**< Bengali */
90 "ber", /**< Berber languages */
91 "bho", /**< Bhojpuri */
94 "bin", /**< Bini; Edo */
95 "bis", /**< Bislama */
96 "bla", /**< Siksika */
97 "bnt", /**< Bantu (Other) */
98 "bos", /**< Bosnian */
100 "bre", /**< Breton */
101 "btk", /**< Batak languages */
102 "bua", /**< Buriat */
103 "bug", /**< Buginese */
104 "bul", /**< Bulgarian */
105 "mya", /**< Burmese */
106 "byn", /**< Blin; Bilin */
108 "cai", /**< Central American Indian languages */
109 "car", /**< Galibi Carib */
110 "cat", /**< Catalan; Valencian */
111 "cau", /**< Caucasian languages */
112 "ceb", /**< Cebuano */
113 "cel", /**< Celtic languages */
114 "cha", /**< Chamorro */
115 "chb", /**< Chibcha */
116 "che", /**< Chechen */
117 "chg", /**< Chagatai */
118 "zho", /**< Chinese */
119 "zho-hans", /**< Chinese (Simplified) */
120 "zho-hant", /**< Chinese (Traditional) */
121 "chk", /**< Chuukese */
123 "chn", /**< Chinook jargon */
124 "cho", /**< Choctaw */
125 "chp", /**< Chipewyan; Dene Suline */
126 "chr", /**< Cherokee */
127 "chu", /**< Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic */
128 "chv", /**< Chuvash */
129 "chy", /**< Cheyenne */
130 "cmc", /**< Chamic languages */
131 "cop", /**< Coptic */
132 "cor", /**< Cornish */
133 "cos", /**< Corsican */
134 "cpe", /**< Creoles and pidgins, English based */
135 "cpf", /**< Creoles and pidgins, French-based */
136 "cpp", /**< Creoles and pidgins, Portuguese-based */
138 "crh", /**< Crimean Tatar; Crimean Turkish */
139 "crp", /**< Creoles and pidgins */
140 "csb", /**< Kashubian */
141 "cus", /**< Cushitic languages */
143 "dak", /**< Dakota */
144 "dan", /**< Danish */
145 "dar", /**< Dargwa */
146 "day", /**< Land Dayak languages */
147 "del", /**< Delaware */
148 "den", /**< Slave (Athapascan) */
149 "dgr", /**< Dogrib */
151 "div", /**< Divehi; Dhivehi; Maldivian */
153 "dra", /**< Dravidian languages */
154 "dsb", /**< Lower Sorbian */
156 "dum", /**< Dutch, Middle (ca.1050-1350) */
157 "nld", /**< Dutch; Flemish */
159 "dzo", /**< Dzongkha */
161 "egy", /**< Egyptian (Ancient) */
162 "eka", /**< Ekajuk */
163 "elx", /**< Elamite */
164 "eng", /**< English */
165 "enm", /**< English, Middle (1100-1500) */
166 "epo", /**< Esperanto */
167 "est", /**< Estonian */
169 "ewo", /**< Ewondo */
171 "fao", /**< Faroese */
173 "fij", /**< Fijian */
174 "fil", /**< Filipino; Pilipino */
175 "fin", /**< Finnish */
176 "fiu", /**< Finno-Ugrian languages */
178 "fra", /**< French */
179 "frm", /**< French, Middle (ca.1400-1600) */
180 "fro", /**< French, Old (842-ca.1400) */
181 "frr", /**< Northern Frisian */
182 "frs", /**< Eastern Frisian */
183 "fry", /**< Western Frisian */
185 "fur", /**< Friulian */
189 "gem", /**< Germanic languages */
190 "kat", /**< Georgian */
191 "deu", /**< German */
193 "gil", /**< Gilbertese */
194 "gla", /**< Gaelic; Scottish Gaelic */
196 "glg", /**< Galician */
198 "gmh", /**< German, Middle High (ca.1050-1500) */
199 "goh", /**< German, Old High (ca.750-1050) */
201 "gor", /**< Gorontalo */
202 "got", /**< Gothic */
204 "grc", /**< Greek, Ancient (to 1453) */
205 "ell", /**< Greek, Modern (1453-) */
206 "grn", /**< Guarani */
207 "gsw", /**< Swiss German; Alemannic; Alsatian */
208 "guj", /**< Gujarati */
209 "gwi", /**< Gwich'in */
211 "hat", /**< Haitian; Haitian Creole */
213 "hau-latn", /**< Hausa (Latin) */
214 "haw", /**< Hawaiian */
215 "heb", /**< Hebrew */
216 "her", /**< Herero */
217 "hil", /**< Hiligaynon */
218 "him", /**< Himachali */
220 "hit", /**< Hittite */
222 "hmo", /**< Hiri Motu */
223 "hrv", /**< Croatian */
224 "hsb", /**< Upper Sorbian */
225 "hun", /**< Hungarian */
229 "isl", /**< Icelandic */
231 "iii", /**< Sichuan Yi; Nuosu */
232 "ijo", /**< Ijo languages */
233 "iku", /**< Inuktitut */
234 "ile", /**< Interlingue; Occidental */
236 "ina", /**< Interlingua (International Auxiliary Language Association) */
237 "inc", /**< Indic languages */
238 "ind", /**< Indonesian */
239 "ine", /**< Indo-European languages */
240 "inh", /**< Ingush */
241 "ipk", /**< Inupiaq */
242 "ira", /**< Iranian languages */
243 "iro", /**< Iroquoian languages */
244 "ita", /**< Italian */
245 "jav", /**< Javanese */
246 "jbo", /**< Lojban */
247 "jpn", /**< Japanese */
248 "jpr", /**< Judeo-Persian */
249 "jrb", /**< Judeo-Arabic */
250 "kaa", /**< Kara-Kalpak */
251 "kab", /**< Kabyle */
252 "kac", /**< Kachin; Jingpho */
253 "kal", /**< Kalaallisut; Greenlandic */
255 "kan", /**< Kannada */
256 "kar", /**< Karen languages */
257 "kas", /**< Kashmiri */
258 "kau", /**< Kanuri */
260 "kaz", /**< Kazakh */
261 "kaz-cyrl", /**< Kazakh (Cyrillic) */
262 "kbd", /**< Kabardian */
264 "khi", /**< Khoisan languages */
265 "khm", /**< Central Khmer */
266 "kho", /**< Khotanese; Sakan */
267 "kik", /**< Kikuyu; Gikuyu */
268 "kin", /**< Kinyarwanda */
269 "kir", /**< Kirghiz; Kyrgyz */
270 "kmb", /**< Kimbundu */
271 "kok", /**< Konkani */
274 "kor", /**< Korean */
275 "kos", /**< Kosraean */
276 "kpe", /**< Kpelle */
277 "krc", /**< Karachay-Balkar */
278 "krl", /**< Karelian */
279 "kro", /**< Kru languages */
280 "kru", /**< Kurukh */
281 "kua", /**< Kuanyama; Kwanyama */
283 "kur", /**< Kurdish */
284 "kut", /**< Kutenai */
285 "lad", /**< Ladino */
286 "lah", /**< Lahnda */
290 "lav", /**< Latvian */
291 "lez", /**< Lezghian */
292 "lim", /**< Limburgan; Limburger; Limburgish */
293 "lin", /**< Lingala */
294 "lit", /**< Lithuanian */
297 "ltz", /**< Luxembourgish; Letzeburgesch */
298 "lua", /**< Luba-Lulua */
299 "lub", /**< Luba-Katanga */
301 "lui", /**< Luiseno */
303 "luo", /**< Luo (Kenya and Tanzania) */
304 "lus", /**< Lushai */
305 "mkd", /**< Macedonian */
306 "mad", /**< Madurese */
307 "mag", /**< Magahi */
308 "mah", /**< Marshallese */
309 "mai", /**< Maithili */
310 "mak", /**< Makasar */
311 "mal", /**< Malayalam */
312 "man", /**< Mandingo */
314 "map", /**< Austronesian languages */
315 "mar", /**< Marathi */
318 "mdf", /**< Moksha */
319 "mdr", /**< Mandar */
321 "mga", /**< Irish, Middle (900-1200) */
322 "mic", /**< Mi'kmaq; Micmac */
323 "min", /**< Minangkabau */
324 "mis", /**< Uncoded languages */
325 "mkh", /**< Mon-Khmer languages */
326 "mlg", /**< Malagasy */
327 "mlt", /**< Maltese */
328 "mnc", /**< Manchu */
329 "mni", /**< Manipuri */
330 "mno", /**< Manobo languages */
331 "moh", /**< Mohawk */
332 "mon", /**< Mongolian */
334 "mul", /**< Multiple languages */
335 "mun", /**< Munda languages */
337 "mwl", /**< Mirandese */
338 "mwr", /**< Marwari */
339 "myn", /**< Mayan languages */
341 "nah", /**< Nahuatl languages */
342 "nai", /**< North American Indian languages */
343 "nap", /**< Neapolitan */
345 "nav", /**< Navajo; Navaho */
346 "nbl", /**< Ndebele, South; South Ndebele */
347 "nde", /**< Ndebele, North; North Ndebele */
348 "ndo", /**< Ndonga */
349 "nds", /**< Low German; Low Saxon; German, Low; Saxon, Low */
350 "nep", /**< Nepali */
351 "new", /**< Nepal Bhasa; Newari */
353 "nic", /**< Niger-Kordofanian languages */
354 "niu", /**< Niuean */
355 "nno", /**< Norwegian Nynorsk; Nynorsk, Norwegian */
356 "nob", /**< Bokmal, Norwegian; Norwegian Bokmal */
358 "non", /**< Norse, Old */
359 "nor", /**< Norwegian */
361 "nso", /**< Pedi; Sepedi; Northern Sotho */
362 "nub", /**< Nubian languages */
363 "nwc", /**< Classical Newari; Old Newari; Classical Nepal Bhasa */
364 "nya", /**< Chichewa; Chewa; Nyanja */
365 "nym", /**< Nyamwezi */
366 "nyn", /**< Nyankole */
369 "oci", /**< Occitan (post 1500); Provencal */
370 "oji", /**< Ojibwa */
374 "oss", /**< Ossetian; Ossetic */
375 "ota", /**< Turkish, Ottoman (1500-1928) */
376 "oto", /**< Otomian languages */
377 "paa", /**< Papuan languages */
378 "pag", /**< Pangasinan */
379 "pal", /**< Pahlavi */
380 "pam", /**< Pampanga; Kapampangan */
381 "pan", /**< Panjabi; Punjabi */
382 "pan-arab", /**< Panjabi; Punjabi (Arabic) */
383 "pan-guru", /**< Panjabi; Punjabi (Gurmukhi) */
384 "pap", /**< Papiamento */
385 "pau", /**< Palauan */
386 "peo", /**< Persian, Old (ca.600-400 B.C.) */
387 "fas", /**< Persian */
388 "phi", /**< Philippine languages */
389 "phn", /**< Phoenician */
391 "pol", /**< Polish */
392 "pon", /**< Pohnpeian */
393 "por", /**< Portuguese */
394 "pra", /**< Prakrit languages */
395 "pro", /**< Provencal, Old (to 1500) */
396 "pus", /**< Pushto; Pashto */
397 "qaa-qtz", /**< Reserved for local use */
398 "que", /**< Quechua */
399 "raj", /**< Rajasthani */
400 "rap", /**< Rapanui */
401 "rar", /**< Rarotongan; Cook Islands Maori */
402 "roa", /**< Romance languages */
403 "roh", /**< Romansh */
404 "rom", /**< Romany */
405 "ron", /**< Romanian; Moldavian; Moldovan */
407 "rup", /**< Aromanian; Arumanian; Macedo-Romanian */
408 "rus", /**< Russian */
409 "sad", /**< Sandawe */
412 "sai", /**< South American Indian (Other) */
413 "sal", /**< Salishan languages */
414 "sam", /**< Samaritan Aramaic */
415 "san", /**< Sanskrit */
417 "sat", /**< Santali */
418 "scn", /**< Sicilian */
420 "sel", /**< Selkup */
421 "sem", /**< Semitic languages */
422 "sga", /**< Irish, Old (to 900) */
423 "sgn", /**< Sign Languages */
425 "sid", /**< Sidamo */
426 "sin", /**< Sinhala; Sinhalese */
427 "sio", /**< Siouan languages */
428 "sit", /**< Sino-Tibetan languages */
429 "sla", /**< Slavic languages */
430 "slk", /**< Slovak */
431 "slv", /**< Slovenian */
432 "sma", /**< Southern Sami */
433 "sme", /**< Northern Sami */
434 "smi", /**< Sami languages */
435 "smj", /**< Lule Sami */
436 "smn", /**< Inari Sami */
437 "smo", /**< Samoan */
438 "sms", /**< Skolt Sami */
440 "snd", /**< Sindhi */
441 "snk", /**< Soninke */
442 "sog", /**< Sogdian */
443 "som", /**< Somali */
444 "son", /**< Songhai languages */
445 "sot", /**< Sotho, Southern */
446 "spa", /**< Spanish; Castilian */
447 "srd", /**< Sardinian */
448 "srn", /**< Sranan Tongo */
449 "srp", /**< Serbian */
450 "srp-cyrl", /**< Serbian (Cyrillic) */
451 "srp-latn", /**< Serbian (Latin) */
453 "ssa", /**< Nilo-Saharan languages */
455 "suk", /**< Sukuma */
456 "sun", /**< Sundanese */
458 "sux", /**< Sumerian */
459 "swa", /**< Swahili */
460 "swe", /**< Swedish */
461 "syc", /**< Classical Syriac */
462 "syr", /**< Syriac */
463 "tah", /**< Tahitian */
464 "tai", /**< Tai languages */
467 "tel", /**< Telugu */
469 "ter", /**< Tereno */
472 "tgl", /**< Tagalog */
474 "bod", /**< Tibetan */
476 "tir", /**< Tigrinya */
478 "tkl", /**< Tokelau */
479 "tlh", /**< Klingon; tlhIngan-Hol */
480 "tli", /**< Tlingit */
481 "tmh", /**< Tamashek */
482 "tog", /**< Tonga (Nyasa) */
483 "ton", /**< Tonga (Tonga Islands) */
484 "tpi", /**< Tok Pisin */
485 "tsi", /**< Tsimshian */
486 "tsn", /**< Tswana */
487 "tso", /**< Tsonga */
488 "tuk", /**< Turkmen */
489 "tuk-cyrl", /**< Turkmen (Cyrillic) */
490 "tuk-latn", /**< Turkmen (Latin) */
491 "tum", /**< Tumbuka */
492 "tup", /**< Tupi languages */
493 "tur", /**< Turkish */
494 "tut", /**< Altaic languages */
495 "tvl", /**< Tuvalu */
497 "tyv", /**< Tuvinian */
498 "udm", /**< Udmurt */
499 "uga", /**< Ugaritic */
500 "uig", /**< Uighur; Uyghur */
501 "ukr", /**< Ukrainian */
502 "umb", /**< Umbundu */
503 "und", /**< Undetermined */
506 "uzb-arab", /**< Uzbek (Arabic) */
507 "uzb-cyrl", /**< Uzbek (Cyrillic) */
508 "uzb-latn", /**< Uzbek (Latin) */
511 "vie", /**< Vietnamese */
512 "vls", /**< Vlaams; Flemish */
513 "vol", /**< Volapuk */
515 "wak", /**< Wakashan languages */
516 "wal", /**< Walamo */
520 "wen", /**< Sorbian languages */
521 "wln", /**< Walloon */
523 "xal", /**< Kalmyk; Oirat */
526 "yap", /**< Yapese */
527 "yid", /**< Yiddish */
528 "yor", /**< Yoruba */
529 "ypk", /**< Yupik languages */
530 "zap", /**< Zapotec */
531 "zbl", /**< Blissymbols; Blissymbolics; Bliss */
532 "zen", /**< Zenaga */
533 "zha", /**< Zhuang; Chuang */
534 "znd", /**< Zande languages */
537 "zxx", /**< No linguistic content; Not applicable */
538 "zza", /**< Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki */
542 static const char* CountryCodeString2LetterArray[COUNTRY_MAX] =
544 "AF", /**< AFGHANISTAN */
545 "AX", /**< ALAND ISLANDS */
546 "AL", /**< ALBANIA */
547 "DZ", /**< ALGERIA */
548 "AS", /**< AMERICAN SAMOA */
549 "AD", /**< ANDORRA */
551 "AI", /**< ANGUILLA */
552 "AQ", /**< ANTARCTICA */
553 "AG", /**< ANTIGUA AND BARBUDA */
554 "AR", /**< ARGENTINA */
555 "AM", /**< ARMENIA */
557 "AU", /**< AUSTRALIA */
558 "AT", /**< AUSTRIA */
559 "AZ", /**< AZERBAIJAN */
560 "BS", /**< BAHAMAS */
561 "BH", /**< BAHRAIN */
562 "BD", /**< BANGLADESH */
563 "BB", /**< BARBADOS */
564 "BY", /**< BELARUS */
565 "BE", /**< BELGIUM */
568 "BM", /**< BERMUDA */
570 "BO", /**< BOLIVIA */
571 "BA", /**< BOSNIA AND HERZEGOVINA */
572 "BW", /**< BOTSWANA */
573 "BV", /**< BOUVET ISLAND */
575 "IO", /**< BRITISH INDIAN OCEAN TERRITORY */
576 "BN", /**< BRUNEI DARUSSALAM */
577 "BG", /**< BULGARIA */
578 "BF", /**< BURKINA FASO */
579 "BI", /**< BURUNDI */
580 "KH", /**< CAMBODIA */
581 "CM", /**< CAMEROON */
583 "CV", /**< CAPE VERDE */
584 "KY", /**< CAYMAN ISLANDS */
585 "CF", /**< CENTRAL AFRICAN REPUBLIC */
589 "CX", /**< CHRISTMAS ISLAND */
590 "CC", /**< COCOS (KEELING) ISLANDS */
591 "CO", /**< COLOMBIA */
592 "KM", /**< COMOROS */
594 "CD", /**< CONGO, THE DEMOCRATIC REPUBLIC OF THE */
595 "CK", /**< COOK ISLANDS */
596 "CR", /**< COSTA RICA */
597 "CI", /**< COTE D'IVOIRE */
598 "HR", /**< CROATIA */
601 "CZ", /**< CZECH REPUBLIC */
602 "DK", /**< DENMARK */
603 "DJ", /**< DJIBOUTI */
604 "DM", /**< DOMINICA */
605 "DO", /**< DOMINICAN REPUBLIC */
606 "EC", /**< ECUADOR */
608 "SV", /**< EL SALVADOR */
609 "GQ", /**< EQUATORIAL GUINEA */
610 "ER", /**< ERITREA */
611 "EE", /**< ESTONIA */
612 "ET", /**< ETHIOPIA */
613 "FK", /**< FALKLAND ISLANDS (MALVINAS) */
614 "FO", /**< FAROE ISLANDS */
616 "FI", /**< FINLAND */
618 "GF", /**< FRENCH GUIANA */
619 "PF", /**< FRENCH POLYNESIA */
620 "TF", /**< FRENCH SOUTHERN TERRITORIES */
623 "GE", /**< GEORGIA */
624 "DE", /**< GERMANY */
626 "GI", /**< GIBRALTAR */
628 "GL", /**< GREENLAND */
629 "GD", /**< GRENADA */
630 "GP", /**< GUADELOUPE */
632 "GT", /**< GUATEMALA */
634 "GW", /**< GUINEA-BISSAU */
637 "HM", /**< HEARD ISLAND AND MCDONALD ISLANDS */
638 "VA", /**< HOLY SEE (VATICAN CITY STATE) */
639 "HN", /**< HONDURAS */
640 "HK", /**< HONG KONG */
641 "HU", /**< HUNGARY */
642 "IS", /**< ICELAND */
644 "ID", /**< INDONESIA */
645 "IR", /**< IRAN, ISLAMIC REPUBLIC OF */
647 "IE", /**< IRELAND */
650 "JM", /**< JAMAICA */
653 "KZ", /**< KAZAKHSTAN */
655 "KI", /**< KIRIBATI */
656 "KP", /**< KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF */
657 "KR", /**< KOREA, REPUBLIC OF */
659 "KG", /**< KYRGYZSTAN */
660 "LA", /**< LAO PEOPLE'S DEMOCRATIC REPUBLIC */
662 "LB", /**< LEBANON */
663 "LS", /**< LESOTHO */
664 "LR", /**< LIBERIA */
665 "LY", /**< LIBYAN ARAB JAMAHIRIYA */
666 "LI", /**< LIECHTENSTEIN */
667 "LT", /**< LITHUANIA */
668 "LU", /**< LUXEMBOURG */
670 "MK", /**< MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF */
671 "MG", /**< MADAGASCAR */
673 "MY", /**< MALAYSIA */
674 "MV", /**< MALDIVES */
677 "MH", /**< MARSHALL ISLANDS */
678 "MQ", /**< MARTINIQUE */
679 "MR", /**< MAURITANIA */
680 "MU", /**< MAURITIUS */
681 "YT", /**< MAYOTTE */
683 "FM", /**< MICRONESIA, FEDERATED STATES OF */
684 "MD", /**< MOLDOVA, REPUBLIC OF */
686 "MN", /**< MONGOLIA */
687 "MS", /**< MONTSERRAT */
688 "MA", /**< MOROCCO */
689 "MZ", /**< MOZAMBIQUE */
690 "MM", /**< MYANMAR */
691 "NA", /**< NAMIBIA */
694 "NL", /**< NETHERLANDS */
695 "AN", /**< NETHERLANDS ANTILLES */
696 "NC", /**< NEW CALEDONIA */
697 "NZ", /**< NEW ZEALAND */
698 "NI", /**< NICARAGUA */
700 "NG", /**< NIGERIA */
702 "NF", /**< NORFOLK ISLAND */
703 "MP", /**< NORTHERN MARIANA ISLANDS */
706 "PK", /**< PAKISTAN */
708 "PS", /**< PALESTINIAN TERRITORY, OCCUPIED */
710 "PG", /**< PAPUA NEW GUINEA */
711 "PY", /**< PARAGUAY */
713 "PH", /**< PHILIPPINES */
714 "PN", /**< PITCAIRN */
716 "PT", /**< PORTUGAL */
717 "PR", /**< PUERTO RICO */
719 "RE", /**< REUNION */
720 "RO", /**< ROMANIA */
721 "RU", /**< RUSSIAN FEDERATION */
723 "SH", /**< SAINT HELENA */
724 "KN", /**< SAINT KITTS AND NEVIS */
725 "LC", /**< SAINT LUCIA */
726 "PM", /**< SAINT PIERRE AND MIQUELON */
727 "VC", /**< SAINT VINCENT AND THE GRENADINES */
729 "SM", /**< SAN MARINO */
730 "ST", /**< SAO TOME AND PRINCIPE */
731 "SA", /**< SAUDI ARABIA */
732 "SN", /**< SENEGAL */
733 "SC", /**< SEYCHELLES */
734 "SL", /**< SIERRA LEONE */
735 "SG", /**< SINGAPORE */
736 "SK", /**< SLOVAKIA */
737 "SI", /**< SLOVENIA */
738 "SB", /**< SOLOMON ISLANDS */
739 "SO", /**< SOMALIA */
740 "ZA", /**< SOUTH AFRICA */
741 "GS", /**< SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS */
743 "LK", /**< SRI LANKA */
745 "SR", /**< SURINAME */
746 "SJ", /**< SVALBARD AND JAN MAYEN */
747 "SZ", /**< SWAZILAND */
749 "CH", /**< SWITZERLAND */
750 "SY", /**< SYRIAN ARAB REPUBLIC */
751 "TW", /**< TAIWAN, PROVINCE OF CHINA */
752 "TJ", /**< TAJIKISTAN */
753 "TZ", /**< TANZANIA, UNITED REPUBLIC OF */
754 "TH", /**< THAILAND */
755 "TL", /**< TIMOR-LESTE */
757 "TK", /**< TOKELAU */
759 "TT", /**< TRINIDAD AND TOBAGO */
760 "TN", /**< TUNISIA */
762 "TM", /**< TURKMENISTAN */
763 "TC", /**< TURKS AND CAICOS ISLANDS */
766 "UA", /**< UKRAINE */
767 "AE", /**< UNITED ARAB EMIRATES */
768 "GB", /**< UNITED KINGDOM */
769 "US", /**< UNITED STATES */
770 "UM", /**< UNITED STATES MINOR OUTLYING ISLANDS */
771 "UY", /**< URUGUAY */
772 "UZ", /**< UZBEKISTAN */
773 "VU", /**< VANUATU */
774 "VE", /**< VENEZUELA */
775 "VN", /**< VIET NAM */
776 "VG", /**< VIRGIN ISLANDS, BRITISH */
777 "VI", /**< VIRGIN ISLANDS, U.S. */
778 "WF", /**< WALLIS AND FUTUNA */
779 "EH", /**< WESTERN SAHARA */
782 "ZW", /**< ZIMBABWE */
784 "ME", /**< MONTENEGRO */
785 "BL", /**< SAINT BARTHELEMY @b Since: @b 2.1 */
786 "MF", /**< SAINT MARTIN (FRENCH PART) @b Since: @b 2.1 */
787 "419" /**< Latin America and the Caribbean @b Since: @b 2.1 */
791 /////////////////////////////////////////////////////////////////////////////////////////////////////
794 Locale::Locale(const Locale& other)
795 : __languageCode(other.__languageCode)
796 , __countryCode(other.__countryCode)
797 , __pLocaleImpl(other.__pLocaleImpl->CloneN())
799 SysAssert(__pLocaleImpl);
803 Locale::Locale(LanguageCode languageCode, CountryCode countryCode, const String* pVariantCodeString)
804 : __languageCode((languageCode < LANGUAGE_MAX && languageCode >= LANGUAGE_AAR) ? languageCode : LANGUAGE_INVALID)
805 , __countryCode((countryCode < COUNTRY_MAX && countryCode >= COUNTRY_AF) ? countryCode : COUNTRY_INVALID)
806 , __pLocaleImpl(null)
808 const char* pLanguage = (__languageCode != LANGUAGE_INVALID) ? LanguageCodeString3LetterArray[__languageCode] : null;
809 const char* pCountry = (__countryCode != COUNTRY_INVALID) ? CountryCodeString2LetterArray[__countryCode] : null;
811 std::unique_ptr<char[]> pVariantCode (null);
812 if (pVariantCodeString)
814 pVariantCode.reset(_StringConverter::CopyToCharArrayN(*pVariantCodeString));
817 __pLocaleImpl = new (std::nothrow) _LocaleImpl(pLanguage, pCountry, pVariantCode.get());
818 SysAssert(__pLocaleImpl);
823 Locale::operator =(const Locale& other)
827 __languageCode = other.__languageCode;
828 __countryCode = other.__countryCode;
830 delete __pLocaleImpl;
831 __pLocaleImpl = other.__pLocaleImpl->CloneN();
837 Locale::~Locale(void)
839 delete __pLocaleImpl;
840 __pLocaleImpl = null;
845 Locale::SetVariantCodeString(const String* pVariantCode)
847 std::unique_ptr<char[]> pVariant (null);
850 pVariant.reset(_StringConverter::CopyToCharArrayN(*pVariantCode));
852 __pLocaleImpl->SetVariantCodeString(pVariant.get());
858 Locale::GetLanguageCode(void) const
860 return __languageCode;
865 Locale::GetCountryCode(void) const
867 return __countryCode;
872 Locale::GetLanguageCodeString(void) const
874 return __pLocaleImpl->GetLanguageCodeString(false);
879 Locale::GetCountryCodeString(void) const
881 return __pLocaleImpl->Get2LetterCountryCodeString();
886 Locale::GetVariantCodeString(void) const
888 return __pLocaleImpl->GetVariantCodeString();
893 Locale::GetLocaleCodeString(void) const
895 String lclCode(__pLocaleImpl->GetLanguageCodeString(false));
896 if (!lclCode.IsEmpty())
898 lclCode.Append(L"_");
899 lclCode.Append(GetCountryCodeString());
901 String varCode(__pLocaleImpl->GetVariantCodeString());
902 if (!varCode.IsEmpty())
904 lclCode.Append(L"_");
905 lclCode.Append(varCode);
913 Locale::GetCountryName(String& countryName) const
915 return __pLocaleImpl->GetCountryName(countryName);
920 Locale::GetCountryName(const Locale& otherLocale, String& countryName) const
922 return __pLocaleImpl->GetCountryName(*otherLocale.__pLocaleImpl, countryName);
927 Locale::GetLanguageName(String& languageName) const
929 return __pLocaleImpl->GetLanguageName(languageName);
934 Locale::GetLanguageName(const Locale& otherLocale, String& languageName) const
936 return __pLocaleImpl->GetLanguageName(*otherLocale.__pLocaleImpl, languageName);
940 Locale::operator ==(const Locale& other) const
942 bool isEqual = ((this->GetCountryCode() == other.GetCountryCode())
943 && (this->GetLanguageCode() == other.GetLanguageCode())
944 && (this->GetVariantCodeString() == other.GetVariantCodeString()));
949 Locale::operator !=(const Locale& other) const
951 return !(*this == other);
955 Locale::Equals(const Object& obj) const
957 const Locale* pOtherLocale = dynamic_cast< const Locale* >(&obj);
960 return *this == *pOtherLocale;
966 Locale::GetHashCode(void) const
968 return __pLocaleImpl->GetHashCode();
973 Locale::StringToLanguageCode(const String& languageCodeString)
975 if (!languageCodeString.IsEmpty())
977 for (int i = 0; i < LANGUAGE_MAX; i++)
979 if (languageCodeString == LanguageCodeString3LetterArray[i])
981 return (LanguageCode) i;
987 SysLog(NID_LCL,"languageCodeString is empty string");
990 return LANGUAGE_INVALID;
995 Locale::StringToCountryCode(const String& countryCodeString)
997 if(!countryCodeString.IsEmpty())
999 for (int i = 0; i < COUNTRY_MAX; i++)
1001 if (countryCodeString == CountryCodeString2LetterArray[i])
1003 return (CountryCode) i;
1009 SysLog(NID_LCL,"countryCodeString is empty string");
1012 return COUNTRY_INVALID;
1017 Locale::LanguageCodeToString(LanguageCode languageCode)
1019 return ((languageCode > LANGUAGE_INVALID) && (languageCode < LANGUAGE_MAX))
1020 ? LanguageCodeString3LetterArray[languageCode]
1026 Locale::CountryCodeToString(CountryCode countryCode)
1028 return ((countryCode > COUNTRY_INVALID) && (countryCode < COUNTRY_MAX))
1029 ? CountryCodeString2LetterArray[countryCode]
1035 Locale::LanguageCodeToTwoLetterLanguageCodeString(LanguageCode languageCode)
1037 return ((languageCode > LANGUAGE_INVALID) && (languageCode < LANGUAGE_MAX))
1038 ? _LocaleImpl::Get2LetterLanguageCodeString(LanguageCodeString3LetterArray[languageCode])
1044 Locale::TwoLetterLanguageCodeStringToLanguageCode(const String& languageCodeString)
1048 languageCodeString.IndexOf(L"-", 0, index);
1050 if (languageCodeString.GetLength() == 2 || index == 2)
1052 std::unique_ptr<char[]> pLangStr (_StringConverter::CopyToCharArrayN(languageCodeString));
1053 return StringToLanguageCode(_LocaleImpl::Get3LetterLanguageCodeString(pLangStr.get()));
1055 return LANGUAGE_INVALID;
1060 Locale::CountryCodeToThreeLetterCountryCodeString(CountryCode countryCode)
1062 return ((countryCode > COUNTRY_INVALID) && (countryCode < COUNTRY_MAX))
1063 ? _LocaleImpl::Get3LetterCountryCodeString(CountryCodeString2LetterArray[countryCode])
1069 Locale::ThreeLetterCountryCodeStringToCountryCode(const String& countryCodeString)
1071 if (countryCodeString.GetLength() == 3)
1073 for (int i = 0; i < COUNTRY_MAX; i++)
1075 String countryCode(_LocaleImpl::Get3LetterCountryCodeString(CountryCodeString2LetterArray[i]));
1076 if (countryCodeString.Equals(countryCode, false))
1078 return static_cast<CountryCode> (i);
1082 return COUNTRY_INVALID;
1087 }; // Tizen::Locales