[Pkg] The Trunk: Multilingual-dtl.67.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Nov 30 01:37:39 UTC 2009


David T. Lewis uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-dtl.67.mcz

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

Name: Multilingual-dtl.67
Author: dtl
Time: 29 November 2009, 9:34:12 am
UUID: 674101cf-1ac8-4cc7-9e61-257bbd794434
Ancestors: Multilingual-nice.66

Use Beeper class>>beep rather than deprecated Object>>beep

=============== Diff against Multilingual-nice.66 ===============

Item was changed:
  Object subclass: #LanguageEnvironment
  	instanceVariableNames: 'id'
  	classVariableNames: 'ClipboardInterpreterClass Current FileNameConverterClass InputInterpreterClass KnownEnvironments SystemConverterClass'
  	poolDictionaries: ''
  	category: 'Multilingual-Languages'!
  
  !LanguageEnvironment commentStamp: 'bf 8/16/2009 16:52' prior: 0!
  The name multilingualized Squeak suggests that you can use multiple language at one time.  This is true, of course, but the system still how to manage the primary language; that provides the interpretation of data going out or coming in from outside world. It also provides how to render strings, as there rendering rule could be different in one language to another, even if the code points in a string is the same.
  
    Originally, LanguageEnvironment and its subclasses only has class side methods.  After merged with Diego's Babel work, it now has instance side methods.  Since this historical reason, the class side and instance side are not related well.
  
+   When we talk about the interface with the ou   t   s   i   d   e       o   f       t   h   e       S   q   u   e   a   k       w   o   r   l   d   ,       t   h   e   r   e       a   r   e       t   h   r   e   e       d   i   f   f   e   r   e   n   t       "   c   h   a   n   n   e   l   s   "   ;       t   h   e       k   e   y   b   o   a   r   d       i   n   p   u   t   ,       c   l   i   p   b   o   a   r   d       o   u   t   p   u   t       a   n   d       i   n   p   u   t   ,       a   n   d       f   i   l   e   n   a   m   e   .           O   n       a       n   o   t   -   t   o   -   u   n   c   o   m   m   o   n       s   y   s   t   e   m       s   u   c   h       a   s       a       U   n   i   x       s   y   s   t   e   m       l   o   c   a   l   i   z   e   d       t   o       J   a   p   a   n   ,       a   l   l       o   f       t   h   e   s   e       t   h   r   e   e       c   a   n       h   a   v   e       (   a   n   d       d   o   e   s       h   a   v   e   )       d   i   f   f   e   r   e   n   t       e   n   c   o   d   i   n   g   s   .           S   o       w   e       n   e   e   d       t   o       m   a   n   a   g   e       t   h   e   m       s   e   p   a   r   a   t   e   l   y   .           N   o   t   e       t   h   a   t       t   h   e       e   n   c   o   d   i   n   g       i   n       a       f   i   l   e       c   a   n       b   e       a   n   y   t   h   i   n   g   .           W   h   i   l   e       i   t       i   s       n   i   c   e       t   o       p   r   o   v   i   d   e       a       s   u   g   g   e   s   t   e   d       g   u   e   s   s       f   o   r       t   h   i   s       '   d   e   f   a   u   l   t       s   y   s   t   e   m       f   i   l   e       c   o   n   t   e   n   t       e   n   c   o   d   i   n   g   '   ,       i   t       i   s       n   o   t       c   r   i   t   i   c   a   l   .   
-   When we talk about the interface with the outside of the Squeak world, there are three different       "   c   h   a   n   n   e   l   s   "   ;       t   h   e       k   e   y   b   o   a   r   d       i   n   p   u   t   ,       c   l   i   p   b   o   a   r   d       o   u   t   p   u   t       a   n   d       i   n   p   u   t   ,       a   n   d       f   i   l   e   n   a   m   e   .           O   n       a       n   o   t   -   t   o   -   u   n   c   o   m   m   o   n       s   y   s   t   e   m       s   u   c   h       a   s       a       U   n   i   x       s   y   s   t   e   m       l   o   c   a   l   i   z   e   d       t   o       J   a   p   a   n   ,       a   l   l       o   f       t   h   e   s   e       t   h   r   e   e       c   a   n       h   a   v   e       (   a   n   d       d   o   e   s       h   a   v   e   )       d   i   f   f   e   r   e   n   t       e   n   c   o   d   i   n   g   s   .           S   o       w   e       n   e   e   d       t   o       m   a   n   a   g   e       t   h   e   m       s   e   p   a   r   a   t   e   l   y   .           N   o   t   e       t   h   a   t       t   h   e       e   n   c   o   d   i   n   g       i   n       a       f   i   l   e       c   a   n       b   e       a   n   y   t   h   i   n   g   .           W   h   i   l   e       i   t       i   s       n   i   c   e       t   o       p   r   o   v   i   d   e       a       s   u   g   g   e   s   t   e   d       g   u   e   s   s       f   o   r       t   h   i   s       '   d   e   f   a   u   l   t       s   y   s   t   e   m       f   i   l   e       c   o   n   t   e   n   t       e   n   c   o   d   i   n   g   '   ,       i   t       i   s       n   o   t       c   r   i   t   i   c   a   l   .   
     
             R   e   n   d   e   r   i   n   g       s   u   p   p   o   r   t       i   s       l   i   m   i   t   e   d       b   a   s   i   c       L   -   t   o   -   R       r   e   n   d   e   r   i   n   g       s   o       f   a   r   .           B   u   t       y   o   u       c   a   n       p   r   o   v   i   d   e       d   i   f   f   e   r   e   n   t       l   i   n   e   -   w   r   a   p       r   u   l   e   ,       a   t       l   e   a   s   t   .   
     !

