[etoys-dev] Etoys: System-bf.25.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Aug 8 07:34:27 EDT 2010


Bert Freudenberg uploaded a new version of System to project Etoys:
http://source.squeak.org/etoys/System-bf.25.mcz

==================== Summary ====================

Name: System-bf.25
Author: bf
Time: 8 August 2010, 1:33:48 pm
UUID: 18bbb85c-9715-4e79-8f3c-3b4f6f1cf4a0
Ancestors: System-bf.24

- Fix for SQ-592: when switching language and neither fonts are loadable nor Pango is available, simply switch the language (and hope for the best). In particular, do not show a menu that only has a "cancel" entry.
- Also, make NaturalLanguageTranslator default to be an InternalTranslator (NaturalLanguageTranslator is abstract)

=============== Diff against System-bf.24 ===============

Item was changed:
  ----- Method: Locale class>>switchAndInstallFontToID:gently: (in category 'accessing') -----
  switchAndInstallFontToID: localeID gently: gentlyFlag
  
  	| locale result env envFound ret fontInImage menu |
  	"Assumption: Rainbow => can try Pango"
  	"Logic:
  		- in Sugar, we don't bother asking any questions, and we don't bother automatically loading fonts.
  			in Sugar, and if the font is available, use the font. 
  			in Sugar, and if the font is not in the image, try to enable Pango.
  			- if the previous step fails, notify the user that you cannot switch to the language.
  		- not in Rainbow, 
  			- if the font is in the image, use the font.
  			- if the font is not in the image,
  				- ask to choose:
  					- load font
  					- try to enable pango, if pango is available
  					- or cancel.
  			- if the previous step fails, notify the user that you cannot switch to the language.
  	Details:
  		- how to check non-pango font is available:
  			- if the language environment for the locale doesn't exist, the font is not available.
  			- if font loading fails, it is not available.
  		- how to check if the language environment doesn't exist:
  			- if the locales languageEnvironment is Latin1 but the locale isn't it is not available.
  	"	
  	locale := Locale localeID: localeID.
  	env := locale languageEnvironment.
  	result := true.
  	envFound := (Latin1Environment supportedLanguages includes: locale isoLanguage) or: [(env isMemberOf: Latin1Environment) not].
  	fontInImage := envFound and: [env isFontAvailable].
  	SugarLauncher isRunningInSugar ifTrue: [
  		fontInImage ifFalse: [
  			"font is not available in the image.  Even don't ask for font installation."
  			Cursor wait showWhile: [
  				Preferences setPreference: #usePangoRenderer toValue: true.
  				TextMorph usePango: true]].
  	] ifFalse: [
+ 		(fontInImage not and: [envFound or: [RomePluginCanvas pangoIsAvailable]]) ifTrue: [
- 		fontInImage ifFalse: [
  			menu := MenuMorph new.
  			menu defaultTarget: menu.
  			envFound ifTrue: [menu add: 'load font' translated selector: #modalSelection: argument: #loadFont].
  			RomePluginCanvas pangoIsAvailable ifTrue: [menu add:  'enable Pango' translated selector: #modalSelection: argument: #enablePango].
  			menu add:  'cancel' translated selector: #modalSelection: argument: #cancel.
  			menu addTitle: 'This language needs additional fonts.
  Do you want to install the fonts?' translated.
  			ret := menu invokeModal.
  			ret = #loadFont ifTrue: [result := env installFont. result ifTrue: [StrikeFont setupDefaultFallbackTextStyle]].
  			ret = #enablePango ifTrue: [
  				(result := RomePluginCanvas pangoIsAvailable) ifTrue: [
  					Cursor wait showWhile: [
  						Preferences setPreference: #usePangoRenderer toValue: true.
  						TextMorph usePango: true]]].
  			(ret ~~ #loadFont and: [ret ~~ #enablePango]) ifTrue: [result := false]]].
  
  	result ifFalse: [self inform: 'Cannot load additional fonts' translated] ifTrue: [self switchTo: locale gently: gentlyFlag].
  !

Item was changed:
  ----- Method: NaturalLanguageTranslator class>>default (in category 'accessing') -----
  default
  	"Answer translator for backstop"
  	"self default translate: 'test'"
+ 	^ InternalTranslator new
- 	^ self new
  		localeID: (LocaleID isoLanguage: 'en')!



More information about the etoys-dev mailing list