/
Cuis-System-Localization.pck
3168 lines (3004 loc) · 43.4 KB
/
Cuis-System-Localization.pck
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
'From Cuis 4.0 of 21 April 2012 [latest update: #1270] on 20 May 2012 at 5:41:07 pm'!
'Description Please enter a description for this package '!
!classDefinition: #ISOLanguageDefinition category: #'Cuis-System-Localization'!
Object subclass: #ISOLanguageDefinition
instanceVariableNames: 'iso3 iso2 iso3Alternate language'
classVariableNames: 'ISO2Countries ISO2Table ISO3Countries ISO3Table'
poolDictionaries: ''
category: 'Cuis-System-Localization'!
!classDefinition: 'ISOLanguageDefinition class' category: #'Cuis-System-Localization'!
ISOLanguageDefinition class
instanceVariableNames: ''!
!classDefinition: #Locale category: #'Cuis-System-Localization'!
Object subclass: #Locale
instanceVariableNames: 'id shortDate longDate time decimalSymbol digitGrouping currencySymbol currencyNotation measurement offsetLocalToUTC offsetVMToUTC dstActive'
classVariableNames: 'Activated Current CurrentPlatform KnownLocales LanguageSymbols LocaleChangeListeners PlatformEncodings'
poolDictionaries: ''
category: 'Cuis-System-Localization'!
!classDefinition: 'Locale class' category: #'Cuis-System-Localization'!
Locale class
instanceVariableNames: ''!
!classDefinition: #LocaleID category: #'Cuis-System-Localization'!
Object subclass: #LocaleID
instanceVariableNames: 'isoLanguage isoCountry'
classVariableNames: ''
poolDictionaries: ''
category: 'Cuis-System-Localization'!
!classDefinition: 'LocaleID class' category: #'Cuis-System-Localization'!
LocaleID class
instanceVariableNames: ''!
!classDefinition: #NaturalLanguageFormTranslator category: #'Cuis-System-Localization'!
Object subclass: #NaturalLanguageFormTranslator
instanceVariableNames: 'id generics'
classVariableNames: 'CachedTranslations'
poolDictionaries: ''
category: 'Cuis-System-Localization'!
!classDefinition: 'NaturalLanguageFormTranslator class' category: #'Cuis-System-Localization'!
NaturalLanguageFormTranslator class
instanceVariableNames: ''!
!classDefinition: #NaturalLanguageTranslator category: #'Cuis-System-Localization'!
Object subclass: #NaturalLanguageTranslator
instanceVariableNames: ''
classVariableNames: 'AllKnownPhrases'
poolDictionaries: ''
category: 'Cuis-System-Localization'!
!classDefinition: 'NaturalLanguageTranslator class' category: #'Cuis-System-Localization'!
NaturalLanguageTranslator class
instanceVariableNames: ''!
!Locale commentStamp: '<historical>' prior: 0!
Main comment stating the purpose of this class and relevant relationship to other classes. http://www.w3.org/WAI/ER/IG/ert/iso639.htm http://www.oasis-open.org/cover/iso639a.html See also http://oss.software.ibm.com/cvs/icu/~checkout~/icuhtml/design/language_code_issues.html http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.10 ISO 3166http://mitglied.lycos.de/buran/knowhow/codes/locales/!
!NaturalLanguageFormTranslator commentStamp: 'LaurentLaffont 3/4/2011 22:44' prior: 0!
Provides support for looking up Forms by name for presentation in the UI.Different forms can be registered for a name for different locales allowingimages presented in the UI to be localised.Typically used where images contain language dependent text.E.g.buttonForm := (NaturalLanguageFormTranslator localeID: Locale current localeID) translate: 'submit button'Form translations are added like so:(NaturalLanguageFormTranslator isoLanguage: 'en' isoCountry: 'gb') name: 'submit button' form: aForm!
!NaturalLanguageTranslator commentStamp: 'HilaireFernandes 5/13/2010 11:48' prior: 0!
A NaturalLanguageTranslator is a dummy translator.The localization framework is found in the gettext package.!
!ISOLanguageDefinition methodsFor: 'accessing' stamp: 'mir 7/1/2004 18:20'!
iso2 ^iso2 ifNil: [self iso3]! !
!ISOLanguageDefinition methodsFor: 'initialize' stamp: 'mir 6/30/2004 15:54'!
iso2: aString iso2 := aString ifEmpty: [nil] ifNotEmpty: [aString]! !
!ISOLanguageDefinition methodsFor: 'accessing' stamp: 'mir 7/1/2004 18:21'!
iso3 ^iso3 ifNil: ['']! !
!ISOLanguageDefinition methodsFor: 'initialize' stamp: 'mir 6/30/2004 15:54'!
iso3: aString iso3 := aString ifEmpty: [nil] ifNotEmpty: [aString]! !
!ISOLanguageDefinition methodsFor: 'accessing' stamp: 'mir 6/30/2004 15:47'!
iso3Alternate ^iso3Alternate ifNil: ['']! !
!ISOLanguageDefinition methodsFor: 'initialize' stamp: 'mir 6/30/2004 15:54'!
iso3Alternate: aString iso3Alternate := aString ifEmpty: [nil] ifNotEmpty: [aString]! !
!ISOLanguageDefinition methodsFor: 'accessing' stamp: 'mir 8/15/2003 13:13'!
language ^language! !
!ISOLanguageDefinition methodsFor: 'initialize' stamp: 'mir 8/15/2003 13:40'!
language: aString language := aString! !
!ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 9/1/2005 14:06'!
buildIso3166CodesTables "ISOLanguageDefinition buildIso3166CodesTables" | rawdata stream country isoa2 isoa3 unNumeric macName macCode windowsName windowsCode empty table | rawdata := self iso3166Codes. table := OrderedCollection new: 200. stream := rawdata readStream. empty := 160 asCharacter asString. [stream atEnd] whileFalse: [country := stream nextLine. isoa2 := stream nextLine. isoa3 := stream nextLine. unNumeric := stream nextLine. windowsName := stream nextLine. windowsName = empty ifTrue: [windowsName := nil]. windowsCode := stream nextLine. windowsCode = empty ifTrue: [windowsCode := nil]. macName := stream nextLine. macName = empty ifTrue: [macName := nil]. macCode := stream nextLine. macCode = empty ifTrue: [macCode := nil]. table add: { country. isoa2. isoa3. unNumeric. windowsName. windowsCode. macName. macCode. }]. ^table! !
!ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 9/1/2005 14:14'!
extraCountryDefinitions ^{ {'Kids'. 'KIDS'. 'KIDS'.}. }! !
!ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 7/15/2004 18:14'!
extraISO3Definitions ^self readISOLanguagesFrom: 'jpk Japanese (Kids)' readStream! !
!ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 7/15/2004 18:13'!
initISO3LanguageTable "ISOLanguageDefinition initIso3LanguageTable" | table | table := ISOLanguageDefinition readISOLanguagesFrom: ISOLanguageDefinition isoLanguages readStream. table addAll: self extraISO3Definitions. ^table! !
!ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 9/1/2005 14:12'!
initISOCountries "ISOLanguageDefinition initISOCountries" | iso3166Table | iso3166Table := ISOLanguageDefinition buildIso3166CodesTables. ISO2Countries := Dictionary new. ISO3Countries := Dictionary new. iso3166Table do: [:entry | ISO2Countries at: (entry at: 2) put: (entry at: 1). ISO3Countries at: (entry at: 3) put: (entry at: 1)]. self extraCountryDefinitions do: [:entry | ISO2Countries at: (entry at: 2) put: (entry at: 1). ISO3Countries at: (entry at: 3) put: (entry at: 1)]! !
!ISOLanguageDefinition class methodsFor: 'initialization' stamp: 'mir 7/1/2004 18:19'!
initialize "ISOLanguageDefinition initialize" ISO3Table := nil. ISO2Table := nil! !
!ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 9/1/2005 14:18'!
iso2Countries "ISOLanguageDefinition iso2Countries" "ISO2Countries := nil. ISO3Countries := nil" ISO2Countries ifNil: [self initISOCountries]. ^ISO2Countries! !
!ISOLanguageDefinition class methodsFor: 'accessing' stamp: 'mir 7/1/2004 18:06'!
iso2LanguageDefinition: aString ^self iso2LanguageTable at: aString! !
!ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 7/1/2004 18:14'!
iso2LanguageTable "ISOLanguageDefinition iso2LanguageTable" ISO2Table ifNotNil: [^ISO2Table]. ISO2Table := Dictionary new: self iso3LanguageTable basicSize. self iso3LanguageTable do: [:entry | ISO2Table at: entry iso2 put: entry]. ^ISO2Table! !
!ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 9/1/2005 13:57'!
iso3166Codes"http://www.unicode.org/onlinedat/countries.html"^'ÅLAND ISLANDSAX AFGHANISTANAFAFG004 ALBANIAALALB008CTRY_ALBANIA355 ALGERIADZDZA012CTRY_ALGERIA213verArabic16AMERICAN SAMOAASASM016 ANDORRAADAND020 ANGOLAAOAGO024 ANGUILLAAIAIA660 ANTARCTICAAQATA010 ANTIGUA AND BARBUDAAGATG028 ARGENTINAARARG032CTRY_ARGENTINA54 ARMENIAAMARM051CTRY_ARMENIA374verArmenian84ARUBAAWABW533 AUSTRALIAAUAUS036CTRY_AUSTRALIA61verAustralia15AUSTRIAATAUT040CTRY_AUSTRIA43verAustria92AZERBAIJANAZAZE031CTRY_AZERBAIJAN994 BAHAMASBSBHS044 BAHRAINBHBHR048CTRY_BAHRAIN973 BANGLADESHBDBGD050 verBengali60BARBADOSBBBRB052 BELARUSBYBLR112CTRY_BELARUS375 BELGIUMBEBEL056CTRY_BELGIUM32verFrBelgium, verFlemish98BELIZEBZBLZ084CTRY_BELIZE501 BENINBJBEN204 BERMUDABMBMU060 BHUTANBTBTN064 verBhutan83BOLIVIABOBOL068CTRY_BOLIVIA591 BOSNIA AND HERZEGOVINABABIH070 BOTSWANABWBWA072 BOUVET ISLANDBVBVT074 BRAZILBRBRA076CTRY_BRAZIL55verBrazil71BRITISH INDIAN OCEAN TERRITORYIOIOT086 BRUNEI DARUSSALAMBNBRN096CTRY_BRUNEI_DARUSSALAM673 BULGARIABGBGR100CTRY_BULGARIA359verBulgaria 72BURKINA FASOBFBFA854 BURUNDIBIBDI108 CAMBODIAKHKHM116 CAMEROONCMCMR120 CANADACACAN124CTRY_CANADA2verFrCanada, verEndCanada82CAPE VERDECVCPV132 CAYMAN ISLANDSKYCYM136 CENTRAL AFRICAN REPUBLICCFCAF140 CHADTDTCD148 CHILECLCHL152CTRY_CHILE56 CHINACNCHN156CTRY_PRCHINA86verChina52CHRISTMAS ISLANDCXCXR162 COCOS (KEELING) ISLANDSCCCCK166 COLOMBIACOCOL170CTRY_COLOMBIA57 COMOROSKMCOM174 CONGOCGCOG178 CONGO, THE DEMOCRATIC REPUBLIC OF THECD COOK ISLANDSCKCOK184 COSTA RICACRCRI188CTRY_COSTA_RICA506 COTE D''IVOIRECICIV384 CROATIA (local name: Hrvatska)HRHRV191CTRY_CROATIA385verCroatia, verYugoCroatian68 (c), 25 (y)CUBACUCUB192 CYPRUSCYCYP196 verCyprus23CZECH REPUBLICCZCZE203CTRY_CZECH420verCzech 56DENMARKDKDNK208CTRY_DENMARK45verDenmark(da), verFaeroeIsl(fo)9(da), 47(fo)DJIBOUTIDJDJI262 DOMINICADMDMA212 DOMINICAN REPUBLICDODOM214CTRY_DOMINICAN_REPUBLIC1 EAST TIMORTLTLS626 ECUADORECECU218CTRY_ECUADOR593 EGYPTEGEGY818CTRY_EGYPT20verArabic16EL SALVADORSVSLV222CTRY_EL_SALVADOR503 EQUATORIAL GUINEAGQGNQ226 ERITREAERERI232 ESTONIAEEEST233CTRY_ESTONIA372verEstonia44ETHIOPIAETETH210 FALKLAND ISLANDS (MALVINAS)FKFLK238 FAROE ISLANDSFOFRO234CTRY_FAEROE_ISLANDS298 FIJIFJFJI242 FINLANDFIFIN246CTRY_FINLAND358verFinland17FRANCEFRFRA250CTRY_FRANCE33verFrance1FRANCE, METROPOLITANFXFXX249 FRENCH GUIANAGFGUF254 FRENCH POLYNESIAPFPYF258 FRENCH SOUTHERN TERRITORIESTFATF260 GABONGAGAB266 GAMBIAGMGMB270 GEORGIAGEGEO268CTRY_GEORGIA995verGeorgian85GERMANYDEDEU276CTRY_GERMANY49verGermany3GHANAGHGHA288 GIBRALTARGIGIB292 GREECEGRGRC300CTRY_GREECE30verGreece, verGreecePoly20, 40GREENLANDGLGRL304 verGreenland107GRENADAGDGRD308 GUADELOUPEGPGLP312 GUAMGUGUM316 GUATEMALAGTGTM320CTRY_GUATEMALA502 GUINEAGNGIN324 GUINEA-BISSAUGWGNB624 GUYANAGYGUY328 HAITIHTHTI332 HEARD ISLAND & MCDONALD ISLANDSHMHMD334 HONDURASHNHND340CTRY_HONDURAS504 HONG KONGHKHKG344CTRY_HONG_KONG852 HUNGARYHUHUN348CTRY_HUNGARY36verHungary43ICELANDISISL352CTRY_ICELAND354verIceland21INDIAININD356CTRY_INDIA91verIndiaHindi(hi)33INDONESIAIDIDN360CTRY_INDONESIA62 IRAN, ISLAMIC REPUBLIC OFIRIRN364CTRY_IRAN981verIran48IRAQIQIRQ368CTRY_IRAQ964verArabic16IRELANDIEIRL372CTRY_IRELAND353verIreland50ISRAELILISR376CTRY_ISRAEL972verIsrael13ITALYITITA380CTRY_ITALY39verItaly4JAMAICAJMJAM388CTRY_JAMAICA1 JAPANJPJPN392CTRY_JAPAN81verJapan14JORDANJOJOR400CTRY_JORDAN962 KAZAKHSTANKZKAZ398CTRY_KAZAKSTAN7 KENYAKEKEN404CTRY_KENYA254 KIRIBATIKIKIR296 KOREA, DEMOCRATIC PEOPLE''S REPUBLIC OFKPPRK408 verKorea51KOREA, REPUBLIC OFKRKOR410CTRY_SOUTH_KOREA82verKorea KUWAITKWKWT414CTRY_KUWAIT965 KYRGYZSTANKGKGZ417CTRY_KYRGYZSTAN996 LAO PEOPLE''S DEMOCRATIC REPUBLICLALAO418 LATVIALVLVA428CTRY_LATVIA371verLatvia45LEBANONLBLBN422CTRY_LEBANON961 LESOTHOLSLSO426 LIBERIALRLBR430 LIBYAN ARAB JAMAHIRIYALYLBY434CTRY_LIBYA218verArabic16LIECHTENSTEINLILIE438CTRY_LIECHTENSTEIN41 LITHUANIALTLTU440CTRY_LITHUANIA370verLithuania41LUXEMBOURGLULUX442CTRY_LUXEMBOURG352verFrBelgiumLux6MACAUMOMAC446CTRY_MACAU853 MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OFMKMKD807CTRY_MACEDONIA389verMacedonian MADAGASCARMGMDG450 MALAWIMWMWI454 MALAYSIAMYMYS458CTRY_MALAYSIA60 MALDIVESMVMDV462CTRY_MALDIVES960 MALIMLMLI466 MALTAMTMLT470 verMalta22MARSHALL ISLANDSMHMHL584 MARTINIQUEMQMTQ474 MAURITANIAMRMRT478 MAURITIUSMUMUS480 MAYOTTEYTMYT175 MEXICOMXMEX484CTRY_MEXICO52 MICRONESIA, FEDERATED STATES OFFMFSM583 MOLDOVA, REPUBLIC OFMDMDA498 MONACOMCMCO492CTRY_MONACO33 MONGOLIAMNMNG496CTRY_MONGOLIA976 MONTSERRATMSMSR500 MOROCCOMAMAR504CTRY_MOROCCO212verArabic16MOZAMBIQUEMZMOZ508 MYANMARMMMMR104 NAMIBIANANAM516 NAURUNRNRU520 NEPALNPNPL524 verNepal106NETHERLANDSNLNLD528CTRY_NETHERLANDS31verNetherlands5NETHERLANDS ANTILLESANANT530 NEW CALEDONIANCNCL540 NEW ZEALANDNZNZL554CTRY_NEW_ZEALAND64 NICARAGUANINIC558CTRY_NICARAGUA505 NIGERNENER562 NIGERIANGNGA566 NIUENUNIU570 NORFOLK ISLANDNFNFK574 NORTHERN MARIANA ISLANDSMPMNP580 NORWAYNONOR578CTRY_NORWAY47verNorway12OMANOMOMN512CTRY_OMAN968 PAKISTANPKPAK586CTRY_PAKISTAN92verPakistanUrdu, verPunjabi34 (U), 95 (P)PALAUPWPLW585 PANAMAPAPAN591CTRY_PANAMA507 PALESTINIAN TERRITORY, OCCUPIEDPS PAPUA NEW GUINEAPGPNG598 PARAGUAYPYPRY600CTRY_PARAGUAY595 PERUPEPER604CTRY_PERU51 PHILIPPINESPHPHL608CTRY_PHILIPPINES63 PITCAIRNPNPCN612 POLANDPLPOL616CTRY_POLAND48verPoland42PORTUGALPTPRT620CTRY_PORTUGAL351verPortugal10PUERTO RICOPRPRI630CTRY_PUERTO_RICO1 QATARQAQAT634CTRY_QATAR974 REUNIONREREU638 ROMANIAROROU*642CTRY_ROMANIA40verRomania39RUSSIAN FEDERATIONRURUS643CTRY_RUSSIA7verRussia49RWANDARWRWA646 SAINT KITTS AND NEVISKNKNA659 SAINT LUCIALCLCA662 SAINT VINCENT AND THE GRENADINESVCVCT670 SAMOAWSWSM882 SAN MARINOSMSMR674 SAO TOME AND PRINCIPESTSTP678 SAUDI ARABIASASAU682CTRY_SAUDI_ARABIA966verArabic16SENEGALSNSEN686 SERBIA AND MONTENEGROCS CTRY_SERBIA381 SEYCHELLESSCSYC690 SIERRA LEONESLSLE694 SINGAPORESGSGP702CTRY_SINGAPORE65verSingapore100SLOVAKIA (Slovak Republic)SKSVK703CTRY_SLOVAK421verSlovak57 SLOVENIASISVN705CTRY_SLOVENIA386verSlovenian66SOLOMON ISLANDSSBSLB90 SOMALIASOSOM706 SOUTH AFRICAZAZAF710CTRY_SOUTH_AFRICA27 SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDSGS SPAINESESP724CTRY_SPAIN34verSpain8SRI LANKALKLKA144 SAINT HELENASHSHN654 SAINT PIERRE AND MIQUELONPMSPM666 SUDANSDSDN736 SURINAMESRSUR740 SVALBARD AND JAN MAYEN ISLANDSSJSJM744 SWAZILANDSZSWZ748 SWEDENSESWE752CTRY_SWEDEN46verSweden7SWITZERLANDCHCHE756CTRY_SWITZERLAND41verFrSwiss(fr), verGrSwiss(de)18(fr), 19(de)SYRIAN ARAB REPUBLICSYSYR760CTRY_SYRIA963 TAIWAN, PROVINCE OF CHINATWTWN158CTRY_TAIWAN886verTaiwan53TAJIKISTANTJTJK762 TANZANIA, UNITED REPUBLIC OFTZTZA834 TATARSTAN CTRY_TATARSTAN7 THAILANDTHTHA764CTRY_THAILAND66verThailand54TIMOR-LESTETL TOGOTGTGO768 TOKELAUTKTKL772 TONGATOTON776 verTonga88TRINIDAD AND TOBAGOTTTTO780CTRY_TRINIDAD_Y_TOBAGO1 TUNISIATNTUN788CTRY_TUNISIA216verArabic16TURKEYTRTUR792CTRY_TURKEY90verTurkey24TURKMENISTANTMTKM795 TURKS AND CAICOS ISLANDSTCTCA796 TUVALUTVTUV798 UGANDAUGUGA800 UKRAINEUAUKR804CTRY_UKRAINE380verUkraine 62UNITED ARAB EMIRATESAEARE784CTRY_UAE971 UNITED KINGDOMGBGBR826CTRY_UNITED_KINGDOM44verBritain2UNITED STATESUSUSA840CTRY_UNITED_STATES1verUS0UNITED STATES MINOR OUTLYING ISLANDSUMUMI581 URUGUAYUYURY858CTRY_URUGUAY598 UZBEKISTANUZUZB860CTRY_UZBEKISTAN7 VANUATUVUVUT548 VATICAN CITY STATE (HOLY SEE)VAVAT336 VENEZUELAVEVEN862CTRY_VENEZUELA58 VIET NAMVNVNM704CTRY_VIET_NAM84verVietnam VIRGIN ISLANDS (BRITISH)VGVGB92 VIRGIN ISLANDS (U.S.)VIVIR850 WALLIS AND FUTUNA ISLANDSWFWLF876 WESTERN SAHARAEHESH732 YEMENYEYEM887CTRY_YEMEN967 YUGOSLAVIAYUYUG891 ZAIREZRZAR180 ZAMBIAZMZMB894 ZIMBABWEZWZWE716CTRY_ZIMBABWE263 '! !
!ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 9/1/2005 14:18'!
iso3Countries "ISOLanguageDefinition iso3Countries" "ISO2Countries := nil. ISO3Countries := nil" ISO3Countries ifNil: [self initISOCountries]. ^ISO3Countries! !
!ISOLanguageDefinition class methodsFor: 'accessing' stamp: 'mir 7/1/2004 18:06'!
iso3LanguageDefinition: aString ^self iso3LanguageTable at: aString! !
!ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 7/21/2004 13:10'!
iso3LanguageTable "ISOLanguageDefinition iso3LanguageTable" ^ISO3Table ifNil: [ISO3Table := self initISO3LanguageTable]! !
!ISOLanguageDefinition class methodsFor: 'private' stamp: 'yo 12/3/2004 17:46'!
isoLanguages "ISO 639: 3-letter codes" ^'abk ab Abkhazianace Achineseach Acoliada Adangmeaar aa Afarafh Afrihiliafr af Afrikaansafa Afro-Asiatic (Other)aka Akanakk Akkadianalb/sqi sq Albanianale Aleutalg Algonquian languagestut Altaic (Other)amh am Amharicapa Apache languagesara ar Arabicarc Aramaicarp Arapahoarn Araucanianarw Arawakarm/hye hy Armenianart Artificial (Other)asm as Assameseath Athapascan languagesmap Austronesian (Other)ava Avaricave Avestanawa Awadhiaym ay Aymaraaze az Azerbaijaninah Aztecban Balinesebat Baltic (Other)bal Baluchibam Bambarabai Bamileke languagesbad Bandabnt Bantu (Other)bas Basabak ba Bashkirbaq/eus eu Basquebej Bejabem Bembaben bn Bengaliber Berber (Other)bho Bhojpuribih bh Biharibik Bikolbin Binibis bi Bislamabra Brajbre be Bretonbug Buginesebul bg Bulgarianbua Buriatbur/mya my Burmesebel be Byelorussiancad Caddocar Caribcat ca Catalancau Caucasian (Other)ceb Cebuanocel Celtic (Other)cai Central American Indian (Other)chg Chagataicha Chamorroche Chechenchr Cherokeechy Cheyennechb Chibchachi/zho zh Chinesechn Chinook jargoncho Choctawchu Church Slavicchv Chuvashcop Copticcor Cornishcos co Corsicancre Creemus Creekcrp Creoles and Pidgins (Other)cpe Creoles and Pidgins, English-based (Other)cpf Creoles and Pidgins, French-based (Other)cpp Creoles and Pidgins, Portuguese-based (Other)cus Cushitic (Other) hr Croatiances/cze cs Czechdak Dakotadan da Danishdel Delawaredin Dinkadiv Divehidoi Dogridra Dravidian (Other)dua Dualadut/nla nl Dutchdum Dutch, Middle (ca. 1050-1350)dyu Dyuladzo dz Dzongkhaefi Efikegy Egyptian (Ancient)eka Ekajukelx Elamiteeng en Englishenm English, Middle (ca. 1100-1500)ang English, Old (ca. 450-1100)esk Eskimo (Other)epo eo Esperantoest et Estonianewe Eweewo Ewondofan Fangfat Fantifao fo Faroesefij fj Fijianfin fi Finnishfiu Finno-Ugrian (Other)fon Fonfra/fre fr Frenchfrm French, Middle (ca. 1400-1600)fro French, Old (842- ca. 1400)fry fy Frisianful Fulahgaa Gagae/gdh Gaelic (Scots)glg gl Galleganlug Gandagay Gayogez Geezgeo/kat ka Georgiandeu/ger de Germangmh German, Middle High (ca. 1050-1500)goh German, Old High (ca. 750-1050)gem Germanic (Other)gil Gilbertesegon Gondigot Gothicgrb Grebogrc Greek, Ancient (to 1453)ell/gre el Greek, Modern (1453-)kal kl Greenlandicgrn gn Guaraniguj gu Gujaratihai Haidahau ha Hausahaw Hawaiianheb he Hebrewher Hererohil Hiligaynonhim Himachalihin hi Hindihmo Hiri Motuhun hu Hungarianhup Hupaiba Ibanice/isl is Icelandicibo Igboijo Ijoilo Ilokoinc Indic (Other)ine Indo-European (Other)ind id Indonesianina ia Interlingua (International Auxiliary language Association)ine Interlingueiku iu Inuktitutipk ik Inupiakira Iranian (Other)gai/iri ga Irishsga Irish, Old (to 900)mga Irish, Middle (900 - 1200)iro Iroquoian languagesita it Italianjpn ja Japanesejav/jaw jv/jw Javanesejrb Judeo-Arabicjpr Judeo-Persiankab Kabylekac Kachinkam Kambakan kn Kannadakau Kanurikaa Kara-Kalpakkar Karenkas ks Kashmirikaw Kawikaz kk Kazakhkha Khasikhm km Khmerkhi Khoisan (Other)kho Khotanesekik Kikuyukin rw Kinyarwandakir ky Kirghizkom Komikon Kongokok Konkanikor ko Koreankpe Kpellekro Krukua Kuanyamakum Kumykkur ku Kurdishkru Kurukhkus Kusaiekut Kutenailad Ladinolah Lahndalam Lambaoci oc Langue d''Oc (post 1500)lao lo Laolat la Latinlav lv Latvianltz Letzeburgeschlez Lezghianlin ln Lingalalit lt Lithuanianloz Lozilub Luba-Katangalui Luisenolun Lundaluo Luo (Kenya and Tanzania)mac/mak mk Macedonianmad Maduresemag Magahimai Maithilimak Makasarmlg mg Malagasymay/msa ms Malaymal Malayalammlt ml Malteseman Mandingomni Manipurimno Manobo languagesmax Manxmao/mri mi Maorimar mr Marathichm Marimah Marshallmwr Marwarimas Masaimyn Mayan languagesmen Mendemic Micmacmin Minangkabaumis Miscellaneous (Other)moh Mohawkmol mo Moldavianmkh Mon-Kmer (Other)lol Mongomon mn Mongolianmos Mossimul Multiple languagesmun Munda languagesnau na Naurunav Navajonde Ndebele, Northnbl Ndebele, Southndo Ndongonep ne Nepalinew Newarinic Niger-Kordofanian (Other)ssa Nilo-Saharan (Other)niu Niueannon Norse, Oldnai North American Indian (Other)nor no Norwegiannno Norwegian (Nynorsk)nub Nubian languagesnym Nyamwezinya Nyanjanyn Nyankolenyo Nyoronzi Nzimaoji Ojibwaori or Oriyaorm om Oromoosa Osageoss Osseticoto Otomian languagespal Pahlavipau Palauanpli Palipam Pampangapag Pangasinanpan pa Panjabipap Papiamentopaa Papuan-Australian (Other)fas/per fa Persianpeo Persian, Old (ca 600 - 400 B.C.)phn Phoenicianpol pl Polishpon Ponapepor pt Portuguesepra Prakrit languagespro Provencal, Old (to 1500)pus ps Pushtoque qu Quechuaroh rm Rhaeto-Romanceraj Rajasthanirar Rarotonganroa Romance (Other)ron/rum ro Romanianrom Romanyrun rn Rundirus ru Russiansal Salishan languagessam Samaritan Aramaicsmi Sami languagessmo sm Samoansad Sandawesag sg Sangosan sa Sanskritsrd Sardiniansco Scotssel Selkupsem Semitic (Other) sr Serbianscr sh Serbo-Croatiansrr Serershn Shansna sn Shonasid Sidamobla Siksikasnd sd Sindhisin si Singhalesesit Sino-Tibetan (Other)sio Siouan languagessla Slavic (Other)ssw ss Siswantslk/slo sk Slovakslv sl Sloveniansog Sogdiansom so Somalison Songhaiwen Sorbian languagesnso Sotho, Northernsot st Sotho, Southernsai South American Indian (Other)esl/spa es Spanishsuk Sukumasux Sumeriansun su Sudanesesus Sususwa sw Swahilissw Swazisve/swe sv Swedishsyr Syriactgl tl Tagalogtah Tahitiantgk tg Tajiktmh Tamashektam ta Tamiltat tt Tatartel te Teluguter Terenotha th Thaibod/tib bo Tibetantig Tigretir ti Tigrinyatem Timnetiv Tivitli Tlingittog to Tonga (Nyasa)ton Tonga (Tonga Islands)tru Truktsi Tsimshiantso ts Tsongatsn tn Tswanatum Tumbukatur tr Turkishota Turkish, Ottoman (1500 - 1928)tuk tk Turkmentyv Tuviniantwi tw Twiuga Ugariticuig ug Uighurukr uk Ukrainianumb Umbunduund Undeterminedurd ur Urduuzb uz Uzbekvai Vaiven Vendavie vi Vietnamesevol vo Volapükvot Voticwak Wakashan languageswal Walamowar Waraywas Washocym/wel cy Welshwol wo Wolofxho xh Xhosasah Yakutyao Yaoyap Yapyid yi Yiddishyor yo Yorubazap Zapoteczen Zenagazha za Zhuangzul zu Zuluzun Zuni'! !
!ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 7/1/2004 18:07'!
readISOLanguagesFrom: stream "ISOLanguageDefinition readISOLanguagesFrom: ISOLanguageDefinition isoLanguages readStream " | languages language code3 index line | languages := Dictionary new. [stream atEnd or: [(line := stream nextLine readStream) atEnd]] whileFalse: [ language := ISOLanguageDefinition new. code3 := line upTo: Character tab. (index := code3 indexOf: $/) > 0 ifTrue: [ language iso3: (code3 copyFrom: 1 to: index-1). language iso3Alternate: (code3 copyFrom: index+1 to: code3 size)] ifFalse: [language iso3: code3]. language iso2: (line upTo: Character tab); language: line upToEnd. languages at: language iso3 put: language]. ^languages! !
!Locale methodsFor: 'accessing' stamp: 'mir 8/31/2005 17:03'!
determineLocale self localeID: self determineLocaleID! !
!Locale methodsFor: 'accessing' stamp: 'mir 8/31/2005 16:32'!
determineLocaleID "Locale current determineLocaleID" | langCode isoLang countryCode isoCountry | langCode := self fetchISO2Language. isoLang := langCode ifNil: [^self localeID] ifNotNil: [langCode]. countryCode := self primCountry. isoCountry := countryCode ifNil: [^LocaleID isoLanguage: isoLang] ifNotNil: [countryCode]. ^LocaleID isoLanguage: isoLang isoCountry: isoCountry! !
!Locale methodsFor: 'private' stamp: 'StephaneDucasse 5/28/2011 13:45'!
fetchISO2Language "Locale current fetchISO2Language" | lang isoLang | lang := self primLanguage. lang ifNil: [^nil]. lang := lang copyUpTo: 0 asCharacter. lang size = 2 ifTrue: [^lang]. isoLang := ISOLanguageDefinition iso3LanguageDefinition: lang. ^isoLang ifNil: [nil] ifNotNil: [isoLang iso2]! !
!Locale methodsFor: 'accessing' stamp: 'nk 8/31/2004 09:39'!
isoCountry ^self localeID isoCountry! !
!Locale methodsFor: 'accessing' stamp: 'nk 8/31/2004 09:39'!
isoLanguage ^self localeID isoLanguage! !
!Locale methodsFor: 'accessing' stamp: 'mir 7/15/2004 12:41'!
isoLocale "<language>-<country>" ^self isoCountry ifNil: [self isoLanguage] ifNotNil: [self isoLanguage , '-' , self isoCountry]! !
!Locale methodsFor: 'accessing' stamp: 'mir 7/15/2004 15:52'!
languageEnvironment ^LanguageEnvironment localeID: self localeID! !
!Locale methodsFor: 'accessing' stamp: 'mir 7/15/2004 14:55'!
localeID ^id! !
!Locale methodsFor: 'accessing' stamp: 'mir 7/15/2004 14:55'!
localeID: anID id := anID! !
!Locale methodsFor: 'system primitives' stamp: 'jannik.laval 2/4/2010 15:09'!
primCountry "Returns string with country tag according to ISO 639" <primitive: 'primitiveCountry' module: 'LocalePlugin'> ^'FR'! !
!Locale methodsFor: 'system primitives' stamp: 'tpr 6/1/2005 18:45'!
primCurrencyNotation "Returns boolean if symbol is pre- (true) or post-fix (false)" <primitive: 'primitiveCurrencyNotation' module: 'LocalePlugin'> ^true! !
!Locale methodsFor: 'system primitives' stamp: 'tpr 6/1/2005 18:47'!
primCurrencySymbol "Returns string with currency symbol" <primitive: 'primitiveCurrencySymbol' module:'LocalePlugin'> ^'$'! !
!Locale methodsFor: 'system primitives' stamp: 'tpr 6/1/2005 18:48'!
primDST "Returns boolean if DST (daylight saving time) is active or not" <primitive:'primitiveDaylightSavings' module: 'LocalePlugin'> ^false! !
!Locale methodsFor: 'system primitives' stamp: 'tpr 6/2/2005 13:42'!
primDecimalSymbol "Returns string with e.g. '.' or ','" <primitive:'primitiveDecimalSymbol' module: 'LocalePlugin'> ^'.'! !
!Locale methodsFor: 'system primitives' stamp: 'tpr 6/2/2005 13:42'!
primDigitGrouping "Returns string with e.g. '.' or ',' (thousands etc)" <primitive:'primitiveDigitGroupingSymbol' module: 'LocalePlugin'> ^','! !
!Locale methodsFor: 'system primitives' stamp: 'jannik.laval 2/4/2010 15:07'!
primLanguage "returns string with language tag according to ISO 639" <primitive:'primitiveLanguage' module: 'LocalePlugin'> ^'en'! !
!Locale methodsFor: 'system primitives' stamp: 'jannik.laval 2/4/2010 15:09'!
primLongDateFormat "Returns the long date format d day, m month, y year, double symbol is null padded, single not padded (m=6, mm=06) dddd weekday mmmm month name" <primitive:'primitiveLongDateFormat' module: 'LocalePlugin'> ^'dddd, mmmm d, yyyy'! !
!Locale methodsFor: 'system primitives' stamp: 'tpr 6/2/2005 13:43'!
primMeasurement "Returns boolean denoting metric(true) or imperial(false)." <primitive:'primitiveMeasurementMetric' module: 'LocalePlugin'> ^true! !
!Locale methodsFor: 'system primitives' stamp: 'jannik.laval 2/4/2010 15:11'!
primShortDateFormat "Returns the short date format d day, m month, y year, double symbol is null padded, single not padded (m=6, mm=06) dddd weekday mmmm month name" <primitive:'primitiveShortDateFormat' module: 'LocalePlugin'> ^'m/d/yy'! !
!Locale methodsFor: 'system primitives' stamp: 'jannik.laval 2/4/2010 15:11'!
primTimeFormat "Returns string time format Format is made up of h hour (h 12, H 24), m minute, s seconds, x (am/pm String) double symbol is null padded, single not padded (h=6, hh=06)" <primitive:'primitiveTimeFormat' module: 'LocalePlugin'> ^'h:mmx'! !
!Locale methodsFor: 'system primitives' stamp: 'jannik.laval 2/4/2010 15:08'!
primTimezone "The offset from UTC in minutes, with positive offsets being towards the east. (San Francisco is in UTC -07*60 and Paris is in UTC +02*60 (daylight savings is not in effect)." <primitive:'primitiveTimezoneOffset' module: 'LocalePlugin'> ^0! !
!Locale methodsFor: 'system primitives' stamp: 'tpr 6/2/2005 13:44'!
primVMOffsetToUTC "Returns the offset in minutes between the VM and UTC. If the VM does not support UTC times, this is 0. Also gives us backward compatibility with old VMs as the primitive will fail and we then can return 0." <primitive:'primitiveVMOffsetToUTC' module: 'LocalePlugin'> ^0! !
!Locale methodsFor: 'accessing' stamp: 'tak 8/4/2005 15:18'!
printOn: aStream super printOn: aStream. aStream nextPutAll: '(' , id printString , ')'! !
!Locale class methodsFor: 'settings' stamp: 'AlainPlantec 12/11/2009 10:59'!
activated ^ Activated ifNil: [Activated := false]! !
!Locale class methodsFor: 'settings' stamp: 'AlainPlantec 12/11/2009 10:59'!
activated: aBoolean Activated := aBoolean! !
!Locale class methodsFor: 'notification' stamp: 'mir 6/30/2004 16:15'!
addLocalChangedListener: anObjectOrClass self localeChangedListeners add: anObjectOrClass! !
!Locale class methodsFor: 'accessing' stamp: 'mir 8/31/2005 17:36'!
current "Current := nil" Current ifNil: [ Current := self determineCurrentLocale. "Transcript show: 'Current locale: ' , Current localeID asString; cr"]. ^Current! !
!Locale class methodsFor: 'accessing' stamp: 'yo 7/28/2004 20:32'!
currentPlatform "CurrentPlatform := nil" CurrentPlatform ifNil: [CurrentPlatform := self determineCurrentLocale]. ^CurrentPlatform! !
!Locale class methodsFor: 'accessing' stamp: 'yo 7/28/2004 20:39'!
currentPlatform: locale CurrentPlatform := locale. LanguageEnvironment startUp.! !
!Locale class methodsFor: 'accessing' stamp: 'tak 10/18/2005 22:33'!
currentPlatform: locale during: aBlock "Alter current language platform during a block" | backupPlatform | backupPlatform := self currentPlatform. [self currentPlatform: locale. aBlock value] ensure: [self currentPlatform: backupPlatform]! !
!Locale class methodsFor: 'platform specific' stamp: 'simon.denier 6/11/2010 17:35'!
defaultEncodingName: languageSymbol | encodings platformName osVersion | platformName := OSPlatform platformName. osVersion := OSPlatform osVersion. encodings := self platformEncodings at: languageSymbol ifAbsent: [self platformEncodings at: #default]. encodings at: platformName ifPresent: [:encoding | ^encoding]. encodings at: platformName , ' ' , osVersion ifPresent: [:encoding | ^encoding]. ^encodings at: #default! !
!Locale class methodsFor: 'private' stamp: 'mir 7/28/2005 00:24'!
determineCurrentLocale "For now just return the default locale. A smarter way would be to determine the current platforms default locale." "Locale determineCurrentLocale" ^self new determineLocale! !
!Locale class methodsFor: 'private' stamp: 'mir 7/15/2004 19:44'!
initKnownLocales | locales | locales := Dictionary new. "Init the locales for which we have translations" NaturalLanguageTranslator availableLanguageLocaleIDs do: [:id | locales at: id put: (Locale new localeID: id)]. ^locales! !
!Locale class methodsFor: 'initialization' stamp: 'AlainPlantec 1/5/2010 12:24'!
initialize "Locale initialize" Smalltalk addToStartUpList: Locale.! !
!Locale class methodsFor: 'initialization' stamp: 'MarcusDenker 1/24/2010 11:07'!
initializePlatformEncodings "Locale initializePlatformEncodings" | platform | PlatformEncodings ifNil: [ PlatformEncodings := Dictionary new ]. platform := PlatformEncodings at: 'default' ifAbsentPut: Dictionary new. platform at: 'default' put: 'iso8859-1'; at: 'Win32 CE' put: 'utf-8'. platform := PlatformEncodings at: 'ja' ifAbsentPut: Dictionary new. platform at: 'default' put: 'shift-jis'; at: 'unix' put: 'euc-jp'; at: 'Win32 CE' put: 'utf-8'. platform := PlatformEncodings at: 'ko' ifAbsentPut: Dictionary new. platform at: 'default' put: 'euc-kr'; at: 'Win32 CE' put: 'utf-8'. platform := PlatformEncodings at: 'zh' ifAbsentPut: Dictionary new. platform at: 'default' put: 'gb2312'; at: 'unix' put: 'euc-cn'; at: 'Win32 CE' put: 'utf-8'.! !
!Locale class methodsFor: 'accessing' stamp: 'mir 7/15/2004 14:20'!
isoLanguage: isoLanguage ^self isoLanguage: isoLanguage isoCountry: nil! !
!Locale class methodsFor: 'accessing' stamp: 'mir 7/15/2004 14:31'!
isoLanguage: isoLanguage isoCountry: isoCountry ^self localeID: (LocaleID isoLanguage: isoLanguage isoCountry: isoCountry)! !
!Locale class methodsFor: 'accessing' stamp: 'mir 7/15/2004 12:42'!
isoLocale: aString ! !
!Locale class methodsFor: 'private' stamp: 'mir 7/15/2004 16:44'!
knownLocales "KnownLocales := nil" ^KnownLocales ifNil: [KnownLocales := self initKnownLocales]! !
!Locale class methodsFor: 'accessing' stamp: 'mir 7/13/2004 00:24'!
languageSymbol: languageSymbol "Locale languageSymbol: #Deutsch" ^self isoLanguage: (LanguageSymbols at: languageSymbol)! !
!Locale class methodsFor: 'notification' stamp: 'MarcusDenker 3/24/2011 16:36'!
localeChanged! !
!Locale class methodsFor: 'notification' stamp: 'mir 6/30/2004 16:15'!
localeChangedListeners ^LocaleChangeListeners ifNil: [LocaleChangeListeners := OrderedCollection new]! !
!Locale class methodsFor: 'accessing' stamp: 'mir 7/15/2004 14:30'!
localeID: id ^self knownLocales at: id ifAbsentPut: [Locale new localeID: id]! !
!Locale class methodsFor: 'initialization' stamp: 'nk 8/29/2004 13:20'!
platformEncodings PlatformEncodings isEmptyOrNil ifTrue: [ self initializePlatformEncodings ]. ^PlatformEncodings! !
!Locale class methodsFor: 'system startup' stamp: 'jannik.laval 2/4/2010 15:14'!
startUp: resuming | newID | resuming ifFalse: [^self]. DateAndTime localTimeZone: (TimeZone offset: (Duration minutes: self current primTimezone) name: 'Local Time' abbreviation: 'LT'). (self activated) ifTrue: [ newID := self current determineLocaleID. newID ~= LocaleID current ifTrue: [self switchToID: newID]]! !
!Locale class methodsFor: 'accessing' stamp: 'HilaireFernandes 5/6/2010 21:31'!
stringForLanguageNameIs: localeID "Answer a string for a menu determining whether the given symbol is the project's natural language" ^ (self current localeID = localeID ifTrue: ['<yes>'] ifFalse: ['<no>']) , localeID displayLanguage! !
!Locale class methodsFor: 'accessing' stamp: 'tak 8/4/2005 16:30'!
switchTo: locale "Locale switchTo: Locale isoLanguage: 'de'" Current localeID = locale localeID ifFalse: [Current := locale. CurrentPlatform := locale. self localeChanged]! !
!Locale class methodsFor: 'accessing' stamp: 'mir 7/15/2004 19:07'!
switchToID: localeID "Locale switchToID: (LocaleID isoLanguage: 'de') " self switchTo: (Locale localeID: localeID)! !
!LocaleID methodsFor: 'comparing' stamp: 'mir 7/15/2004 14:23'!
= anotherObject self class == anotherObject class ifFalse: [^false]. ^self isoLanguage = anotherObject isoLanguage and: [self isoCountry = anotherObject isoCountry]! !
!LocaleID methodsFor: 'accessing' stamp: 'mir 9/1/2005 14:17'!
displayCountry ^(ISOLanguageDefinition iso2Countries at: self isoCountry asUppercase ifAbsent: [ self isoCountry ]) ! !
!LocaleID methodsFor: 'accessing' stamp: 'tak 3/23/2006 12:26'!
displayLanguage | language | language := (ISOLanguageDefinition iso2LanguageTable at: self isoLanguage ifAbsent: [^ self isoLanguage]) language. ^ self isoCountry ifNil: [language] ifNotNil: [language , ' (' , self displayCountry , ')']! !
!LocaleID methodsFor: 'testing' stamp: 'mir 7/15/2004 14:34'!
hasParent ^self isoCountry notNil! !
!LocaleID methodsFor: 'comparing' stamp: 'mir 7/15/2004 14:23'!
hash ^self isoLanguage hash bitXor: self isoCountry hash! !
!LocaleID methodsFor: 'accessing' stamp: 'mir 7/15/2004 12:43'!
isoCountry ^isoCountry! !
!LocaleID methodsFor: 'accessing' stamp: 'mir 7/15/2004 12:43'!
isoLanguage ^isoLanguage! !
!LocaleID methodsFor: 'initialize' stamp: 'mir 7/15/2004 12:44'!
isoLanguage: langString isoCountry: countryStringOrNil isoLanguage := langString. isoCountry := countryStringOrNil! !
!LocaleID methodsFor: 'accessing' stamp: 'mir 7/21/2004 19:17'!
isoString ^self asString! !
!LocaleID methodsFor: 'accessing' stamp: 'mir 7/15/2004 14:34'!
parent ^self class isoLanguage: self isoLanguage! !
!LocaleID methodsFor: 'printing' stamp: 'tak 8/6/2007 12:16'!
posixName "(LocaleID isoString: 'es-MX') posixName" "(LocaleID isoString: 'es') posixName" "language[_territory]" ^ self isoCountry ifNil: [self isoLanguage] ifNotNil: [self isoLanguage , '_' , self isoCountry]! !
!LocaleID methodsFor: 'printing' stamp: 'mir 7/15/2004 12:45'!
printOn: stream "<language>-<country>" stream nextPutAll: self isoLanguage. self isoCountry ifNotNil: [stream nextPut: $-; nextPutAll: self isoCountry]! !
!LocaleID methodsFor: 'printing' stamp: 'tak 11/15/2004 12:45'!
storeOn: aStream aStream nextPut: $(. aStream nextPutAll: self class name. aStream nextPutAll: ' isoString: '. aStream nextPutAll: '''' , self printString , ''''. aStream nextPut: $).! !
!LocaleID methodsFor: 'accessing' stamp: 'HilaireFernandes 5/6/2010 21:30'!
translator ^ NaturalLanguageTranslator localeID: self ! !
!LocaleID class methodsFor: 'accessing' stamp: 'mir 7/15/2004 15:09'!
current ^Locale current localeID! !
!LocaleID class methodsFor: 'instance creation' stamp: 'mir 7/15/2004 14:35'!
isoLanguage: langString ^self isoLanguage: langString isoCountry: nil! !
!LocaleID class methodsFor: 'instance creation' stamp: 'mir 7/15/2004 12:46'!
isoLanguage: langString isoCountry: countryStringOrNil ^self new isoLanguage: langString isoCountry: countryStringOrNil! !
!LocaleID class methodsFor: 'instance creation' stamp: 'mir 7/21/2004 13:59'!
isoString: isoString "Parse the isoString (<language>-<country>) into its components and return the matching LocaleID" "LocaleID isoString: 'en' " "LocaleID isoString: 'en-us' " | parts language country | parts := isoString findTokens: #($- ). language := parts first. parts size > 1 ifTrue: [country := parts second]. ^self isoLanguage: language isoCountry: country! !
!LocaleID class methodsFor: 'instance creation' stamp: 'HilaireFernandes 4/30/2010 18:00'!
posixName: aString ^ self isoString: (aString copyReplaceAll: '_' with: '-')! !
!LocaleID class methodsFor: 'accessing' stamp: 'bf 9/26/2007 16:24'!
previous ^Locale previous localeID! !
!NaturalLanguageFormTranslator methodsFor: 'accessing' stamp: 'yo 1/13/2005 11:15'!
generics ^generics ifNil: [generics := Dictionary new]! !
!NaturalLanguageFormTranslator methodsFor: 'accessing' stamp: 'yo 1/13/2005 11:27'!
localeID ^id! !
!NaturalLanguageFormTranslator methodsFor: 'accessing' stamp: 'yo 1/13/2005 11:26'!
localeID: anID id := anID! !
!NaturalLanguageFormTranslator methodsFor: 'accessing' stamp: 'yo 1/13/2005 11:17'!
name: formName form: translatedForm self generics at: formName put: translatedForm.! !
!NaturalLanguageFormTranslator methodsFor: 'i/o' stamp: 'yo 1/13/2005 14:02'!
saveFormsOn: aStream | rr | rr := ReferenceStream on: aStream. rr nextPut: {id isoString. generics}. rr close.! !
!NaturalLanguageFormTranslator methodsFor: 'utilities' stamp: 'yo 1/13/2005 11:35'!
translate: aString ^ (self generics at: aString ifAbsent: [nil]) deepCopy. "Do you like to write 'form ifNotNil: [form deepCopy]'?"! !
!NaturalLanguageFormTranslator class methodsFor: 'accessing' stamp: 'yo 1/13/2005 11:13'!
cachedTranslations "CachedTranslations := nil" ^CachedTranslations ifNil: [CachedTranslations := Dictionary new]! !
!NaturalLanguageFormTranslator class methodsFor: 'cleanup' stamp: 'StephaneDucasse 3/9/2010 22:11'!
cleanUp "Flush caches" CachedTranslations := nil! !
!NaturalLanguageFormTranslator class methodsFor: 'accessing' stamp: 'yo 1/13/2005 11:13'!
isoLanguage: isoLanguage "Return the generic language translator as there is no information about the country code" ^self isoLanguage: isoLanguage isoCountry: nil! !
!NaturalLanguageFormTranslator class methodsFor: 'accessing' stamp: 'yo 1/13/2005 11:13'!
isoLanguage: isoLanguage isoCountry: isoCountry ^self localeID: (LocaleID isoLanguage: isoLanguage isoCountry: isoCountry)! !
!NaturalLanguageFormTranslator class methodsFor: 'i/o' stamp: 'StephaneDucasse 3/9/2010 22:10'!
loadFormsFrom: aStream | rr pair inst | rr := ReferenceStream on: aStream. pair := rr next. inst := self localeID: (LocaleID isoString: pair first). pair second associationsDo: [:assoc | inst name: assoc key form: assoc value]. ^ inst.! !
!NaturalLanguageFormTranslator class methodsFor: 'accessing' stamp: 'yo 1/13/2005 11:13'!
localeID: localeID ^ self cachedTranslations at: localeID ifAbsentPut: [self new localeID: localeID]! !
!NaturalLanguageTranslator class methodsFor: 'cleanup' stamp: 'MarcusDenker 4/22/2011 10:34'!
cleanUp AllKnownPhrases := nil! !
!NaturalLanguageTranslator class methodsFor: 'translate' stamp: 'HilaireFernandes 5/13/2010 11:43'!
translate: aString ^ aString! !
!NaturalLanguageTranslator class methodsFor: 'translate' stamp: 'HilaireFernandes 5/13/2010 11:43'!
translate: aString toLocale: localeID ^ aString! !
ISOLanguageDefinition initialize!
Locale initialize!