Item was changed:
  ----- Method: LanguageEditor>>loadFromFile (in category 'gui methods') -----
  loadFromFile
  	| fileName |
  	fileName := self selectTranslationFileName.
  	fileName isNil
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			^ self].
  	""
  	Cursor wait
  		showWhile: [
  			self translator loadFromFileNamed: fileName.
  			self changed: #translations.
  			self changed: #untranslated]!

Item was changed:
  ----- Method: LanguageEditor>>searchUntranslated: (in category 'gui methods') -----
  searchUntranslated: aString 
  	| untranslateds results index |
  	untranslateds := self untranslated.
  	results := untranslateds
  				select: [:each | '*' , aString , '*' match: each].
  	""
  	results isEmpty
  		ifTrue: [""
  			self inform: 'no matches for' translated , ' ''' , aString , ''''.
  			^ self].
  	""
  	results size = 1
  		ifTrue: [""
  			self selectUntranslatedPhrase: results first.
  			^ self].
  	""
  	index := (UIManager default 
  				chooseFrom: (results
  						collect: [:each | each copy replaceAll: Character cr with: $\])
  				title: 'select the untranslated phrase...' translated).
  	""
  	index isZero
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			^ self].
  	""
  	self
  		selectUntranslatedPhrase: (results at: index)!

Item was changed:
  ----- Method: LanguageEditor>>saveToFile (in category 'gui methods') -----
  saveToFile
  	"save the translator to a file"
  	| fileName |
  	fileName := UIManager default request: 'file name' translated initialAnswer: translator localeID isoString , '.translation'.
  	(fileName isNil
  			or: [fileName isEmpty])
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			^ self].
  	""
  Cursor wait
  		showWhile: [
  	self translator saveToFileNamed: fileName]!

Item was changed:
  ----- Method: LanguageEditor>>searchUntranslated (in category 'gui methods') -----
  searchUntranslated
  	| search |
  	search := UIManager default request: 'search for' translated initialAnswer: ''.
  	(search isNil
  			or: [search isEmpty])
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			^ self].
  	""
  	self searchUntranslated: search!

Item was changed:
  ----- Method: LanguageEditor>>removeTranslation (in category 'gui methods') -----
  removeTranslation
  	"remove the selected translation"
  	| translation |
  	self selectedTranslation isZero
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			self inform: 'select the translation to remove' translated.
  			^ self].
  	""
  	translation := self translations at: self selectedTranslation.
  ""
  	(self
  			confirm: ('Removing "{1}".
  Are you sure you want to do this?' translated format: {translation}))
  		ifFalse: [^ self].
  ""
  	self translator removeTranslationFor: translation.
  	self changed: #translations.
  	self changed: #untranslated.!

Item was changed:
  ----- Method: LanguageEditor>>searchTranslation (in category 'gui methods') -----
  searchTranslation
  	| search |
  	search := UIManager default request: 'search for' translated initialAnswer: ''.
  	(search isNil
  			or: [search isEmpty])
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			^ self].
  ""
  self searchTranslation: search!

Item was changed:
  ----- Method: LanguageEditor>>addTranslation (in category 'gui methods') -----
  addTranslation
  	"translate a phrase"
  	| phrase |
  	phrase := UIManager default
  				request: 'enter the original:'
  				initialAnswer: ''.
  
  	(phrase isNil
  			or: [phrase = ''])
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			^ self].
  	""
  	self translatePhrase: phrase!

Item was changed:
  ----- Method: LanguageEditor>>removeUntranslated (in category 'gui methods') -----
  removeUntranslated
  	"remove the selected untranslated phrase"
  	| untranslated |
  	self selectedUntranslated isZero
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			self inform: 'select the untranslated phrase to remove' translated.
  			^ self].
  	""
  	untranslated := self untranslated at: self selectedUntranslated.
  	""
  	(self
  			confirm: ('Removing "{1}".
  Are you sure you want to do this?' translated format: {untranslated}))
  		ifFalse: [^ self].
  	""
  	self translator removeUntranslated: untranslated!

Item was changed:
  ----- Method: LanguageEditor>>translate (in category 'gui methods') -----
  translate
  	"translate a phrase"
  	| phrase |
  	phrase := self phraseToTranslate.
  	""
  	(phrase isNil
  			or: [phrase = ''])
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			^ self].
  	""
  	self translatePhrase: phrase!

Item was changed:
  ----- Method: LanguageEditor>>searchTranslation: (in category 'gui methods') -----
  searchTranslation: aString 
  	| translations results index |
  	translations := self translations.
  	results := translations
  				select: [:each | ""
  					('*' , aString , '*' match: each)
  						or: ['*' , aString , '*' match: (self translator translationFor: each)]].
  	""
  	results isEmpty
  		ifTrue: [""
  			self inform: 'no matches for' translated , ' ''' , aString , ''''.
  			^ self].
  	""
  	results size = 1
  		ifTrue: [""
  			self selectTranslationPhrase: results first.
  			^ self].
  	""
  	index := (UIManager default 
  				chooseFrom: (results
  						collect: [:each | ""
  							(each copy replaceAll: Character cr with: $\)
  								, ' -> '
  								, ((self translator translationFor: each) copy replaceAll: Character cr with: $\)])
  				title: 'select the translation...' translated).
  	""
  	index isZero
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			^ self].
  	""
  	self
  		selectTranslationPhrase: (results at: index)!

Item was changed:
  ----- Method: LanguageEditor>>mergeFromFile (in category 'gui methods') -----
  mergeFromFile
  	| fileName |
  	fileName := self selectTranslationFileName.
  	fileName isNil
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			^ self].
  	""
  	Cursor wait
  		showWhile: [
  			self translator loadFromFileNamed: fileName.
  			self changed: #translations.
  			self changed: #untranslated]!

Item was changed:
  ----- Method: LanguageEditor>>translatePhrase: (in category 'gui methods') -----
  translatePhrase: aString 
  	"translate aString"
  	| translation |
  	translation := UIManager default
  				multiLineRequest: 'translation for: ' translated , '''' , aString , ''''
  				centerAt: Sensor cursorPoint
  				initialAnswer: aString
  				answerHeight: 200.
  	""
  	(translation isNil
  			or: [translation = ''])
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			^ self].
  	""
  	self phrase: aString translation: translation!

Item was changed:
  ----- Method: LanguageEditor>>browseMethodsWithTranslation (in category 'gui methods') -----
  browseMethodsWithTranslation
  	| translation |
  	self selectedTranslation isZero
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			self inform: 'select the translation to look for' translated.
  			^ self].
  	""
  	translation := self translations at: self selectedTranslation.
  	self systemNavigation browseMethodsWithLiteral: translation!

Item was changed:
  ----- Method: LanguageEditor>>browseMethodsWithUntranslated (in category 'gui methods') -----
  browseMethodsWithUntranslated
  	| untranslated |
  	self selectedUntranslated isZero
  		ifTrue: [""
+ 			Beeper beep.
- 			self beep.
  			self inform: 'select the untranslated phrase to look for' translated.
  			^ self].
  	""
  	untranslated := self untranslated at: self selectedUntranslated.
  	SystemNavigation default browseMethodsWithLiteral: untranslated.
  !



More information about the Packages mailing list