about translations

Jeroen van Hilst jeroen at keizerrijk.net
Fri Mar 3 21:00:30 UTC 2006


Alberto,

> To load them, save them on disk, open a vanilla 3.8 image, take a Filelist
> from the tools flap and "install" them in order.
>

Ive tried this in a 3.8 basic and 3.9 image. The sets both load without
errors. However,
after loading the 2nd changeset the system gets unworkable sluggish - so i
have to bail out and throw that image away.
After loading only 1st changeset, the Languagetranslator seems to work (with
new save button) though.

    - Jeroen



"Alberto Berti" <alberto at metapensiero.it> wrote in message
news:440714AA.7010408 at metapensiero.it...
> Jeroen van Hilst wrote:
> > Best Alberto,
> >
> > Im a squeak newbie too ...
> >
> > I wholehartedly agree with your post. I also have tried to (start) with
> > translating to my native language (dutch) so squeak
> > would be more accessable to my kids, but i have not come very far.
> >
> > Ik think the NaturalLanguageTranslator/Editor in images 3.7 - 3.9 is
broken.
>
> it not seems so to me. There are some glitches though.
>
> > And doing the translation with the Editor is not very handy process...
(no
> > offense).
> >
>
> yes, it's true, a fillInTheBlank isn't really so comfortable, especially
> for long sentences.
> I must say however that the Small-Land image is in a much better shape
from
> the point of translation support. Also the different and much more
readable
>   font it uses by default helps.
>
> > Since squeak and Smalltalk are still mazes to me, i havent found out how
to
> > work with this.
> >
> > If you know ways to make this process better (gettext method sounds very
> > good), i would be glad to help / assist in any way i can.
>
> I've made some other steps... :)
> I've prepared two changesets with changes coming from the SqueakLand-dev
> image and from the SmallLand's one.
>
> To load them, save them on disk, open a vanilla 3.8 image, take a Filelist
> from the tools flap and "install" them in order.
>
> If all goes well, you should be able to open a LanguageEditor which let
you
> insert a new LocaleID via the "new" button (just like the Squeakland-dev
> image) and export/import translation to/from gettext format using the
> "gettext" button backported from the SmallLand image.
>
> Tell me how it work.
> Still no news on how to "package" translations, but it's not a so urgent
> question if we have gettext.
>
> Please pay attention that this is my first try at changeset preparing:) So
> there can be mistakes and bugs. But it seems to do its job
>
> It seems that there are still some encoding problems on the exported file,
> but it may be a problem of my platform.
>
> I've started doing some translation.
>
> It seems that when a LaguageEditor is open now the execution slows down..
i
> don't know if it will happen also to you, let me know. As soon as you
close
> the LanguageEditor, the slow down ends..
>
> Maybe someone with better insights can review my changesets?
>
> >>[Is] there is a way to track sources of such a widely
> >>intersring topic like traslations in consitent or affordable way? do you
> >>publish your sources somewhere guys?
> >
> >
> > NOTE: this is all positve critisism - i love squeak and admire all
tricks
> > you guys perfom... ;)
> >
>
> It wants to be positive also from me, but sadly no one answered :-/
>
>
> cheers,
>
> Alberto
>


----------------------------------------------------------------------------
----


