[Pharo-project] status of i18n for Pharo

Stéphane Ducasse stephane.ducasse at inria.fr
Thu Apr 29 11:55:32 EDT 2010


try to identify the problem so that we fix it 
Setf

On Apr 29, 2010, at 5:50 PM, Hilaire Fernandes wrote:

> Hilaire Fernandes a écrit :
>> How should I proceed?
>> Do I update directly the related package in PharoInbox?
>> 
> 
> In latest 1.1, I started to file in NaturalLanguageTranslator.st as it looks like a root class.  The image frooze.
> 
> I guess it is related to Smalltalk registry or so...
> 
> How should I proceed?
> 
> Hilaire
> 
> PS: File in attachment
> 'From etoys4.0 of 9 October 2008 [dernière mise à jour: #2336] on 29 April 2010 at 5:02:21 pm'!
> Object subclass: #NaturalLanguageTranslator
> 	instanceVariableNames: 'id'
> 	classVariableNames: 'Translators'
> 	poolDictionaries: ''
> 	category: 'System-Localization'!
> !NaturalLanguageTranslator commentStamp: '<historical>' prior: 0!
> abstract class of natural language translator.
> Class side manages and holds loaded instances of concrete classes.!
> 
> 
> !NaturalLanguageTranslator methodsFor: 'accessing' stamp: 'yo 8/27/2008 13:10'!
> atRandom
> 
> 	self subclassResponsibility.
> ! !
> 
> !NaturalLanguageTranslator methodsFor: 'accessing' stamp: 'KR 10/23/2007 18:40'!
> domainRegistered: aDomainName
> 	"notify that new TextDomain is registered.  Concrete subclass can responds to this event if needed"! !
> 
> !NaturalLanguageTranslator methodsFor: 'accessing' stamp: 'KR 10/23/2007 18:40'!
> domainUnregistered: aDomainName
> 	"notify that new TextDomain is unregistered.  Concrete subclass can responds to this event if needed"! !
> 
> !NaturalLanguageTranslator methodsFor: 'accessing' stamp: 'KR 10/30/2007 18:41'!
> isDomainLoaded: aDomainName
> 	"ask if translation dictionary for the domain has been loaded and available now for use"
> 	self subclassResponsibility.! !
> 
> !NaturalLanguageTranslator methodsFor: 'accessing' stamp: 'KR 10/15/2007 12:48'!
> localeID
> 	^id! !
> 
> !NaturalLanguageTranslator methodsFor: 'accessing' stamp: 'KR 10/15/2007 12:50'!
> localeID: anID
> 	id := anID! !
> 
> 
> !NaturalLanguageTranslator methodsFor: 'language switching' stamp: 'KR 10/17/2007 01:57'!
> setCurrent
> 	"notify locale of the translator become current"
> ! !
> 
> 
> !NaturalLanguageTranslator methodsFor: 'printing' stamp: 'tak 10/19/2007 13:59'!
> printOn: aStream
> 	aStream nextPutAll: self class name; nextPut: $(; print: self localeID; nextPut: $)! !
> 
> 
> !NaturalLanguageTranslator methodsFor: 'translation' stamp: 'KR 10/17/2007 01:34'!
> translate: aString
> 	^self translate: aString 
> 		inDomain: TextDomainManager defaultDomain! !
> 
> !NaturalLanguageTranslator methodsFor: 'translation' stamp: 'tak 10/19/2007 13:38'!
> translate: aString inDomain: aDomainName
> 	^ aString! !
> 
> "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
> 
> NaturalLanguageTranslator class
> 	instanceVariableNames: ''!
> 
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'tak 10/19/2007 11:20'!
> availableForLocaleID: localeID 
> 	"Answer available locale ID.
> 	If translator is not found for correct locale ID, then isoLanguage is
> 	attempted for the key."
> 	^ self translators
> 		at: localeID
> 		ifAbsent: [localeID hasParent
> 				ifTrue: [self translators
> 						at: localeID parent
> 						ifAbsent: [self default]]
> 				ifFalse: [self default]]! !
> 
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'tak 10/19/2007 13:47'!
> availableLanguageLocaleIDs
> 	"Return the locale ids for the currently available languages.  
> 	Meaning those which either internally or externally have  
> 	translations available."
> 	"NaturalLanguageTranslator availableLanguageLocaleIDs"
> 	^ self translators values collect:[:each | each localeID]! !
> 
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'KR 10/15/2007 12:58'!
> current
> 	^ self availableForLocaleID: LocaleID current! !
> 
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'KR 10/15/2007 12:59'!
> default
> 	"Answer translator for backstop"
> 	"self default translate: 'test'"
> 	^ self new
> 		localeID: (LocaleID isoLanguage: 'en')! !
> 
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'KR 10/23/2007 18:41'!
> domainRegistered: aDomainName
> 	"notify that new TextDomain is registered"
> 	self translators do: [:each | each domainRegistered: aDomainName]! !
> 
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'KR 10/23/2007 18:41'!
> domainUnregistered: aDomainName
> 	"notify that new TextDomain is unregistered"
> 	self translators do: [:each | each domainUnregistered: aDomainName]! !
> 
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'KR 10/23/2007 19:42'!
> localeChanged
> 	"notify some project starts to use this locale.
> 	 this facility may use the event to load translation data dynamically" 
> 	self current setCurrent
> ! !
> 
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'tak 10/19/2007 11:21'!
> removeLocaleID: localeID 
> 	"self removeLocaleID: (LocaleID isoString: 'ja-kids')"
> 	^ self translators
> 		removeKey: localeID
> 		ifAbsent: []! !
> 
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'tak 10/19/2007 11:18'!
> resetCaches
> 	Translators := nil.! !
> 
> !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'tak 10/19/2007 11:15'!
> translators
> 	^ Translators ifNil: [Translators := Dictionary new]	! !
> 
> 
> !NaturalLanguageTranslator class methodsFor: 'class initialization' stamp: 'tak 10/19/2007 15:25'!
> initialize
> 	Smalltalk addToStartUpList: NaturalLanguageTranslator after: FileDirectory.
> ! !
> 
> !NaturalLanguageTranslator class methodsFor: 'class initialization' stamp: 'KR 10/23/2007 19:43'!
> privateStartUp
> 	self resetCaches.
> 	GetTextTranslator privateStartUp.
> 	InternalTranslator privateStartUp.
> 	self localeChanged.! !
> 
> !NaturalLanguageTranslator class methodsFor: 'class initialization' stamp: 'tak 10/19/2007 15:29'!
> startUp: resuming 
> 	resuming
> 		ifFalse: [^ self].
> 	self privateStartUp.! !
> 
> 
> !NaturalLanguageTranslator class methodsFor: 'translation' stamp: 'KR 10/30/2007 18:59'!
> translateWithoutLoading: aString toLocaleID: localeID
> 	"translate for default domain"
> 	^self translateWithoutLoading: aString toLocaleID: localeID inDomain: TextDomainManager defaultDomain.
> ! !
> 
> !NaturalLanguageTranslator class methodsFor: 'translation' stamp: 'KR 10/30/2007 18:50'!
> translateWithoutLoading: aString toLocaleID: localeID inDomain: aDomainName
> 	"try to translate with small footprint:
> 		if GetTextTranslator hasn't loaded MO, try to use InternalTranslator.
> 		if InternalTranslator isn't available, then actually load MO and use it"
> 	| translator |
> 	translator := self availableForLocaleID: localeID.
> 	(translator isDomainLoaded: aDomainName) ifFalse: [
> 		(InternalTranslator availableLanguageLocaleIDs includes: localeID)
> 			ifTrue:  [translator := InternalTranslator localeID: localeID].
> 	].
> 	^translator translate: aString inDomain: aDomainName! !
> 
> !NaturalLanguageTranslator class methodsFor: 'translation' stamp: 'KR 10/30/2007 18:33'!
> translate: aString toLocaleID: localeID
> 	"translate for default domain"
> 	^ (self availableForLocaleID: localeID)
> 		translate: aString! !
> 
> !NaturalLanguageTranslator class methodsFor: 'translation' stamp: 'KR 10/15/2007 14:00'!
> translate: aString toLocaleID: localeID inDomain: aDomainName
> 	^ (self availableForLocaleID: localeID)
> 		translate: aString inDomain: aDomainName! !
> 
> 
> NaturalLanguageTranslator initialize!
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project





More information about the Pharo-dev mailing list