terça-feira, 8 de outubro de 2013

Formatos de data na sua aplicação - Locale IDs

Bom, um problema que tive nos meados de 2008, mas que ainda é bem comum de acontecer.
Estava desenvolvendo uma aplicação web e local funcionava que era uma beleza, porem quando publicava a mesma não rodava absolutamente nada, analisando notei que a data esta com um formato diferente do que estava esperando e comecei a pesquisar então obtive a seguinte resposta, que quando trabalhamos com servidores que estão localizados em outros local(país) as configurações regionais estão configurados com a formatação de seu país. O LCID permite realizar a formatação de datas e configurações regionais de acordo com o país que o desenvolvedor necessitar, setando o código atribuído para cada país.

um exemplo de como utilizar:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="home.aspx.cs"
    Inherits="Home" LCID="1046" Title="Site Web" %>

Aqui uma "pequena" listagem dos LCID's com referencia do site da Microsoft
Language - Country/RegionLCID HexLCID Dec
Afrikaans - South Africa04361078
Albanian - Albania041c1052
Alsatian04841156
Amharic - Ethiopia045e1118
Arabic - Saudi Arabia04011025
Arabic - Algeria14015121
Arabic - Bahrain3c0115361
Arabic - Egypt0c013073
Arabic - Iraq08012049
Arabic - Jordan2c0111265
Arabic - Kuwait340113313
Arabic - Lebanon300112289
Arabic - Libya10014097
Arabic - Morocco18016145
Arabic - Oman20018193
Arabic - Qatar400116385
Arabic - Syria280110241
Arabic - Tunisia1c017169
Arabic - U.A.E.380114337
Arabic - Yemen24019217
Armenian - Armenia042b1067
Assamese044d1101
Azeri (Cyrillic)082c2092
Azeri (Latin)042c1068
Bashkir046d1133
Basque042d1069
Belarusian04231059
Bengali (India)04451093
Bengali (Bangladesh)08452117
Bosnian (Bosnia/Herzegovina)141A5146
Breton047e1150
Bulgarian04021026
Burmese04551109
Catalan04031027
Cherokee - United States045c1116
Chinese - People's Republic of China08042052
Chinese - Singapore10044100
Chinese - Taiwan04041028
Chinese - Hong Kong SAR0c043076
Chinese - Macao SAR14045124
Corsican04831155
Croatian041a1050
Croatian (Bosnia/Herzegovina)101a4122
Czech04051029
Danish04061030
Dari048c1164
Divehi04651125
Dutch - Netherlands04131043
Dutch - Belgium08132067
Edo04661126
English - United States04091033
English - United Kingdom08092057
English - Australia0c093081
English - Belize280910249
English - Canada10094105
English - Caribbean24099225
English - Hong Kong SAR3c0915369
English - India400916393
English - Indonesia380914345
English - Ireland18096153
English - Jamaica20098201
English - Malaysia440917417
English - New Zealand14095129
English - Philippines340913321
English - Singapore480918441
English - South Africa1c097177
English - Trinidad2c0911273
English - Zimbabwe300912297
Estonian04251061
Faroese04381080
Farsi04291065
Filipino04641124
Finnish040b1035
French - France040c1036
French - Belgium080c2060
French - Cameroon2c0c11276
French - Canada0c0c3084
French - Democratic Rep. of Congo240c9228
French - Cote d'Ivoire300c12300
French - Haiti3c0c15372
French - Luxembourg140c5132
French - Mali340c13324
French - Monaco180c6156
French - Morocco380c14348
French - North Africae40c58380
French - Reunion200c8204
French - Senegal280c10252
French - Switzerland100c4108
French - West Indies1c0c7180
Frisian - Netherlands04621122
Fulfulde - Nigeria04671127
FYRO Macedonian042f1071
Galician04561110
Georgian04371079
German - Germany04071031
German - Austria0c073079
German - Liechtenstein14075127
German - Luxembourg10074103
German - Switzerland08072055
Greek04081032
Greenlandic046f1135
Guarani - Paraguay04741140
Gujarati04471095
Hausa - Nigeria04681128
Hawaiian - United States04751141
Hebrew040d1037
Hindi04391081
Hungarian040e1038
Ibibio - Nigeria04691129
Icelandic040f1039
Igbo - Nigeria04701136
Indonesian04211057
Inuktitut045d1117
Irish083c2108
Italian - Italy04101040
Italian - Switzerland08102064
Japanese04111041
K'iche04861158
Kannada044b1099
Kanuri - Nigeria04711137
Kashmiri08602144
Kashmiri (Arabic)04601120
Kazakh043f1087
Khmer04531107
Kinyarwanda04871159
Konkani04571111
Korean04121042
Kyrgyz (Cyrillic)04401088
Lao04541108
Latin04761142
Latvian04261062
Lithuanian04271063
Luxembourgish046e1134
Malay - Malaysia043e1086
Malay - Brunei Darussalam083e2110
Malayalam044c1100
Maltese043a1082
Manipuri04581112
Maori - New Zealand04811153
Mapudungun04711146
Marathi044e1102
Mohawk047c1148
Mongolian (Cyrillic)04501104
Mongolian (Mongolian)08502128
Nepali04611121
Nepali - India08612145
Norwegian (Bokmål)04141044
Norwegian (Nynorsk)08142068
Occitan04821154
Oriya04481096
Oromo04721138
Papiamentu04791145
Pashto04631123
Polish04151045
Portuguese - Brazil04161046
Portuguese - Portugal08162070
Punjabi04461094
Punjabi (Pakistan)08462118
Quecha - Bolivia046B1131
Quecha - Ecuador086B2155
Quecha - Peru0C6B3179
Rhaeto-Romanic04171047
Romanian04181048
Romanian - Moldava08182072
Russian04191049
Russian - Moldava08192073
Sami (Lappish)043b1083
Sanskrit044f1103
Scottish Gaelic043c1084
Sepedi046c1132
Serbian (Cyrillic)0c1a3098
Serbian (Latin)081a2074
Sindhi - India04591113
Sindhi - Pakistan08592137
Sinhalese - Sri Lanka045b1115
Slovak041b1051
Slovenian04241060
Somali04771143
Sorbian042e1070
Spanish - Spain (Modern Sort)0c0a3082
Spanish - Spain (Traditional Sort)040a1034
Spanish - Argentina2c0a11274
Spanish - Bolivia400a16394
Spanish - Chile340a13322
Spanish - Colombia240a9226
Spanish - Costa Rica140a5130
Spanish - Dominican Republic1c0a7178
Spanish - Ecuador300a12298
Spanish - El Salvador440a17418
Spanish - Guatemala100a4106
Spanish - Honduras480a18442
Spanish - Latin America580a22538
Spanish - Mexico080a2058
Spanish - Nicaragua4c0a19466
Spanish - Panama180a6154
Spanish - Paraguay3c0a15370
Spanish - Peru280a10250
Spanish - Puerto Rico500a20490
Spanish - United States540a21514
Spanish - Uruguay380a14346
Spanish - Venezuela200a8202
Sutu04301072
Swahili04411089
Swedish041d1053
Swedish - Finland081d2077
Syriac045a1114
Tajik04281064
Tamazight (Arabic)045f1119
Tamazight (Latin)085f2143
Tamil04491097
Tatar04441092
Telugu044a1098
Thai041e1054
Tibetan - Bhutan08512129
Tibetan - People's Republic of China04511105
Tigrigna - Eritrea08732163
Tigrigna - Ethiopia04731139
Tsonga04311073
Tswana04321074
Turkish041f1055
Turkmen04421090
Uighur - China04801152
Ukrainian04221058
Urdu04201056
Urdu - India08202080
Uzbek (Cyrillic)08432115
Uzbek (Latin)04431091
Venda04331075
Vietnamese042a1066
Welsh04521106
Wolof04881160
Xhosa04341076
Yakut04851157
Yi04781144
Yiddish043d1085
Yoruba046a1130
Zulu04351077
HID (Human Interface Device)04ff1279