--- a/AbstractLauncherApplication.st Wed Feb 18 13:04:45 2004 +0100
+++ b/AbstractLauncherApplication.st Wed Feb 18 13:05:47 2004 +0100
@@ -5520,9 +5520,10 @@
|f|
f := FontPanel
- fontFromUserInitial:(model value)
- title:(resources string:'Font for %1' with:title)
- filter:filter.
+ fontFromUserInitial:(model value)
+ title:(resources string:'Font for %1' with:title)
+ filter:filter
+ encoding:encodingMatch.
f notNil ifTrue:[
model == allOfThem ifTrue:[
models do:[:m | m value:f].
@@ -6416,5 +6417,5 @@
!AbstractLauncherApplication class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.301 2004-01-29 23:48:56 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.302 2004-02-18 12:05:47 cg Exp $'
! !
--- a/AbstractSettingsApplication.st Wed Feb 18 13:04:45 2004 +0100
+++ b/AbstractSettingsApplication.st Wed Feb 18 13:05:47 2004 +0100
@@ -3981,9 +3981,8 @@
!AbstractSettingsApplication::LanguageSettingsAppl methodsFor:'actions'!
basicSaveSettings
-
- |fontPref idx language oldLanguage territory enc
- answer matchingFonts l screen newLanguage switch dialog|
+ |fontPref fontPrefs idx language oldLanguage territory enc
+ answer matchingFonts l screen newLanguage switch dialog anyWrong|
newLanguage := self languageHolder value.
self withWaitCursorDo:[
@@ -4009,27 +4008,59 @@
oldLanguage := Smalltalk language.
Smalltalk language:language asSymbol.
ResourcePack flushCachedResourcePacks.
+
"/ refetch resources ...
resources := AbstractLauncherApplication classResources.
- fontPref := resources at:'PREFERRED_FONT_ENCODING' default:'iso8859*'.
- fontPref := fontPref asLowercase.
- Smalltalk language:oldLanguage.
+ fontPrefs := resources at:'PREFERRED_FONT_ENCODINGS' default:nil.
+ fontPrefs isNil ifTrue:[
+ fontPref := resources at:'PREFERRED_FONT_ENCODING' default:nil.
+ fontPref isNil ifTrue:[
+ fontPrefs := #(#'iso10464-1')
+ ] ifFalse:[
+ fontPrefs := #(#'iso10464-1') , (Array with:fontPref).
+ ]
+ ].
+ fontPrefs := fontPrefs collect:[:each | each asLowercase].
+ fontPref := fontPrefs first.
+
+ Smalltalk language:#en.
+ ResourcePack flushCachedResourcePacks.
+ resources := AbstractLauncherApplication classResources.
switch := true.
- enc := MenuView defaultFont encoding.
- (fontPref match:enc asLowercase) ifFalse:[
+ anyWrong := false.
+ (Array
+ with:MenuView defaultFont
+ with:ListView defaultFont
+ with:EditTextView defaultFont
+ with:Button defaultFont)
+ do:[:fn |
+ enc := fn encoding.
+ (fontPrefs contains:[:pref | CharacterEncoder isEncoding:pref subSetOf:enc])
+ ifFalse:[
+ anyWrong := true
+ ].
+ ].
+ anyWrong ifTrue:[
"/ look if there is one at all.
screen := Screen current.
- matchingFonts := screen listOfAvailableFonts select:[:f | fontPref match:(f encoding ? '?') asLowercase].
+ matchingFonts := screen listOfAvailableFonts
+ select:[:f | fontPrefs contains:[:pref |
+ CharacterEncoder
+ isEncoding:pref subSetOf:(f encoding ? 'ascii')]].
+
matchingFonts size == 0 ifTrue:[
"/ flush and try again - just in case, the font path has changed.
screen flushListOfAvailableFonts.
- matchingFonts := screen listOfAvailableFonts select:[:f | fontPref match:(f encoding ? '?') asLowercase].
+ matchingFonts := screen listOfAvailableFonts
+ select:[:f | fontPrefs contains:[:pref |
+ CharacterEncoder
+ isEncoding:pref subSetOf:(f encoding ? 'ascii')]].
].
matchingFonts size == 0 ifTrue:[
(Dialog
confirm:(resources
- string:'Your display does not offer any %1-encoded font.\\Change the language anyway ?\ (texts will probably be unreadable then)'
+ string:'Your display does not seem to offer any appropriate font.\\Change the language anyway ?\ (Texts will probably be unreadable then)'
with:fontPref) withCRs)
ifFalse:[
switch := false
@@ -4037,7 +4068,7 @@
] ifFalse:[
answer := Dialog
confirmWithCancel:(resources
- string:'menu font is not %1-encoded.\\Change it ?'
+ string:'Some font(s) is not %1-encoded.\\Change it ?'
with:fontPref) withCRs
labels:(resources
array:#('Cancel' 'No' 'Yes'))
@@ -4053,9 +4084,10 @@
].
switch ifTrue:[
- Transcript showCR:'change language to ' , newLanguage , ' ...'.
+ Transcript showCR:'Changing language setting to ' , newLanguage string , ' (' , language , ')...'.
Smalltalk language:language asSymbol.
Smalltalk languageTerritory:territory asSymbol.
+ ResourcePack flushCachedResourcePacks.
"/ ResourcePack flushCachedResourcePacks - already done by language-change
].
].
@@ -4155,20 +4187,33 @@
listOfLanguages := self class classResources at:'LIST_OF_OFFERED_LANGUAGES' default:#('default').
listOfLanguages := listOfLanguages asOrderedCollection.
- translatedLanguages := listOfLanguages collect:[:lang | |item|
- item := resources at:lang.
+ translatedLanguages := listOfLanguages
+ collect:[:lang | |item|
+ item := resources at:('LANG_' , lang) default:nil.
item isString ifTrue:[
item
] ifFalse:[
item at:1
]
].
- flags := listOfLanguages collect:[:lang | |item|
- item := resources at:lang.
- item isArray ifTrue:[
- item at:2
+ flags := listOfLanguages collect:[:lang | |item coll|
+ item := resources at:('FLAG_' , lang) default:nil.
+ item notNil ifTrue:[
+ item
] ifFalse:[
- nil
+ coll := lang asCollectionOfSubstringsSeparatedBy:$_.
+ (coll size > 1
+ and:[(item := resources at:('FLAG_' , coll last) default:nil) notNil])
+ ifTrue:[
+ item
+ ] ifFalse:[
+ item := resources at:('LANG_' , lang).
+ item isArray ifTrue:[
+ item at:2
+ ] ifFalse:[
+ nil
+ ]
+ ]
]
].
flags := flags collect:[:nm | |img d| nm notNil ifTrue:[
@@ -4181,9 +4226,7 @@
nil
]
].
- listOfLanguages := listOfLanguages collect:[:nm | nm copyFrom:'LANG_' size + 1].
languageList := translatedLanguages with:flags collect:[:lang :flag | LabelAndIcon icon:flag string:lang.].
-
super initialize.
! !
@@ -4198,7 +4241,7 @@
] ifFalse:[
Language
].
- ^ languageList at:(listOfLanguages indexOf:lang)
+ ^ languageList at:(listOfLanguages indexOf:lang ifAbsent:1)
!
hasUnsavedChanges
@@ -11090,5 +11133,5 @@
!AbstractSettingsApplication class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.131 2004-02-09 15:05:11 cg Exp $'
-! !
+ ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.132 2004-02-18 12:05:33 cg Exp $'
+! !