> 'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 2 March
2006 at 4:13:29 pm'!
> "Change Set: nihongo7Language
> Date: 22 July 2005
> Author: Takashi Yamamiya, Noose Toru, and Yoshiki Ohshima
>
> The changes related to language features.  These are:
>
> * LanguageEditor and NaturalLanguageTranslator for better saving and
usability.
> * Better multi byte true type font handling with project saving.
> * JapaneseEnvironment and MultiByteBinaryOrTextStream default changes.
> * SecurityManager knows the interpreted path name.
>
>  "!
>
> Object subclass: #ISOLanguageDefinition
> instanceVariableNames: 'iso3 iso2 iso3Alternate language '
> classVariableNames: 'ISO2Table ISO3Table ISOCountries ISO3Countries
ISO2Countries '
> poolDictionaries: ''
> category: 'System-Localization'!
> Object subclass: #LanguageEnvironment
> instanceVariableNames: 'id translator '
> classVariableNames: 'ClipboardInterpreterClass Current
FileNameConverterClass InputInterpreterClass KnownEnvironments
SystemConverterClass '
> poolDictionaries: ''
> category: 'Multilingual-Languages'!
>
> !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 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: 'private' stamp: 'mir 9/1/2005
14:18'!
> iso2Countries
> "ISOLanguageDefinition iso2Countries"
> "ISO2Countries := nil. ISO3Countries := nil"
>
> ISO2Countries ifNil: [self initISOCountries].
> ^ISO2Countries! !
>
> !ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 9/1/2005
13:57'!
> iso3166Codes
> "http://www.unicode.org/onlinedat/countries.html"
>
> ^'Ã.LAND ISLANDS
> AX
>
>
> Â
> Â
> Â
> Â
> AFGHANISTAN
> AF
> AFG
> 004
> Â
> Â
> Â
> Â
> ALBANIA
> AL
> ALB
> 008
> CTRY_ALBANIA
> 355
> Â
> Â
> ALGERIA
> DZ
> DZA
> 012
> CTRY_ALGERIA
> 213
> verArabic
> 16
> AMERICAN SAMOA
> AS
> ASM
> 016
> Â
> Â
> Â
> Â
> ANDORRA
> AD
> AND
> 020
> Â
> Â
> Â
> Â
> ANGOLA
> AO
> AGO
> 024
> Â
> Â
> Â
> Â
> ANGUILLA
> AI
> AIA
> 660
> Â
> Â
> Â
> Â
> ANTARCTICA
> AQ
> ATA
> 010
> Â
> Â
> Â
> Â
> ANTIGUA AND BARBUDA
> AG
> ATG
> 028
> Â
> Â
> Â
> Â
> ARGENTINA
> AR
> ARG
> 032
> CTRY_ARGENTINA
> 54
> Â
> Â
> ARMENIA
> AM
> ARM
> 051
> CTRY_ARMENIA
> 374
> verArmenian
> 84
> ARUBA
> AW
> ABW
> 533
> Â
> Â
> Â
> Â
> AUSTRALIA
> AU
> AUS
> 036
> CTRY_AUSTRALIA
> 61
> verAustralia
> 15
> AUSTRIA
> AT
> AUT
> 040
> CTRY_AUSTRIA
> 43
> verAustria
> 92
> AZERBAIJAN
> AZ
> AZE
> 031
> CTRY_AZERBAIJAN
> 994
> Â
> Â
> BAHAMAS
> BS
> BHS
> 044
> Â
> Â
> Â
> Â
> BAHRAIN
> BH
> BHR
> 048
> CTRY_BAHRAIN
> 973
> Â
> Â
> BANGLADESH
> BD
> BGD
> 050
> Â
> Â
> verBengali
> 60
> BARBADOS
> BB
> BRB
> 052
> Â
> Â
> Â
> Â
> BELARUS
> BY
> BLR
> 112
> CTRY_BELARUS
> 375
> Â
> Â
> BELGIUM
> BE
> BEL
> 056
> CTRY_BELGIUM
> 32
> verFrBelgium, verFlemish
> 98
> BELIZE
> BZ
> BLZ
> 084
> CTRY_BELIZE
> 501
> Â
> Â
> BENIN
> BJ
> BEN
> 204
> Â
> Â
> Â
> Â
> BERMUDA
> BM
> BMU
> 060
> Â
> Â
> Â
> Â
> BHUTAN
> BT
> BTN
> 064
> Â
> Â
> verBhutan
> 83
> BOLIVIA
> BO
> BOL
> 068
> CTRY_BOLIVIA
> 591
> Â
> Â
> BOSNIA AND HERZEGOVINA
> BA
> BIH
> 070
> Â
> Â
> Â
> Â
> BOTSWANA
> BW
> BWA
> 072
> Â
> Â
> Â
> Â
> BOUVET ISLAND
> BV
> BVT
> 074
> Â
> Â
> Â
> Â
> BRAZIL
> BR
> BRA
> 076
> CTRY_BRAZIL
> 55
> verBrazil
> 71
> BRITISH INDIAN OCEAN TERRITORY
> IO
> IOT
> 086
> Â
> Â
> Â
> Â
> BRUNEI DARUSSALAM
> BN
> BRN
> 096
> CTRY_BRUNEI_DARUSSALAM
> 673
> Â
> Â
> BULGARIA
> BG
> BGR
> 100
> CTRY_BULGARIA
> 359
> verBulgariaÂ
> 72
> BURKINA FASO
> BF
> BFA
> 854
> Â
> Â
> Â
> Â
> BURUNDI
> BI
> BDI
> 108
> Â
> Â
> Â
> Â
> CAMBODIA
> KH
> KHM
> 116
> Â
> Â
> Â
> Â
> CAMEROON
> CM
> CMR
> 120
> Â
> Â
> Â
> Â
> CANADA
> CA
> CAN
> 124
> CTRY_CANADA
> 2
> verFrCanada, verEndCanada
> 82
> CAPE VERDE
> CV
> CPV
> 132
> Â
> Â
> Â
> Â
> CAYMAN ISLANDS
> KY
> CYM
> 136
> Â
> Â
> Â
> Â
> CENTRAL AFRICAN REPUBLIC
> CF
> CAF
> 140
> Â
> Â
> Â
> Â
> CHAD
> TD
> TCD
> 148
> Â
> Â
> Â
> Â
> CHILE
> CL
> CHL
> 152
> CTRY_CHILE
> 56
> Â
> Â
> CHINA
> CN
> CHN
> 156
> CTRY_PRCHINA
> 86
> verChina
> 52
> CHRISTMAS ISLAND
> CX
> CXR
> 162
> Â
> Â
> Â
> Â
> COCOS (KEELING) ISLANDS
> CC
> CCK
> 166
> Â
> Â
> Â
> Â
> COLOMBIA
> CO
> COL
> 170
> CTRY_COLOMBIA
> 57
> Â
> Â
> COMOROS
> KM
> COM
> 174
> Â
> Â
> Â
> Â
> CONGO
> CG
> COG
> 178
> Â
> Â
> Â
> Â
> CONGO, THE DEMOCRATIC REPUBLIC OF THE
> CD
>
>
> Â
> Â
> Â
> Â
> COOK ISLANDS
> CK
> COK
> 184
> Â
> Â
> Â
> Â
> COSTA RICA
> CR
> CRI
> 188
> CTRY_COSTA_RICA
> 506
> Â
> Â
> COTE D''IVOIRE
> CI
> CIV
> 384
> Â
> Â
> Â
> Â
> CROATIA (local name: Hrvatska)
> HR
> HRV
> 191
> CTRY_CROATIA
> 385
> verCroatia, verYugoCroatian
> 68 (c), 25 (y)
> CUBA
> CU
> CUB
> 192
> Â
> Â
> Â
> Â
> CYPRUS
> CY
> CYP
> 196
> Â
> Â
> verCyprus
> 23
> CZECH REPUBLIC
> CZ
> CZE
> 203
> CTRY_CZECH
> 420
> verCzechÂ
> 56
> DENMARK
> DK
> DNK
> 208
> CTRY_DENMARK
> 45
> verDenmark(da), verFaeroeIsl(fo)
> 9(da), 47(fo)
> DJIBOUTI
> DJ
> DJI
> 262
> Â
> Â
> Â
> Â
> DOMINICA
> DM
> DMA
> 212
> Â
> Â
> Â
> Â
> DOMINICAN REPUBLIC
> DO
> DOM
> 214
> CTRY_DOMINICAN_REPUBLIC
> 1
> Â
> Â
> EAST TIMOR
> TL
> TLS
> 626
> Â
> Â
> Â
> Â
> ECUADOR
> EC
> ECU
> 218
> CTRY_ECUADOR
> 593
> Â
> Â
> EGYPT
> EG
> EGY
> 818
> CTRY_EGYPT
> 20
> verArabic
> 16
> EL SALVADOR
> SV
> SLV
> 222
> CTRY_EL_SALVADOR
> 503
> Â
> Â
> EQUATORIAL GUINEA
> GQ
> GNQ
> 226
> Â
> Â
> Â
> Â
> ERITREA
> ER
> ERI
> 232
> Â
> Â
> Â
> Â
> ESTONIA
> EE
> EST
> 233
> CTRY_ESTONIA
> 372
> verEstonia
> 44
> ETHIOPIA
> ET
> ETH
> 210
> Â
> Â
> Â
> Â
> FALKLAND ISLANDS (MALVINAS)
> FK
> FLK
> 238
> Â
> Â
> Â
> Â
> FAROE ISLANDS
> FO
> FRO
> 234
> CTRY_FAEROE_ISLANDS
> 298
> Â
> Â
> FIJI
> FJ
> FJI
> 242
> Â
> Â
> Â
> Â
> FINLAND
> FI
> FIN
> 246
> CTRY_FINLAND
> 358
> verFinland
> 17
> FRANCE
> FR
> FRA
> 250
> CTRY_FRANCE
> 33
> verFrance
> 1
> FRANCE, METROPOLITAN
> FX
> FXX
> 249
> Â
> Â
> Â
> Â
> FRENCH GUIANA
> GF
> GUF
> 254
> Â
> Â
> Â
> Â
> FRENCH POLYNESIA
> PF
> PYF
> 258
> Â
> Â
> Â
> Â
> FRENCH SOUTHERN TERRITORIES
> TF
> ATF
> 260
> Â
> Â
> Â
> Â
> GABON
> GA
> GAB
> 266
> Â
> Â
> Â
> Â
> GAMBIA
> GM
> GMB
> 270
> Â
> Â
> Â
> Â
> GEORGIA
> GE
> GEO
> 268
> CTRY_GEORGIA
> 995
> verGeorgian
> 85
> GERMANY
> DE
> DEU
> 276
> CTRY_GERMANY
> 49
> verGermany
> 3
> GHANA
> GH
> GHA
> 288
> Â
> Â
> Â
> Â
> GIBRALTAR
> GI
> GIB
> 292
> Â
> Â
> Â
> Â
> GREECE
> GR
> GRC
> 300
> CTRY_GREECE
> 30
> verGreece, verGreecePoly
> 20, 40
> GREENLAND
> GL
> GRL
> 304
> Â
> Â
> verGreenland
> 107
> GRENADA
> GD
> GRD
> 308
> Â
> Â
> Â
> Â
> GUADELOUPE
> GP
> GLP
> 312
> Â
> Â
> Â
> Â
> GUAM
> GU
> GUM
> 316
> Â
> Â
> Â
> Â
> GUATEMALA
> GT
> GTM
> 320
> CTRY_GUATEMALA
> 502
> Â
> Â
> GUINEA
> GN
> GIN
> 324
> Â
> Â
> Â
> Â
> GUINEA-BISSAU
> GW
> GNB
> 624
> Â
> Â
> Â
> Â
> GUYANA
> GY
> GUY
> 328
> Â
> Â
> Â
> Â
> HAITI
> HT
> HTI
> 332
> Â
> Â
> Â
> Â
> HEARD ISLAND & MCDONALD ISLANDS
> HM
> HMD
> 334
> Â
> Â
> Â
> Â
> HONDURAS
> HN
> HND
> 340
> CTRY_HONDURAS
> 504
> Â
> Â
> HONG KONG
> HK
> HKG
> 344
> CTRY_HONG_KONG
> 852
> Â
> Â
> HUNGARY
> HU
> HUN
> 348
> CTRY_HUNGARY
> 36
> verHungary
> 43
> ICELAND
> IS
> ISL
> 352
> CTRY_ICELAND
> 354
> verIceland
> 21
> INDIA
> IN
> IND
> 356
> CTRY_INDIA
> 91
> verIndiaHindi(hi)
> 33
> INDONESIA
> ID
> IDN
> 360
> CTRY_INDONESIA
> 62
> Â
> Â
> IRAN, ISLAMIC REPUBLIC OF
> IR
> IRN
> 364
> CTRY_IRAN
> 981
> verIran
> 48
> IRAQ
> IQ
> IRQ
> 368
> CTRY_IRAQ
> 964
> verArabic
> 16
> IRELAND
> IE
> IRL
> 372
> CTRY_IRELAND
> 353
> verIreland
> 50
> ISRAEL
> IL
> ISR
> 376
> CTRY_ISRAEL
> 972
> verIsrael
> 13
> ITALY
> IT
> ITA
> 380
> CTRY_ITALY
> 39
> verItaly
> 4
> JAMAICA
> JM
> JAM
> 388
> CTRY_JAMAICA
> 1
> Â
> Â
> JAPAN
> JP
> JPN
> 392
> CTRY_JAPAN
> 81
> verJapan
> 14
> JORDAN
> JO
> JOR
> 400
> CTRY_JORDAN
> 962
> Â
> Â
> KAZAKHSTAN
> KZ
> KAZ
> 398
> CTRY_KAZAKSTAN
> 7
> Â
> Â
> KENYA
> KE
> KEN
> 404
> CTRY_KENYA
> 254
> Â
> Â
> KIRIBATI
> KI
> KIR
> 296
> Â
> Â
> Â
> Â
> KOREA, DEMOCRATIC PEOPLE''S REPUBLIC OF
> KP
> PRK
> 408
> Â
> Â
> verKorea
> 51
> KOREA, REPUBLIC OF
> KR
> KOR
> 410
> CTRY_SOUTH_KOREA
> 82
> verKorea
> Â
> KUWAIT
> KW
> KWT
> 414
> CTRY_KUWAIT
> 965
> Â
> Â
> KYRGYZSTAN
> KG
> KGZ
> 417
> CTRY_KYRGYZSTAN
> 996
> Â
> Â
> LAO PEOPLE''S DEMOCRATIC REPUBLIC
> LA
> LAO
> 418
> Â
> Â
> Â
> Â
> LATVIA
> LV
> LVA
> 428
> CTRY_LATVIA
> 371
> verLatvia
> 45
> LEBANON
> LB
> LBN
> 422
> CTRY_LEBANON
> 961
> Â
> Â
> LESOTHO
> LS
> LSO
> 426
> Â
> Â
> Â
> Â
> LIBERIA
> LR
> LBR
> 430
> Â
> Â
> Â
> Â
> LIBYAN ARAB JAMAHIRIYA
> LY
> LBY
> 434
> CTRY_LIBYA
> 218
> verArabic
> 16
> LIECHTENSTEIN
> LI
> LIE
> 438
> CTRY_LIECHTENSTEIN
> 41
> Â
> Â
> LITHUANIA
> LT
> LTU
> 440
> CTRY_LITHUANIA
> 370
> verLithuania
> 41
> LUXEMBOURG
> LU
> LUX
> 442
> CTRY_LUXEMBOURG
> 352
> verFrBelgiumLux
> 6
> MACAU
> MO
> MAC
> 446
> CTRY_MACAU
> 853
> Â
> Â
> MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF
> MK
> MKD
> 807
> CTRY_MACEDONIA
> 389
> verMacedonian
> Â
> MADAGASCAR
> MG
> MDG
> 450
> Â
> Â
> Â
> Â
> MALAWI
> MW
> MWI
> 454
> Â
> Â
> Â
> Â
> MALAYSIA
> MY
> MYS
> 458
> CTRY_MALAYSIA
> 60
> Â
> Â
> MALDIVES
> MV
> MDV
> 462
> CTRY_MALDIVES
> 960
> Â
> Â
> MALI
> ML
> MLI
> 466
> Â
> Â
> Â
> Â
> MALTA
> MT
> MLT
> 470
> Â
> Â
> verMalta
> 22
> MARSHALL ISLANDS
> MH
> MHL
> 584
> Â
> Â
> Â
> Â
> MARTINIQUE
> MQ
> MTQ
> 474
> Â
> Â
> Â
> Â
> MAURITANIA
> MR
> MRT
> 478
> Â
> Â
> Â
> Â
> MAURITIUS
> MU
> MUS
> 480
> Â
> Â
> Â
> Â
> MAYOTTE
> YT
> MYT
> 175
> Â
> Â
> Â
> Â
> MEXICO
> MX
> MEX
> 484
> CTRY_MEXICO
> 52
> Â
> Â
> MICRONESIA, FEDERATED STATES OF
> FM
> FSM
> 583
> Â
> Â
> Â
> Â
> MOLDOVA, REPUBLIC OF
> MD
> MDA
> 498
> Â
> Â
> Â
> Â
> MONACO
> MC
> MCO
> 492
> CTRY_MONACO
> 33
> Â
> Â
> MONGOLIA
> MN
> MNG
> 496
> CTRY_MONGOLIA
> 976
> Â
> Â
> MONTSERRAT
> MS
> MSR
> 500
> Â
> Â
> Â
> Â
> MOROCCO
> MA
> MAR
> 504
> CTRY_MOROCCO
> 212
> verArabic
> 16
> MOZAMBIQUE
> MZ
> MOZ
> 508
> Â
> Â
> Â
> Â
> MYANMAR
> MM
> MMR
> 104
> Â
> Â
> Â
> Â
> NAMIBIA
> NA
> NAM
> 516
> Â
> Â
> Â
> Â
> NAURU
> NR
> NRU
> 520
> Â
> Â
> Â
> Â
> NEPAL
> NP
> NPL
> 524
> Â
> Â
> verNepal
> 106
> NETHERLANDS
> NL
> NLD
> 528
> CTRY_NETHERLANDS
> 31
> verNetherlands
> 5
> NETHERLANDS ANTILLES
> AN
> ANT
> 530
> Â
> Â
> Â
> Â
> NEW CALEDONIA
> NC
> NCL
> 540
> Â
> Â
> Â
> Â
> NEW ZEALAND
> NZ
> NZL
> 554
> CTRY_NEW_ZEALAND
> 64
> Â
> Â
> NICARAGUA
> NI
> NIC
> 558
> CTRY_NICARAGUA
> 505
> Â
> Â
> NIGER
> NE
> NER
> 562
> Â
> Â
> Â
> Â
> NIGERIA
> NG
> NGA
> 566
> Â
> Â
> Â
> Â
> NIUE
> NU
> NIU
> 570
> Â
> Â
> Â
> Â
> NORFOLK ISLAND
> NF
> NFK
> 574
> Â
> Â
> Â
> Â
> NORTHERN MARIANA ISLANDS
> MP
> MNP
> 580
> Â
> Â
> Â
> Â
> NORWAY
> NO
> NOR
> 578
> CTRY_NORWAY
> 47
> verNorway
> 12
> OMAN
> OM
> OMN
> 512
> CTRY_OMAN
> 968
> Â
> Â
> PAKISTAN
> PK
> PAK
> 586
> CTRY_PAKISTAN
> 92
> verPakistanUrdu, verPunjabi
> 34 (U), 95 (P)
> PALAU
> PW
> PLW
> 585
> Â
> Â
> Â
> Â
> PANAMA
> PA
> PAN
> 591
> CTRY_PANAMA
> 507
> Â
> Â
> PALESTINIAN TERRITORY, OCCUPIED
> PS
>
>
>
>
> Â
> Â
> PAPUA NEW GUINEA
> PG
> PNG
> 598
> Â
> Â
> Â
> Â
> PARAGUAY
> PY
> PRY
> 600
> CTRY_PARAGUAY
> 595
> Â
> Â
> PERU
> PE
> PER
> 604
> CTRY_PERU
> 51
> Â
> Â
> PHILIPPINES
> PH
> PHL
> 608
> CTRY_PHILIPPINES
> 63
> Â
> Â
> PITCAIRN
> PN
> PCN
> 612
> Â
> Â
> Â
> Â
> POLAND
> PL
> POL
> 616
> CTRY_POLAND
> 48
> verPoland
> 42
> PORTUGAL
> PT
> PRT
> 620
> CTRY_PORTUGAL
> 351
> verPortugal
> 10
> PUERTO RICO
> PR
> PRI
> 630
> CTRY_PUERTO_RICO
> 1
> Â
> Â
> QATAR
> QA
> QAT
> 634
> CTRY_QATAR
> 974
> Â
> Â
> REUNION
> RE
> REU
> 638
> Â
> Â
> Â
> Â
> ROMANIA
> RO
> ROU*
> 642
> CTRY_ROMANIA
> 40
> verRomania
> 39
> RUSSIAN FEDERATION
> RU
> RUS
> 643
> CTRY_RUSSIA
> 7
> verRussia
> 49
> RWANDA
> RW
> RWA
> 646
> Â
> Â
> Â
> Â
> SAINT KITTS AND NEVIS
> KN
> KNA
> 659
> Â
> Â
> Â
> Â
> SAINT LUCIA
> LC
> LCA
> 662
> Â
> Â
> Â
> Â
> SAINT VINCENT AND THE GRENADINES
> VC
> VCT
> 670
> Â
> Â
> Â
> Â
> SAMOA
> WS
> WSM
> 882
> Â
> Â
> Â
> Â
> SAN MARINO
> SM
> SMR
> 674
> Â
> Â
> Â
> Â
> SAO TOME AND PRINCIPE
> ST
> STP
> 678
> Â
> Â
> Â
> Â
> SAUDI ARABIA
> SA
> SAU
> 682
> CTRY_SAUDI_ARABIA
> 966
> verArabic
> 16
> SENEGAL
> SN
> SEN
> 686
> Â
> Â
> Â
> Â
> SERBIA AND MONTENEGRO
> CS
> Â
> Â
> CTRY_SERBIA
> 381
> Â
> Â
> SEYCHELLES
> SC
> SYC
> 690
> Â
> Â
> Â
> Â
> SIERRA LEONE
> SL
> SLE
> 694
> Â
> Â
> Â
> Â
> SINGAPORE
> SG
> SGP
> 702
> CTRY_SINGAPORE
> 65
> verSingapore
> 100
> SLOVAKIA (Slovak Republic)
> SK
> SVK
> 703
> CTRY_SLOVAK
> 421
> verSlovak
> 57Â
> SLOVENIA
> SI
> SVN
> 705
> CTRY_SLOVENIA
> 386
> verSlovenian
> 66
> SOLOMON ISLANDS
> SB
> SLB
> 90
> Â
> Â
> Â
> Â
> SOMALIA
> SO
> SOM
> 706
> Â
> Â
> Â
> Â
> SOUTH AFRICA
> ZA
> ZAF
> 710
> CTRY_SOUTH_AFRICA
> 27
> Â
> Â
> SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS
> GS
>
>
>
>
> Â
> Â
> SPAIN
> ES
> ESP
> 724
> CTRY_SPAIN
> 34
> verSpain
> 8
> SRI LANKA
> LK
> LKA
> 144
> Â
> Â
> Â
> Â
> SAINT HELENA
> SH
> SHN
> 654
> Â
> Â
> Â
> Â
> SAINT PIERRE AND MIQUELON
> PM
> SPM
> 666
> Â
> Â
> Â
> Â
> SUDAN
> SD
> SDN
> 736
> Â
> Â
> Â
> Â
> SURINAME
> SR
> SUR
> 740
> Â
> Â
> Â
> Â
> SVALBARD AND JAN MAYEN ISLANDS
> SJ
> SJM
> 744
> Â
> Â
> Â
> Â
> SWAZILAND
> SZ
> SWZ
> 748
> Â
> Â
> Â
> Â
> SWEDEN
> SE
> SWE
> 752
> CTRY_SWEDEN
> 46
> verSweden
> 7
> SWITZERLAND
> CH
> CHE
> 756
> CTRY_SWITZERLAND
> 41
> verFrSwiss(fr), verGrSwiss(de)
> 18(fr), 19(de)
> SYRIAN ARAB REPUBLIC
> SY
> SYR
> 760
> CTRY_SYRIA
> 963
> Â
> Â
> TAIWAN, PROVINCE OF CHINA
> TW
> TWN
> 158
> CTRY_TAIWAN
> 886
> verTaiwan
> 53
> TAJIKISTAN
> TJ
> TJK
> 762
> Â
> Â
> Â
> Â
> TANZANIA, UNITED REPUBLIC OF
> TZ
> TZA
> 834
> Â
> Â
> Â
> Â
> TATARSTAN
>
>
> Â
> CTRY_TATARSTAN
> 7
> Â
> Â
> THAILAND
> TH
> THA
> 764
> CTRY_THAILAND
> 66
> verThailand
> 54
> TIMOR-LESTE
> TL
>
>
> Â
> Â
> Â
> Â
> TOGO
> TG
> TGO
> 768
> Â
> Â
> Â
> Â
> TOKELAU
> TK
> TKL
> 772
> Â
> Â
> Â
> Â
> TONGA
> TO
> TON
> 776
> Â
> Â
> verTonga
> 88
> TRINIDAD AND TOBAGO
> TT
> TTO
> 780
> CTRY_TRINIDAD_Y_TOBAGO
> 1
> Â
> Â
> TUNISIA
> TN
> TUN
> 788
> CTRY_TUNISIA
> 216
> verArabic
> 16
> TURKEY
> TR
> TUR
> 792
> CTRY_TURKEY
> 90
> verTurkey
> 24
> TURKMENISTAN
> TM
> TKM
> 795
> Â
> Â
> Â
> Â
> TURKS AND CAICOS ISLANDS
> TC
> TCA
> 796
> Â
> Â
> Â
> Â
> TUVALU
> TV
> TUV
> 798
> Â
> Â
> Â
> Â
> UGANDA
> UG
> UGA
> 800
> Â
> Â
> Â
> Â
> UKRAINE
> UA
> UKR
> 804
> CTRY_UKRAINE
> 380
> verUkraineÂ
> 62
> UNITED ARAB EMIRATES
> AE
> ARE
> 784
> CTRY_UAE
> 971
> Â
> Â
> UNITED KINGDOM
> GB
> GBR
> 826
> CTRY_UNITED_KINGDOM
> 44
> verBritain
> 2
> UNITED STATES
> US
> USA
> 840
> CTRY_UNITED_STATES
> 1
> verUS
> 0
> UNITED STATES MINOR OUTLYING ISLANDS
> UM
> UMI
> 581
> Â
> Â
> Â
> Â
> URUGUAY
> UY
> URY
> 858
> CTRY_URUGUAY
> 598
> Â
> Â
> UZBEKISTAN
> UZ
> UZB
> 860
> CTRY_UZBEKISTAN
> 7
> Â
> Â
> VANUATU
> VU
> VUT
> 548
> Â
> Â
> Â
> Â
> VATICAN CITY STATE (HOLY SEE)
> VA
> VAT
> 336
> Â
> Â
> Â
> Â
> VENEZUELA
> VE
> VEN
> 862
> CTRY_VENEZUELA
> 58
> Â
> Â
> VIET NAM
> VN
> VNM
> 704
> CTRY_VIET_NAM
> 84
> verVietnam
> Â
> VIRGIN ISLANDS (BRITISH)
> VG
> VGB
> 92
> Â
> Â
> Â
> Â
> VIRGIN ISLANDS (U.S.)
> VI
> VIR
> 850
> Â
> Â
> Â
> Â
> WALLIS AND FUTUNA ISLANDS
> WF
> WLF
> 876
> Â
> Â
> Â
> Â
> WESTERN SAHARA
> EH
> ESH
> 732
> Â
> Â
> Â
> Â
> YEMEN
> YE
> YEM
> 887
> CTRY_YEMEN
> 967
> Â
> Â
> YUGOSLAVIA
> YU
> YUG
> 891
> Â
> Â
> Â
> Â
> ZAIRE
> ZR
> ZAR
> 180
> Â
> Â
> Â
> Â
> ZAMBIA
> ZM
> ZMB
> 894
> Â
> Â
> Â
> Â
> ZIMBABWE
> ZW
> ZWE
> 716
> CTRY_ZIMBABWE
> 263
> Â
> Â
> '! !
>
> !ISOLanguageDefinition class methodsFor: 'private' stamp: 'mir 9/1/2005
14:18'!
> iso3Countries
> "ISOLanguageDefinition iso3Countries"
> "ISO2Countries := nil. ISO3Countries := nil"
>
> ISO3Countries ifNil: [self initISOCountries].
> ^ISO3Countries! !
>
>
> !LanguageEditor methodsFor: 'gui methods' stamp: 'yo 11/29/2005 11:20'!
> codeSelectedTranslationAsMimeString
> | keys code tmpStream s2 gzs cont |
> keys := selectedTranslations
> collect: [:key | self translations at: key].
> code := String
> streamContents: [:aStream | self translator fileOutOn: aStream keys:
keys].
>
> tmpStream _ MultiByteBinaryOrTextStream on: ''.
> tmpStream converter: UTF8TextConverter new.
> translator fileOutHeaderOn: tmpStream.
> tmpStream nextPutAll: code.
> s2 _ RWBinaryOrTextStream on: ''.
> gzs := GZipWriteStream on: s2.
> tmpStream reset.
> gzs nextPutAll: (tmpStream binary contentsOfEntireFile asString) contents.
> gzs close.
> s2 reset.
>
> cont _ String streamContents: [:strm |
> strm nextPutAll: '"Gzip+Base64 encoded translation for;'; cr.
> strm nextPutAll: '#('.
> keys do: [:each | strm  nextPutAll: '''', each, ''' '.].
> strm nextPutAll: ')"'; cr; cr.
> strm nextPutAll: 'NaturalLanguageTranslator loadForLocaleIsoString: '.
> strm nextPut: $'.
> strm nextPutAll: translator localeID isoString.
> strm nextPut: $'.
> strm nextPutAll: ' fromGzippedMimeLiteral: '.
> strm nextPut: $'.
> strm nextPutAll: (Base64MimeConverter mimeEncode: s2) contents.
> strm nextPutAll: '''.'.
> strm cr.
> ].
>
> (StringHolder new contents: cont)
> openLabel: 'exported codes in Gzip+Base64 encoding'! !
>
> !LanguageEditor methodsFor: 'gui methods' stamp: 'tak 9/14/2005 10:42'!
> newTranslations
> "private - try to apply the translations as much as possible all
> over the image"
> | result newID |
> result := FillInTheBlank request: 'New locale ID string?' initialAnswer:
Locale current determineLocaleID isoString.
> result isEmpty
> ifTrue: ["Do nothing"
> ^ self].
> newID := LocaleID isoString: result.
> NaturalLanguageTranslator
> newLocaleID: (LocaleID isoString: result).
> self class openOn: newID! !
>
> !LanguageEditor methodsFor: 'initialization - toolbar' stamp: 'AB 3/2/2006
15:55'!
> createMainToolbar
> "create a toolbar for the receiver"
> | toolbar |
> toolbar := self createRow.
> ""
> " toolbar
> addMorphBack: (self
> createUpdatingButtonWording: #debugWording
> action: #switchDebug
> help: 'Switch the debug flag')."
> toolbar addTransparentSpacerOfSize: 5 @ 0.
> ""
> toolbar
> addMorphBack: (self
> createButtonLabel: 'new'
> action: #newTranslations
> help: 'Create translations for new language.').
> toolbar
> addMorphBack: (self
> createButtonLabel: 'save'
> action: #saveToFile
> help: 'Save the translations to a file').
> toolbar
> addMorphBack: (self
> createButtonLabel: 'load'
> action: #loadFromFile
> help: 'Load the translations from a file').
> toolbar
> addMorphBack: (self
> createButtonLabel: 'merge'
> action: #mergeFromFile
> help: 'Merge the current translations with the translations in a file').
> ""
> toolbar addTransparentSpacerOfSize: 5 @ 0.
> toolbar
> addMorphBack: (self
> createButtonLabel: 'apply'
> action: #applyTranslations
> help: 'Apply the translations as much as possible.').
> ""
> toolbar addTransparentSpacerOfSize: 5 @ 0.
> toolbar
> addMorphBack: (self
> createButtonLabel: 'check translations'
> action: #check
> help: 'Check the translations and report the results.').
> toolbar
> addMorphBack: (self
> createButtonLabel: 'report'
> action: #report
> help: 'Create a report.').
> toolbar
> addMorphBack: (self
> createButtonLabel: 'gettext'
> action: #getText
> help: 'Interface with gettext.').
> ""
> ^ toolbar! !
>
>
> !LanguageEditor class methodsFor: 'instance creation' stamp: 'tak 9/7/2005
23:21'!
> on: localeID
> "answer an instance of the receiver on aLanguage"
> (NaturalLanguageTranslator availableLanguageLocaleIDs includes: localeID)
> ifFalse: [self
> error: ('Translator for {1} is not found' translated format: {localeID})].
> ^ self new
> initializeOn: (NaturalLanguageTranslator availableForLocaleID: localeID)!
!
>
> !LanguageEditor class methodsFor: 'opening' stamp: 'TN 4/8/2005 01:13'!
> openOnDefault
> "open the receiver on the default language"
> self openOn: LocaleID current! !
>
>
> !LanguageEnvironment class methodsFor: 'accessing' stamp: 'tak 9/14/2005
10:43'!
> localeID: localeID
> "LanguageEnvironment localeID: (LocaleID isoString: 'ja-kid')"
> "LanguageEnvironment localeID: (LocaleID isoString: 'xx')"
> ^ self knownEnvironments
> at: localeID
> ifAbsent: [localeID hasParent
> ifTrue: [self knownEnvironments
> at: localeID parent
> ifAbsent: [self
> localeID: (LocaleID isoLanguage: 'en')]]
> ifFalse: [self
> localeID: (LocaleID isoLanguage: 'en')]]! !
>
> !LanguageEnvironment class methodsFor: 'private' stamp: 'yo 11/29/2005
13:33'!
> initKnownEnvironments
> "LanguageEnvironment initKnownEnvironments"
>
> | env known id |
> known := Dictionary new.
> self allSubclassesDo: [:subClass |
> subClass supportedLanguages do: [:language |
> env := subClass new.
> id _ LocaleID isoString: language.
> env localeID: id.
> known at: id put: env]].
> ^known! !
>
>
> !JapaneseEnvironment class methodsFor: 'subclass responsibilities' stamp:
'tetha 7/13/2005 00:44'!
> inputInterpreterClass
> | platformName osVersion encoding |
> platformName := SmalltalkImage current platformName.
> osVersion := SmalltalkImage current getSystemAttribute: 1002.
> (platformName = 'Win32'
> and: [osVersion = 'CE'])
> ifTrue: [^ MacRomanInputInterpreter].
> platformName = 'Win32'
> ifTrue: [^ WinShiftJISInputInterpreter].
> platformName = 'Mac OS'
> ifTrue: [^ (('10*' match: SmalltalkImage current osVersion)
> and: [(SmalltalkImage current getSystemAttribute: 3) isNil])
> ifTrue: [MacUnicodeInputInterpreter]
> ifFalse: [MacShiftJISInputInterpreter]].
> platformName = 'unix'
> ifTrue: [encoding := X11Encoding encoding.
> (EUCJPTextConverter encodingNames includes: encoding)
> ifTrue: [^ UnixEUCJPInputInterpreter].
> (UTF8TextConverter encodingNames includes: encoding)
> ifTrue: [^ UnixUTF8JPInputInterpreter].
> (ShiftJISTextConverter encodingNames includes: encoding)
> ifTrue: [^ MacShiftJISInputInterpreter]].
> ^ MacRomanInputInterpreter! !
>
>
> !Locale methodsFor: 'system primitives' stamp: 'mir 8/31/2005 17:36'!
> primCountry
> "Returns string with country tag according to ISO 639"
> <primitive: 'primitiveCountry' module: 'LocalePlugin'>
> ^nil! !
>
> !Locale methodsFor: 'system primitives' stamp: 'mir 8/17/2005 15:53'!
> primLanguage
> "returns string with language tag according to ISO 639"
> <primitive:'primitiveLanguage' module: 'LocalePlugin'>
> ^nil! !
>
> !Locale methodsFor: 'accessing' stamp: 'mir 8/31/2005 17:03'!
> determineLocale
> self localeID: self determineLocaleID! !
>
> !Locale methodsFor: 'accessing' stamp: 'tak 9/8/2005 01:45'!
> determineLocaleID
> "Locale current determineLocaleID"
> | isoLang isoCountry |
> isoLang := self fetchISO2Language
> ifNil: [^ self localeID].
> isoCountry := self fetchISOCountry
> ifNil: [^ LocaleID isoLanguage: isoLang].
> ^ LocaleID isoLanguage: isoLang isoCountry: isoCountry! !
>
> !Locale methodsFor: 'private' stamp: 'mir 8/31/2005 17:36'!
> 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: 'private' stamp: 'tak 9/8/2005 01:47'!
> fetchISOCountry
> "Locale current fetchISOCountry"
> | countryCode |
> countryCode := self primCountry
> ifNil: [^ nil].
> ^ countryCode copyUpTo: 0 asCharacter! !
>
>
> !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: 'tak 9/7/2005 23:24'!
> switchTo: locale
> "Locale switchTo: (Locale isoLanguage: 'de')"
> | availableID |
> availableID := (NaturalLanguageTranslator availableForLocaleID: locale
localeID) localeID.
> Current localeID = availableID
> ifFalse: [CurrentPlatform := Current := Locale localeID: availableID.
> self localeChanged]! !
>
> !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: 'class initialization' stamp: 'mir 8/31/2005
17:00'!
> initialize
> "Locale initialize"
>
> Smalltalk addToStartUpList: Locale.
> Preferences addPreference: #useLocale
> categories: #('general') default: false
> balloonHelp: 'Use the system locale to set the system language etc at
startup'.! !
>
> !Locale class methodsFor: 'system startUp' stamp: 'tak 9/2/2005 15:06'!
> startUp: resuming
> | newID |
> resuming ifFalse: [^self].
> (Preferences valueOfFlag: #useLocale)
> ifTrue: [
> newID := self current determineLocaleID.
> newID ~= LocaleID current
> ifTrue: [self switchAndInstallFontToID: newID]]! !
>
>
> !LocaleID methodsFor: 'accessing' stamp: 'mir 9/1/2005 14:17'!
> displayCountry
> ^(ISOLanguageDefinition iso2Countries at: self isoCountry asUppercase
ifAbsent: [ self isoCountry ]) ! !
>
>
> !MultiByteBinaryOrTextStream class methodsFor: 'defaults' stamp: 'yo
2/25/2005 20:04'!
> defaultConverter
> ^ Latin1TextConverter new.
> ! !
>
>
> !NaturalLanguageTranslator methodsFor: 'translation' stamp: 'tak 9/7/2005
23:45'!
> translate: aString
> ^ self generics
> at: aString
> ifAbsent: [self class registeredPhraseFor: aString.
> self changed: #untranslated.
> self localeID hasParent
> ifTrue: [self class translate: aString to: self localeID parent]
> ifFalse: [aString]]! !
>
> !NaturalLanguageTranslator methodsFor: 'user interface' stamp: 'yo
9/9/2005 17:27'!
> fileOutHeaderOn: aStream
> aStream binary.
> UTF8TextConverter writeBOMOn: aStream.
> aStream text.
> aStream nextChunkPut: self fileOutHeader;
> cr.
> aStream timeStamp; cr.
> aStream nextPut: $!!.
> aStream nextChunkPut: '(' , self class name , ' localeID: ' , id
storeString , ')'.
> aStream cr! !
>
> !NaturalLanguageTranslator methodsFor: 'fileIn/fileOut' stamp: 'yo
2/25/2005 09:37'!
> writeAsMimeString
>
> | fileName fileStream tmpStream s2 gzs |
> tmpStream _ MultiByteBinaryOrTextStream on: ''.
> tmpStream converter: UTF8TextConverter new.
> self fileOutOn: tmpStream.
> s2 _ RWBinaryOrTextStream on: ''.
> gzs := GZipWriteStream on: s2.
> tmpStream reset.
> gzs nextPutAll: (tmpStream binary contentsOfEntireFile asString) contents.
> gzs close.
> s2 reset.
>
> fileName _ id isoString, '.translation.gz.mime'.
> fileStream _ FileStream newFileNamed: fileName.
> fileStream nextPutAll: (Base64MimeConverter mimeEncode: s2) contents.
> fileStream close.
> ! !
>
>
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'tak
9/14/2005 11:37'!
> availableForLocaleID: localeID
> "Answer available locale ID.
> If translator is not found for correct locale ID, then isoLanguage is
> attempted for the key."
> ^ self cachedTranslations
> at: localeID
> ifAbsent: [localeID hasParent
> ifTrue: [self cachedTranslations
> at: localeID parent
> ifAbsent: [self default]]
> ifFalse: [self default]]! !
>
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'tak
9/7/2005 23:08'!
> default
> "Answer translator for backstop"
> "self default translate: 'test'"
> ^ self new
> localeID: (LocaleID isoLanguage: 'en')! !
>
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'tak
9/15/2005 02:08'!
> localeID: localeID
> "For backward compatibility, see NaturalLanguageTranslator >>
fileOutHeaderOn:."
> ^ self newLocaleID: localeID! !
>
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'tak
9/7/2005 23:17'!
> newLocaleID: localeID
> ^ self cachedTranslations
> at: localeID
> ifAbsentPut: [self new localeID: localeID]! !
>
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'tak
9/8/2005 00:39'!
> removeLocaleID: localeID
> "self removeLocaleID: (LocaleID isoString: 'ja-kids')"
> ^ self cachedTranslations
> removeKey: localeID
> ifAbsent: []! !
>
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'tak
9/7/2005 21:53'!
> translate: aString to: localeID
> ^ (self availableForLocaleID: localeID)
> translate: aString! !
>
> !NaturalLanguageTranslator class methodsFor: 'class initialization' stamp:
'tak 9/8/2005 00:56'!
> startUp: resuming
> resuming
> ifFalse: [^ self].
> self loadAvailableExternalLocales! !
>
> !NaturalLanguageTranslator class methodsFor: 'file-services' stamp: 'tak
3/14/2005 15:51'!
> loadForLocaleIsoString: localeString fromGzippedMimeLiteral: mimeString
> "merge the translation from the mime literal."
> | stream localeID translator gs rbStream s currentPlatform |
> s := Base64MimeConverter mimeDecodeToBytes: mimeString readStream.
> s reset.
> gs := GZipReadStream on: s.
> rbStream := MultiByteBinaryOrTextStream with: gs contents asString.
> rbStream converter: UTF8TextConverter new.
> rbStream reset.
> localeID := LocaleID isoString: localeString.
> currentPlatform := Locale currentPlatform.
> [Locale
> currentPlatform: (Locale localeID: localeID).
> stream := ReadStream on: rbStream contents]
> ensure: [Locale currentPlatform: currentPlatform].
> translator := self localeID: localeID.
> translator loadFromStream: stream.
> LanguageEnvironment resetKnownEnvironments! !
>
> !NaturalLanguageTranslator class methodsFor: 'private loading' stamp: 'tak
9/7/2005 23:17'!
> loadTranslatorForIsoLanguage: isoLanguage isoCountry: isoCountry
> "private - load the translations from <prefs>/locale/ directory
> the procedure is to assure the existence of a translator for the
> given language/country and then load the external translations for this
translator"
>
> | translator |
> translator := self newLocaleID: (LocaleID isoLanguage: isoLanguage
isoCountry: isoCountry).
>
> self loadExternalTranslationsFor: translator! !
>
> !NaturalLanguageTranslator class methodsFor: 'private' stamp: 'mir
8/31/2005 16:55'!
> cleanUpCache
> "NaturalLanguageTranslator cleanUpCache"
>
> self cachedTranslations keys do: [:key |
> key isoLanguage size > 2 ifTrue: [self cachedTranslations removeKey:
key]]! !
>
>
> !Project methodsFor: 'language' stamp: 'mir 9/1/2005 00:37'!
> localeID
> "Answer the natural language for the project"
>
> | prev |
> ^ self projectParameterAt: #localeID
> ifAbsentPut: [
> (prev _ self previousProject)
> ifNotNil: [prev projectParameterAt: #localeID ifAbsent: [LocaleID
current]]
> ifNil: [LocaleID current]]! !
>
>
> !SecurityManager methodsFor: 'accessing' stamp: 'tak 3/15/2005 00:45'!
> primSecureUserDirectory
> <primitive: 'primitiveGetSecureUserDirectory' module: 'SecurityPlugin'>
> ^ nil! !
>
> !SecurityManager methodsFor: 'accessing' stamp: 'tak 3/15/2005 00:46'!
> secureUserDirectory
> "SecurityManager default secureUserDirectory"
> | dir |
> dir := self primSecureUserDirectory.
> ^ dir
> ifNil: [FileDirectory default pathName]
> ifNotNil: [(FilePath pathName: dir isEncoded: true) asSqueakPathName]! !
>
>
> !String methodsFor: 'translating' stamp: 'tak 9/7/2005 23:00'!
> translated
> "answer the receiver translated to the default language"
> ^ self translatedTo: LocaleID current! !
>
> !String methodsFor: 'translating' stamp: 'tak 9/7/2005 12:07'!
> translatedTo: localeID
> "answer the receiver translated to the given locale id"
> ^ NaturalLanguageTranslator translate: self to: localeID! !
>
>
> !ByteString methodsFor: 'comparing' stamp: 'tak 11/6/2005 22:38'!
> primitiveFindSubstring: key in: body startingAt: start matchTable:
matchTable
> "Answer the index in the string body at which the substring key first
occurs, at or beyond start.  The match is determined using matchTable, which
can be used to effect, eg, case-insensitive matches.  If no match is found,
zero will be returned.
>
> The algorithm below is not optimum -- it is intended to be translated to C
which will go so fast that it wont matter."
> | index |
> <primitive: 'primitiveFindSubstring' module: 'MiscPrimitivePlugin'>
> self var: #key declareC: 'unsigned char *key'.
> self var: #body declareC: 'unsigned char *body'.
> self var: #matchTable declareC: 'unsigned char *matchTable'.
>
> key size = 0 ifTrue: [^ 0].
> start to: body size - key size + 1 do:
> [:startIndex |
> index _ 1.
> [(matchTable at: (body at: startIndex+index-1) asciiValue + 1)
> = (matchTable at: (key at: index) asciiValue + 1)]
> whileTrue:
> [index = key size ifTrue: [^ startIndex].
> index _ index+1]].
> ^ 0
> "
> ' ' findSubstring: 'abc' in: 'abcdefabcd' startingAt: 1 matchTable:
CaseSensitiveOrder 1
> ' ' findSubstring: 'abc' in: 'abcdefabcd' startingAt: 2 matchTable:
CaseSensitiveOrder 7
> ' ' findSubstring: 'abc' in: 'abcdefabcd' startingAt: 8 matchTable:
CaseSensitiveOrder 0
> ' ' findSubstring: 'abc' in: 'abcdefABcd' startingAt: 2 matchTable:
CaseSensitiveOrder 0
> ' ' findSubstring: 'abc' in: 'abcdefABcd' startingAt: 2 matchTable:
CaseInsensitiveOrder 7
> "! !
>
>
> !TextStyle methodsFor: 'fonts and font indexes' stamp: 'yo 3/17/2005
11:10'!
> addNewFontSize: pointSize
> "Add a font in specified size to the array of fonts."
> | f d newArray t isSet fallbackStyle |
> fontArray first emphasis ~= 0 ifTrue: [
> t _ TextConstants at: self fontArray first familyName asSymbol.
> t fonts first emphasis = 0 ifTrue: [
> ^ t addNewFontSize: pointSize.
> ].
> ].
>
> pointSize <= 0 ifTrue: [^ nil].
> fontArray do: [:s |
> s pointSize = pointSize ifTrue: [^ s].
> ].
>
> (isSet _ fontArray first isKindOf: TTCFontSet)
> ifTrue:[
> | fonts |
> fonts _ fontArray first fontArray collect: [ :font |
> | newFont |
> (font isNil)
> ifTrue: [newFont _ nil]
> ifFalse: [
> newFont _ (font ttcDescription size > 256)
> ifTrue: [MultiTTCFont new initialize]
> ifFalse: [TTCFont new initialize].
> newFont ttcDescription: font ttcDescription.
> newFont pixelSize: pointSize * 96 // 72.
> font derivativeFonts notEmpty ifTrue: [font derivativeFonts do: [ :proto |
> proto ifNotNil: [
> d _ proto class new initialize.
> d ttcDescription: proto ttcDescription.
> d pixelSize: newFont pixelSize.
> newFont derivativeFont: d]]].
> ].
> newFont].
> f _ TTCFontSet newFontArray: fonts]
> ifFalse: [
> f _ TTCFont new initialize.
> f ttcDescription: fontArray first ttcDescription.
> f pointSize: pointSize.
> fontArray first derivativeFonts do: [:proto |
> proto ifNotNil: [
> d _ TTCFont new initialize.
> d ttcDescription: proto ttcDescription.
> d pointSize: f pointSize.
> f derivativeFont: d.
> ].
> ].
> ].
> isSet ifFalse: [
> fallbackStyle _ TextStyle named: (fontArray first fallbackFont
textStyleName).
> ].
> newArray _ ((fontArray copyWith: f) asSortedCollection: [:a :b | a
pointSize <= b pointSize]) asArray.
> self newFontArray: newArray.
> isSet ifTrue: [
> TTCFontSet register: newArray at: newArray first familyName asSymbol.
> ].
> isSet ifFalse: [
> f setupDefaultFallbackFontTo: fallbackStyle.
> f derivativeFonts do: [:g | g setupDefaultFallbackFontTo: fallbackStyle].
> ].
> ^ self fontOfPointSize: pointSize
> ! !
>
>
> !TTCFont methodsFor: 'objects from disk' stamp: 'yo 3/17/2005 11:21'!
> objectForDataStream: refStrm
> | dp |
> "I am about to be written on an object file.  Write a
> reference to a known FontSet in the other system instead."
>
> "a path to me"
> dp _ DiskProxy global: #TTCFont selector: #familyName:pointSize:emphasis:
> args: {self familyName. self pointSize. self emphasis}.
> refStrm replace: self with: dp.
> ^ dp.
> ! !
>
>
> !TTCFont class methodsFor: 'instance creation' stamp: 'yo 8/1/2005 15:06'!
> familyName: n pointSize: s emphasis: code
>
> "(TTCFont familyName: 'BitstreamVeraSans' pointSize: 12 emphasis: 0)"
> | t ret index |
> t _ self registry at: n asSymbol ifAbsent: [#()].
> t isEmpty ifTrue: [
> t _ (TextConstants at: #DefaultTextStyle) fontArray.
> ret _ t first.
> ret pointSize >= s ifTrue: [^ ret emphasis: code].
> index _ 2.
> [index <= t size and: [(t at: index) pointSize <= s]] whileTrue: [
> ret _ t at: index.
> index _ index + 1.
> ].
> ^ ret emphasis: code.
> ].
> ^ ((TextStyle named: n) addNewFontSize: s) emphasis: code.
> ! !
>
> !TTCFont class methodsFor: 'other' stamp: 'yo 3/17/2005 11:11'!
> registerAll
> "
> TTCFont registerAll
> "
>
> TextStyle allInstancesDo: [:e |
> (e fontArray first isMemberOf: TTCFont) ifTrue: [
> self register: e fontArray at: e fontArray first familyName asSymbol.
> ].
> ].
> ! !
>
> !TTCFont class methodsFor: 'other' stamp: 'yo 3/17/2005 10:52'!
> register: anObject at: symbolName
>
> self registry at: symbolName put: anObject.
> ! !
>
> !TTCFont class methodsFor: 'other' stamp: 'yo 3/17/2005 10:52'!
> registry
>
> ^ Registry isNil
> ifTrue: [Registry := IdentityDictionary new]
> ifFalse: [Registry].
> ! !
>
> !TTCFont class methodsFor: 'other' stamp: 'yo 3/17/2005 10:53'!
> unregister: symbolName
>
> self registry removeKey: symbolName ifAbsent: [].
> ! !
>
>
> !WideSymbol class methodsFor: 'instance creation' stamp: 'tak 9/14/2005
11:07'!
> newFromStream: s
> "Use WideString rather than 'super' to avoid making multiple instance of
WideSymbol"
> ^ self
> intern: (WideString newFromStream: s)! !
>
> NaturalLanguageTranslator class removeSelector: #current!
> NaturalLanguageTranslator class removeSelector: #isoLanguage:!
> NaturalLanguageTranslator class removeSelector: #isoLanguage:isoCountry:!
> LocaleID class removeSelector: #default!
> Locale initialize!
> Object subclass: #LanguageEnvironment
> instanceVariableNames: 'id'
> classVariableNames: 'ClipboardInterpreterClass Current
FileNameConverterClass InputInterpreterClass KnownEnvironments
SystemConverterClass'
> poolDictionaries: ''
> category: 'Multilingual-Languages'!
> ISOLanguageDefinition class removeSelector: #convertISOCountriesFrom:!
> ISOLanguageDefinition class removeSelector: #isoCountries!
> ISOLanguageDefinition class removeSelector: #isoCountryString!
> ISOLanguageDefinition class removeSelector: #readISOCountriesFrom:!
> Object subclass: #ISOLanguageDefinition
> instanceVariableNames: 'iso3 iso2 iso3Alternate language'
> classVariableNames: 'ISO2Countries ISO2Table ISO3Countries ISO3Table'
> poolDictionaries: ''
> category: 'System-Localization'!
> "Postscript:
> "
> ISOLanguageDefinition initISOCountries.
> !
>
>


----------------------------------------------------------------------------
----


> 'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 2 March 2006
at 4:13:34 pm'!
> "Change Set: percentEncodingFix
> Date: 22 September 2005
> Author: Korakurider
>
> + When Squeak is launched by openning .pr file, passed filename is
systemString
>  (shift-jis on windows for instance).  That has to be converted to
Squeak-native string.
> + reimplementation of decoding percent-encoded-string has to be modified
to support
>   utf8 based encoding.
> "!
>
> Object subclass: #GetTextInterchange
> instanceVariableNames: 'language stream'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Babel-Kernel'!
> GetTextInterchange subclass: #GetTextExporter
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Babel-Kernel'!
> GetTextInterchange subclass: #GetTextImporter
> instanceVariableNames: 'msgId msgStr'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Babel-Kernel'!
> KeyboardInputInterpreter subclass: #MacUnicodeInputInterpreter
> instanceVariableNames: 'keyValueIndex '
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Multilingual-TextConversion'!
>
> !ButtonProperties methodsFor: 'accessing' stamp: 'yo 11/30/2005 14:20'!
> establishEtoyLabelWording
> "Set the label wording, unless it has already been manually edited"
>
> | itsName |
>
> self isTileScriptingElement ifFalse: [^self].
> itsName _ target externalName.
> self addTextToButton: itsName, ' ', arguments first.
> visibleMorph setBalloonText:
> ('click to run the script "{1}" in player named "{2}"' translated format:
{arguments first. itsName}).
> ! !
>
>
> !CharacterScanner methodsFor: 'scanning' stamp: 'tak 11/8/2005 11:25'!
> scanCharactersFrom: startIndex to: stopIndex in: sourceString rightX:
rightX stopConditions: stops kern: kernDelta
>
> | startEncoding selector |
> (sourceString isByteString) ifTrue: [^ self basicScanCharactersFrom:
startIndex to: stopIndex in: sourceString rightX: rightX stopConditions:
stops kern: kernDelta.].
>
> (sourceString isWideString) ifTrue: [
> startIndex > stopIndex ifTrue: [lastIndex _ stopIndex. ^ stops at:
EndOfRun].
> startEncoding _  (sourceString at: startIndex) leadingChar.
> selector _ EncodedCharSet scanSelectorAt: startEncoding.
> ^ self perform: selector withArguments: (Array with: startIndex with:
stopIndex with: sourceString with: rightX with: stopConditions with:
kernDelta).
> ].
>
> ^ stops at: EndOfRun
> ! !
>
>
> !EncodedCharSet class methodsFor: 'class methods' stamp: 'tak 11/5/2005
18:14'!
> charFromUnicode: unicode
>
> | table index |
> unicode < 128 ifTrue: [^ Character value: unicode].
>
> table _ self ucsTable.
> index _ table indexOf: unicode.
> index = 0 ifTrue: [
> ^ nil.
> ].
>
> ^ Character leadingChar: self leadingChar code: index - 1.
>
> ! !
>
> !EncodedCharSet class methodsFor: 'class methods' stamp: 'tak 11/8/2005
11:19'!
> scanSelectorAt: encoding
> | charset |
> charset := self charsetAt: encoding.
> ^ charset
> ifNil: [LanguageEnvironment scanSelector]
> ifNotNil: [charset scanSelector]! !
>
> !EncodedCharSet class methodsFor: 'accessing - displaying' stamp: 'tak
11/8/2005 11:26'!
> scanSelector
> ^ #scanMultiCharactersFrom:to:in:rightX:stopConditions:kern:! !
>
>
> !GetTextInterchange methodsFor: 'as yet unclassified'!
> defaultFileName
> ^ language displayLanguage , '.po'! !
>
> !GetTextInterchange methodsFor: 'as yet unclassified'!
> formatReplacements
> | t1 |
> t1 := OrderedCollection new.
> ^ t1! !
>
> !GetTextInterchange methodsFor: 'as yet unclassified'!
> formatString: t1
> | t2 |
> t2 := t1.
> self formatReplacements
> do: [:t3 | t2 := t2 copyReplaceAll: t3 key with: t3 value].
> ^ t2! !
>
>
> !GetTextExporter methodsFor: 'as yet unclassified'!
> createHeaders
> | t1 |
> t1 := OrderedCollection new.
> t1 add: 'Project-Id-Version' -> 'Small-Land'.
> t1 add: 'POT-Creation-Date' -> self currentDateAndTime.
> t1 add: 'PO-Revision-Date' -> self currentDateAndTime.
> t1 add: 'Last-Translator' -> ''.
> t1 add: 'Language-Team' -> ''.
> t1 add: 'MIME-Version' -> '1.0'.
> t1 add: 'Content-Type' -> 'text/plain; charset=ISO-8859-1'.
> t1 add: 'Content-Transfer-Encoding' -> '8bit'.
> ^ t1! !
>
> !GetTextExporter methodsFor: 'as yet unclassified'!
> currentDateAndTime
> ^ String
> streamContents: [:t1 |
> t1 nextPutAll: Date today yyyymmdd;
> space.
> Time now
> print24: true
> showSeconds: false
> on: t1.
> t1 nextPutAll: '-0000']! !
>
> !GetTextExporter methodsFor: 'as yet unclassified'!
> exportHeader
> self exportMsgId: ''.
> self exportMsgStr: ''.
> self createHeaders
> do: [:t1 | self exportHeaderLineKey: t1 key value: t1 value].
> stream cr; cr! !
>
> !GetTextExporter methodsFor: 'as yet unclassified'!
> exportHeaderLineKey: t1 value: t2
> stream nextPut: $";
> nextPutAll: t1;
> nextPut: $:;
> space;
> nextPutAll: t2;
> nextPutAll: '\n';
> nextPut: $";
> cr! !
>
> !GetTextExporter methodsFor: 'as yet unclassified'!
> exportMsgId: t1
> stream nextPutAll: 'msgid';
> space;
> nextPut: $";
>
> nextPutAll: (self formatString: t1);
> nextPut: $";
> cr! !
>
> !GetTextExporter methodsFor: 'as yet unclassified'!
> exportMsgStr: t1
> stream nextPutAll: 'msgstr';
> space;
> nextPut: $";
>
> nextPutAll: (self formatString: t1);
> nextPut: $";
> cr! !
>
> !GetTextExporter methodsFor: 'as yet unclassified'!
> exportPhrase: t1 translation: t2
> t1 isEmpty
> ifTrue: [^ self].
> self exportMsgId: t1.
> self exportMsgStr: t2.
> stream cr! !
>
> !GetTextExporter methodsFor: 'as yet unclassified'!
> exportTranslations
> language translations
> keysAndValuesDo: [:t1 :t2 | self exportPhrase: t1 translation: t2]! !
>
> !GetTextExporter methodsFor: 'as yet unclassified'!
> exportUntranslated
> language untranslated
> do: [:t1 | self exportPhrase: t1 translation: '']! !
>
> !GetTextExporter methodsFor: 'as yet unclassified'!
> export: t1
> language := t1.
> [stream := CrLfFileStream forceNewFileNamed: self defaultFileName.
> stream lineEndConvention: #lf.
> stream converter: Latin1TextConverter new.
> self exportHeader.
> self exportTranslations.
> self exportUntranslated]
> ensure: [stream close]! !
>
> !GetTextExporter methodsFor: 'as yet unclassified'!
> formatReplacements
> | t1 |
> t1 := super formatReplacements.
> t1 add: '\' -> '\\'.
> t1 add: String cr -> '\n'.
> t1 add: String tab -> '\t'.
> t1 add: '"' -> '\"'.
> ^ t1! !
>
>
> !GetTextImporter methodsFor: 'as yet unclassified'!
> formatReplacements
> | t1 |
> t1 := super formatReplacements.
> t1 add: '\\' -> '\'.
> t1 add: '\n' -> String cr.
> t1 add: '\t' -> String tab.
> t1 add: '\"' -> '"'.
> ^ t1! !
>
> !GetTextImporter methodsFor: 'as yet unclassified'!
> import: t1
> language := t1.
> [stream := StandardFileStream oldFileNamed: self defaultFileName.
> stream text.
> self parse]
> ensure: [stream notNil
> ifTrue: [stream close]]! !
>
> !GetTextImporter methodsFor: 'as yet unclassified'!
> parse
> | t1 |
> [stream atEnd]
> whileFalse: [t1 := stream upTo: Character linefeed.
> self parseLine: t1]! !
>
> !GetTextImporter methodsFor: 'as yet unclassified'!
> parseLine: t1
> (t1 beginsWith: 'msgid')
> ifTrue: [self parseMsgId: t1.
> ^ self].
> (t1 beginsWith: 'msgstr')
> ifTrue: [self parseMsgStr: t1.
> ^ self].
> self storeTranslation! !
>
> !GetTextImporter methodsFor: 'as yet unclassified'!
> parseMsgId: t1
> msgId := self parseMsgSection: 'msgid' line: t1! !
>
> !GetTextImporter methodsFor: 'as yet unclassified'!
> parseMsgSection: t1 line: t2
> | t3 t4 t5 |
> t3 := t2 withBlanksTrimmed.
> t4 := (t3 allButFirst: t1 size) withBlanksTrimmed.
> t5 := t4 allButFirst allButLast.
> ^ t5! !
>
> !GetTextImporter methodsFor: 'as yet unclassified'!
> parseMsgStr: t1
> msgStr := self parseMsgSection: 'msgstr' line: t1! !
>
> !GetTextImporter methodsFor: 'as yet unclassified'!
> storeTranslation
> msgId isNil | msgStr isNil
> ifTrue: [^ self].
> msgId isEmpty
> ifTrue: [^ self].
> NaturalLanguageTranslator registerPhrase: msgId.
> msgStr isEmpty
> ifFalse: [language
> phrase: msgId
> translation: (self formatString: msgStr)].
> msgId := nil.
> msgStr := nil! !
>
>
> !HTTPDownloadRequest methodsFor: 'initialize' stamp: 'KR 9/4/2005 10:33'!
> for: aUrl in: aLoader
> url _ aUrl.
> loader _ aLoader.
> semaphore _ Semaphore new.! !
>
>
> !LanguageEditor methodsFor: 'gui methods' stamp: 'yo 11/29/2005 11:20'!
> codeSelectedTranslationAsMimeString
> | keys code tmpStream s2 gzs cont |
> keys := selectedTranslations
> collect: [:key | self translations at: key].
> code := String
> streamContents: [:aStream | self translator fileOutOn: aStream keys:
keys].
>
> tmpStream _ MultiByteBinaryOrTextStream on: ''.
> tmpStream converter: UTF8TextConverter new.
> translator fileOutHeaderOn: tmpStream.
> tmpStream nextPutAll: code.
> s2 _ RWBinaryOrTextStream on: ''.
> gzs := GZipWriteStream on: s2.
> tmpStream reset.
> gzs nextPutAll: (tmpStream binary contentsOfEntireFile asString) contents.
> gzs close.
> s2 reset.
>
> cont _ String streamContents: [:strm |
> strm nextPutAll: '"Gzip+Base64 encoded translation for;'; cr.
> strm nextPutAll: '#('.
> keys do: [:each | strm  nextPutAll: '''', each, ''' '.].
> strm nextPutAll: ')"'; cr; cr.
> strm nextPutAll: 'NaturalLanguageTranslator loadForLocaleIsoString: '.
> strm nextPut: $'.
> strm nextPutAll: translator localeID isoString.
> strm nextPut: $'.
> strm nextPutAll: ' fromGzippedMimeLiteral: '.
> strm nextPut: $'.
> strm nextPutAll: (Base64MimeConverter mimeEncode: s2) contents.
> strm nextPutAll: '''.'.
> strm cr.
> ].
>
> (StringHolder new contents: cont)
> openLabel: 'exported codes in Gzip+Base64 encoding'! !
>
> !LanguageEditor methodsFor: 'initialization - toolbar' stamp: 'AB 3/2/2006
15:55'!
> createMainToolbar
> "create a toolbar for the receiver"
> | toolbar |
> toolbar := self createRow.
> ""
> " toolbar
> addMorphBack: (self
> createUpdatingButtonWording: #debugWording
> action: #switchDebug
> help: 'Switch the debug flag')."
> toolbar addTransparentSpacerOfSize: 5 @ 0.
> ""
> toolbar
> addMorphBack: (self
> createButtonLabel: 'new'
> action: #newTranslations
> help: 'Create translations for new language.').
> toolbar
> addMorphBack: (self
> createButtonLabel: 'save'
> action: #saveToFile
> help: 'Save the translations to a file').
> toolbar
> addMorphBack: (self
> createButtonLabel: 'load'
> action: #loadFromFile
> help: 'Load the translations from a file').
> toolbar
> addMorphBack: (self
> createButtonLabel: 'merge'
> action: #mergeFromFile
> help: 'Merge the current translations with the translations in a file').
> ""
> toolbar addTransparentSpacerOfSize: 5 @ 0.
> toolbar
> addMorphBack: (self
> createButtonLabel: 'apply'
> action: #applyTranslations
> help: 'Apply the translations as much as possible.').
> ""
> toolbar addTransparentSpacerOfSize: 5 @ 0.
> toolbar
> addMorphBack: (self
> createButtonLabel: 'check translations'
> action: #check
> help: 'Check the translations and report the results.').
> toolbar
> addMorphBack: (self
> createButtonLabel: 'report'
> action: #report
> help: 'Create a report.').
> toolbar
> addMorphBack: (self
> createButtonLabel: 'gettext'
> action: #getText
> help: 'Interface with gettext.').
> ""
> ^ toolbar! !
>
> !LanguageEditor methodsFor: 'initialization' stamp: 'AB 3/2/2006 16:07'!
> initializeOn: aLanguage
> "initialize the receiver on aLanguage"
> ""
> selectedTranslation := 0.
> selectedUntranslated := 0.
> selectedTranslations := IdentitySet new.
> ""
> translator := aLanguage.
> ""
> self model: aLanguage.
> self setLabel: 'Language editor for: ' translated , self translator name.
> ""
> self initializeToolbars.
> self initializePanels.
> self initializeStatusbar.
> self initializeNewerKeys.
> ! !
>
> !LanguageEditor methodsFor: 'as yet unclassified'!
> getText
> | t1 |
> t1 := MenuMorph new defaultTarget: self.
> t1
> add: 'gettext export' translated
> target: self
> selector: #getTextExport.
> t1 lastItem setBalloonText: 'Exports the translations to GetText format.'
translated.
> t1
> add: 'gettext import' translated
> target: self
> selector: #getTextImport.
> t1 lastItem setBalloonText: 'Imports the translations from GetText
format.' translated.
> t1 popUpInWorld! !
>
> !LanguageEditor methodsFor: 'as yet unclassified'!
> getTextImport
> self
> withUnboundModelDo: [:t1 | Cursor wait
> showWhile: [GetTextImporter new import: t1]]! !
>
> !LanguageEditor methodsFor: 'as yet unclassified'!
> withUnboundModelDo: t1
> | t2 |
> t2 := self model.
> self model: nil.
> [t1 value: t2]
> ensure: [self model: t2]! !
>
>
> !LanguageEnvironment methodsFor: 'utilities' stamp: 'tak 11/28/2005
17:28'!
> setupSqueaklandSpecifics
> "Write language specific settings here"! !
>
>
> !JapaneseEnvironment methodsFor: 'utilities' stamp: 'KR 1/30/2006 22:28'!
> setupSqueaklandSpecifics
> | server |
> ChangeSet current name: 'Unnamed' translated , '1'.
> ServerDirectory resetServers.
> server := SuperSwikiServer new type: #http;
> server: 'squeakland.jp';
> directory: '/super/SuperSwikiProj';
> acceptsUploads: (Preferences eToyFriendly not);
> encodingName: 'shift_jis'.
> ServerDirectory servers at: 'Squeakland.JP' put: server.
> Smalltalk garbageCollect! !
>
>
> !LanguageEnvironment class methodsFor: 'private' stamp: 'yo 11/29/2005
13:33'!
> initKnownEnvironments
> "LanguageEnvironment initKnownEnvironments"
>
> | env known id |
> known := Dictionary new.
> self allSubclassesDo: [:subClass |
> subClass supportedLanguages do: [:language |
> env := subClass new.
> id _ LocaleID isoString: language.
> env localeID: id.
> known at: id put: env]].
> ^known! !
>
>
> !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]! !
>
>
> !MacUnicodeInputInterpreter methodsFor: 'keyboard' stamp: 'tetha
11/22/2005 21:49'!
> nextCharFrom: sensor firstEvt: evtBuf
> | keyValue mark |
> keyValue := evtBuf at: self keyValueIndex.
> mark := self japaneseSpecialMark: keyValue.
> mark notNil
> ifTrue: [^ mark].
> keyValue < 256
> ifTrue: [^ (Character value: keyValue) squeakToIso].
> "Smalltalk systemLanguage charsetClass charFromUnicode: keyValue."
> ^ Unicode value: keyValue! !
>
> !MacUnicodeInputInterpreter methodsFor: 'initialization' stamp: 'ts
10/29/2005 10:22'!
> initialize
> | satisfiesVersion |
> satisfiesVersion := self
> majorMinorBuildFrom: SmalltalkImage current vmVersion
> satisfies: [:major :minor :build | major >= 3
> and: [minor >= 8
> and: [build >= 7]]].
> satisfiesVersion
> ifTrue: [keyValueIndex := 6]
> ifFalse: [keyValueIndex := 3]! !
>
> !MacUnicodeInputInterpreter methodsFor: 'accessing' stamp: 'ts 10/29/2005
10:23'!
> keyValueIndex
> ^ keyValueIndex! !
>
> !MacUnicodeInputInterpreter methodsFor: 'version check' stamp: 'ts
10/29/2005 10:17'!
> majorMinorBuildFrom: aString satisfies: aBlock
> | v |
> v := aString
> ifNil: [^ false].
> v := ((v copyAfter: $])
> findTokens: $ ) last findTokens: $..
> v size = 3
> ifFalse: [^ false].
> v := v
> collect: [:s | s initialIntegerOrNil
> ifNil: [^ false]].
> ^ aBlock valueWithArguments: v asArray! !
>
> !MacUnicodeInputInterpreter methodsFor: 'conversion' stamp: 'tetha
11/22/2005 22:05'!
> japaneseSpecialMark: anInteger
> "For japanese special marks.
> This method converts 'YEN SIGN' (16rA5) to 'REVERSE SOLIDUS' (16r5C)
> and use Japanese leading characters instead of Unicode for below
> characters.
> 'CENT SIGN' (16rA2)
> 'POUND SIGN' (16rA3)
> 'SECTION SIGN' (16rA7)
> 'DIAERESIS' (16rA8)
> 'NOT SIGN' (16rAC)
> 'DEGREE SIGN' (16rB0)
> 'PLUS-MINUS SIGN (16rB1)
> 'ACUTE ACCENT' (16rB4)
> 'PILCROW SIGN' (16rB6)
> 'MULTIPLICATION SIGN' (16rD7)
> 'DIVISION SIGN' (16rF7)
> "
> Project current localeID
> = (LocaleID isoLanguage: 'ja')
> ifTrue: [anInteger = 16rA5
> ifTrue: [^ Character value: 16r5C].
> (#(16rA2 16rA3 16rA7 16rA8 16rAC 16rB0 16rB1 16rB4 16rB6 16rD7 16rF7)
includes: anInteger)
> ifTrue: [^ Character leadingChar: JapaneseEnvironment leadingChar code:
anInteger]].
> ^ nil! !
>
>
> !MultiCharacterScanner methodsFor: 'scanning' stamp: 'tak 11/8/2005
11:25'!
> scanCharactersFrom: startIndex to: stopIndex in: sourceString rightX:
rightX stopConditions: stops kern: kernDelta
>
> | startEncoding selector |
> (sourceString isByteString) ifTrue: [^ self basicScanCharactersFrom:
startIndex to: stopIndex in: sourceString rightX: rightX stopConditions:
stops kern: kernDelta.].
>
> (sourceString isWideString) ifTrue: [
> startIndex > stopIndex ifTrue: [lastIndex _ stopIndex. ^ stops at:
EndOfRun].
> startEncoding _  (sourceString at: startIndex) leadingChar.
> selector _ EncodedCharSet scanSelectorAt: startEncoding.
> ^ self perform: selector withArguments: (Array with: startIndex with:
stopIndex with: sourceString with: rightX with: stopConditions with:
kernDelta).
> ].
>
> ^ stops at: EndOfRun
> ! !
>
>
> !NaturalLanguageTranslator methodsFor: 'fileIn/fileOut' stamp: 'yo
11/29/2005 11:19'!
> fileOutOn: aStream
> "self current fileOutOn: Transcript. Transcript endEntry"
> self fileOutHeaderOn: aStream.
> self fileOutOn: aStream keys: nil! !
>
> !NaturalLanguageTranslator methodsFor: 'fileIn/fileOut' stamp: 'yo
11/29/2005 11:19'!
> fileOutOn: aStream keys: keys
> "self current fileOutOn: Transcript. Transcript endEntry"
> (keys
> ifNil: [generics keys asSortedCollection])
> do: [:key | self
> nextChunkPut: (generics associationAt: key)
> on: aStream].
> keys
> ifNil: [self untranslated
> do: [:each | self nextChunkPut: each -> '' on: aStream]].
> aStream nextPut: $!!;
> cr! !
>
>
> !PasteUpMorph methodsFor: 'event handling' stamp: 'tak 11/6/2005 23:24'!
> dropFiles: anEvent
> "Handle a number of dropped files from the OS.
> TODO:
> - use a more general mechanism for figuring out what to do with the file
(perhaps even offering a choice from a menu)
> - remember the resource location or (when in browser) even the actual file
handle
> "
> | numFiles stream handler |
> numFiles _ anEvent contents.
> 1 to: numFiles do: [:i |
> stream _ FileStream requestDropStream: i.
> stream ifNotNil: [
> handler _ ExternalDropHandler lookupExternalDropHandler: stream.
> [handler ifNotNil: [handler handle: stream in: self dropEvent: anEvent]]
> ensure: [stream close]]].! !
>
>
> !ProjectLauncher methodsFor: 'running' stamp: 'KR 8/30/2005 17:41'!
> startUpAfterLogin
> | scriptName loader isUrl |
> self setupFlaps.
> Preferences readDocumentAtStartup ifTrue: [
> HTTPClient isRunningInBrowser ifTrue:[
> self setupFromParameters.
> scriptName _ self parameterAt: 'src'.
> CodeLoader defaultBaseURL: (self parameterAt: 'Base').
> ] ifFalse:[
> scriptName _ (SmalltalkImage current getSystemAttribute: 2) ifNil:[''].
> scriptName _ scriptName convertFromSystemString.
> scriptName isEmpty ifFalse:[
> "figure out if script name is a URL by itself"
> isUrl _ (scriptName asLowercase beginsWith:'http://') or:[
> (scriptName asLowercase beginsWith:'file://') or:[
> (scriptName asLowercase beginsWith:'ftp://')]].
> isUrl ifFalse:[scriptName _ 'file:',scriptName]].
> ]. ]
> ifFalse: [ scriptName := '' ].
>
> scriptName isEmptyOrNil
> ifTrue:[^Preferences eToyFriendly ifTrue: [self currentWorld
addGlobalFlaps]].
> loader _ CodeLoader new.
> loader loadSourceFiles: (Array with: scriptName).
> (scriptName asLowercase endsWith: '.pr')
> ifTrue:[self installProjectFrom: loader]
> ifFalse:[loader installSourceFiles].
> ! !
>
>
> !ReleaseBuilderSqueakland methodsFor: 'utilities' stamp: 'tak 11/28/2005
17:25'!
> setupLanguageSpecifics
> "ReleaseBuilderSqueakland new setupLanguageSpecifics"
> Locale current languageEnvironment setupSqueaklandSpecifics! !
>
>
> !ScriptActivationButton methodsFor: 'label' stamp: 'yo 11/30/2005 14:14'!
> establishLabelWording
> "Set the label wording, unless it has already been manually edited"
>
> | itsName |
> itsName _ target externalName.
> (self hasProperty: #labelManuallyEdited)
> ifFalse:
> [self label: (itsName, ' ', arguments first)].
> self setBalloonText:
> ('click to run the script "{1}" in player named "{2}"' translated format:
{arguments first. itsName}).
> ! !
>
>
> !String methodsFor: 'comparing' stamp: 'yo 12/15/2005 14:28'!
> compare: string1 with: string2 collated: order
>
> (string1 isByteString and: [string2 isByteString]) ifTrue: [
> ^ ByteString compare: string1 with: string2 collated: order
> ].
>      "Primitive does not fail properly right now"
>       ^ String compare: string1 with: string2 collated: order
>
> "
> self assert: 'abc' = 'abc' asWideString.
> self assert: 'abc' asWideString = 'abc'.
> self assert: ((ByteArray with: 97 with: 0 with: 0 with: 0) asString ~=
'a000' asWideString).
> self assert: ('a000' asWideString ~= (ByteArray with: 97 with: 0 with: 0
with: 0) asString).
>
> self assert: ('abc' sameAs: 'aBc' asWideString).
> self assert: ('aBc' asWideString sameAs: 'abc').
> self assert: ((ByteArray with: 97 with: 0 with: 0 with: 0) asString
sameAs: 'Abcd' asWideString) not.
> self assert: ('a000' asWideString sameAs: (ByteArray with: 97 with: 0
with: 0 with: 0) asString) not.
>
> "! !
>
> !String methodsFor: 'converting' stamp: 'KR 9/22/2005 23:06'!
> unescapePercents
> "decode %xx form.  This is the opposite of #encodeForHTTP"
> ^ self unescapePercentsWithTextEncoding: 'utf-8'.! !
>
> !String methodsFor: 'converting' stamp: 'KR 9/22/2005 23:07'!
> unescapePercentsWithTextEncoding: encodingName
> "decode string including %XX form"
> | ans c asciiVal pos oldPos specialChars encodedStream converter |
> encodedStream _ ReadWriteStream on: String new.
> converter _ TextConverter newForEncoding: encodingName.
> ans _ WriteStream on: String new.
> oldPos _ 1.
> specialChars _ '+%' asCharacterSet.
>
> [pos _ self indexOfAnyOf: specialChars startingAt: oldPos. pos > 0]
> whileTrue: [
> ans nextPutAll: (self copyFrom: oldPos to: pos - 1).
> c _ self at: pos.
> (c = $% and: [pos + 2 <= self size])
> ifTrue: [
> encodedStream reset.
> [c = $% ] whileTrue: [
>
> asciiVal _ (self at: pos+1) asUppercase digitValue * 16 +
> (self at: pos+2) asUppercase digitValue.
>
> asciiVal > 255 ifTrue: [^self]. "not really an escaped string".
> encodedStream nextPut: (Character value: asciiVal).
>
> pos _ pos + 3.
> (pos <= self size)
> ifTrue:  [c _ self at: pos]
> ifFalse:  [c _ nil].
> ].
> encodedStream position: 0.
> [(c _ converter nextFromStream: encodedStream) notNil ] whileTrue: [
> ans nextPut: c].
> oldPos _ pos.
> ]
> ifFalse: [ans nextPut: c.
> oldPos _ pos + 1
> ].
> ].
> (oldPos <= self size) ifTrue: [
> ans nextPutAll: (self copyFrom: oldPos to: self size) ].
>
> ^ ans contents! !
>
>
> !ByteString methodsFor: 'comparing' stamp: 'tak 11/6/2005 23:08'!
> findSubstring: key in: body startingAt: start matchTable: matchTable
> "self assert: ('i' beginsWith: 20999017 asCharacter asString) not"
> "self assert: (((String newFrom: {20999017 asCharacter. 20983887
> asCharacter}) beginsWith: 20999017 asCharacter asString))"
> ^ key isByteString
> ifTrue: [self
> primitiveFindSubstring: key
> in: body
> startingAt: start
> matchTable: matchTable]
> ifFalse: [super
> findSubstring: key
> in: body
> startingAt: start
> matchTable: matchTable]! !
>
>
> !String class methodsFor: 'primitives' stamp: 'yo 12/15/2005 13:41'!
> compare: string1 with: string2 collated: order
> "Return 1, 2 or 3, if string1 is <, =, or > string2, with the collating
order of characters given by the order array."
>
> | len1 len2 c1 c2 |
> order == nil ifTrue: [
> len1 _ string1 size.
> len2 _ string2 size.
> 1 to: (len1 min: len2) do:[:i |
> c1 _ (string1 at: i) asInteger.
> c2 _ (string2 at: i) asInteger.
> c1 = c2 ifFalse: [c1 < c2 ifTrue: [^ 1] ifFalse: [^ 3]].
> ].
> len1 = len2 ifTrue: [^ 2].
> len1 < len2 ifTrue: [^ 1] ifFalse: [^ 3].
> ].
> len1 _ string1 size.
> len2 _ string2 size.
> 1 to: (len1 min: len2) do:[:i |
> c1 _ (string1 at: i) asInteger.
> c2 _ (string2 at: i) asInteger.
> c1 < 256 ifTrue: [c1 _ order at: c1 + 1].
> c2 < 256 ifTrue: [c2 _ order at: c2 + 1].
> c1 = c2 ifFalse:[c1 < c2 ifTrue: [^ 1] ifFalse: [^ 3]].
> ].
> len1 = len2 ifTrue: [^ 2].
> len1 < len2 ifTrue: [^ 1] ifFalse: [^ 3].
> ! !
>
>
> !ByteString class methodsFor: 'primitives' stamp: 'yo 12/15/2005 13:44'!
> compare: string1 with: string2 collated: order
> "Return 1, 2 or 3, if string1 is <, =, or > string2, with the collating
order of characters given by the order array."
>
> | len1 len2 c1 c2 |
> <primitive: 'primitiveCompareString' module: 'MiscPrimitivePlugin'>
> self var: #string1 declareC: 'unsigned char *string1'.
> self var: #string2 declareC: 'unsigned char *string2'.
> self var: #order declareC: 'unsigned char *order'.
>
> len1 _ string1 size.
> len2 _ string2 size.
> 1 to: (len1 min: len2) do:
> [:i |
> c1 _ order at: (string1 basicAt: i) + 1.
> c2 _ order at: (string2 basicAt: i) + 1.
> c1 = c2 ifFalse:
> [c1 < c2 ifTrue: [^ 1] ifFalse: [^ 3]]].
> len1 = len2 ifTrue: [^ 2].
> len1 < len2 ifTrue: [^ 1] ifFalse: [^ 3].
> ! !
>
> Utilities class removeSelector: #makeNihongoImage!
> ByteSymbol removeSelector: #compare:with:collated:!
> ByteString removeSelector: #compare:with:collated:!
> KeyboardInputInterpreter subclass: #MacUnicodeInputInterpreter
> instanceVariableNames: 'keyValueIndex'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Multilingual-TextConversion'!
>


----------------------------------------------------------------------------
----


>
>






More information about the Squeak-dev mailing list