Tools__InternationalLanguageTranslationEditor.st
changeset 3454 5488b2613628
parent 3448 e4a15fd6bec5
child 3455 4ba13182f80f
equal deleted inserted replaced
3453:01e6b207c1b4 3454:5488b2613628
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "{ Package: 'stx:libtool2' }"
     3 "{ Package: 'stx:libtool2' }"
     2 
     4 
     3 "{ NameSpace: Tools }"
     5 "{ NameSpace: Tools }"
     4 
     6 
     5 ApplicationModel subclass:#InternationalLanguageTranslationEditor
     7 ApplicationModel subclass:#InternationalLanguageTranslationEditor
  1143     similarTranslationsAssociations := similarTranslationsAssociations associations inject: OrderedCollection new into:[:collection :association |
  1145     similarTranslationsAssociations := similarTranslationsAssociations associations inject: OrderedCollection new into:[:collection :association |
  1144 	collection detect:[:selectedAssociation |
  1146 	collection detect:[:selectedAssociation |
  1145 	    selectedAssociation value sameAs: association value] ifNone:[collection add: association].
  1147 	    selectedAssociation value sameAs: association value] ifNone:[collection add: association].
  1146 	collection].
  1148 	collection].
  1147     selectedTranslation := Dialog
  1149     selectedTranslation := Dialog
  1148 	choose:'Choose one if you consider it´s usefull to translate:
  1150 	choose:'Choose one if you consider it´s usefull to translate:
  1149     ',
  1151     ',
  1150 	'<', key, '>  ', (self currentExampleLanguageText ifNil:[''])
  1152 	'<', key, '>  ', (self currentExampleLanguageText ifNil:[''])
  1151 	fromList: (similarTranslationsAssociations collect:[:each |  '<', each key, '>  ', each value])
  1153 	fromList: (similarTranslationsAssociations collect:[:each |  '<', each key, '>  ', each value])
  1152 	values: (similarTranslationsAssociations collect:[:each | each value])
  1154 	values: (similarTranslationsAssociations collect:[:each | each value])
  1153 	lines:10
  1155 	lines:10
  1759 !
  1761 !
  1760 
  1762 
  1761 extractTranslationsFromProject
  1763 extractTranslationsFromProject
  1762     |projectID newTranslations|
  1764     |projectID newTranslations|
  1763 
  1765 
  1764     projectID := Dialog requestProject:(resources string:'Package to extract translations from:') initialAnswer:(lastExtractedProject ? LastExtractedProject) suggestions:(lastExtractedProject ? LastExtractedProject).
  1766     projectID := Dialog requestProject:(resources string:'Package to extract translations from:') initialAnswer:(lastExtractedProject ? LastExtractedProject) suggestions:(OrderedCollection with:(lastExtractedProject ? LastExtractedProject)).
  1765     projectID notNil ifTrue:[
  1767     projectID notNil ifTrue:[
  1766         projectID := projectID withoutSeparators asSymbol.
  1768         projectID := projectID withoutSeparators asSymbol.
  1767     ].
  1769     ].
  1768     projectID isEmptyOrNil ifTrue:[^ self ].
  1770     projectID isEmptyOrNil ifTrue:[^ self ].
  1769 
  1771 
  1771 
  1773 
  1772     newTranslations := Set new.
  1774     newTranslations := Set new.
  1773     self withWaitCursorDo:[
  1775     self withWaitCursorDo:[
  1774         Smalltalk allClassesDo:[:eachClass |
  1776         Smalltalk allClassesDo:[:eachClass |
  1775             eachClass theNonMetaclass instAndClassMethodsDo:[:eachMethod |
  1777             eachClass theNonMetaclass instAndClassMethodsDo:[:eachMethod |
  1776                 eachMethod package == projectID ifTrue:[ 
  1778                 eachMethod package == projectID ifTrue:[
  1777                     newTranslations addAll:( self extractTranslationsFromMethod:eachMethod ).
  1779                     newTranslations addAll:( self extractTranslationsFromMethod:eachMethod ).
  1778                 ]
  1780                 ]
  1779             ].
  1781             ].
  1780         ].
  1782         ].
  1781 
  1783 
  1782         self addAllTranslations:newTranslations.
  1784         self addAllTranslations:newTranslations.
  1783     ].
  1785     ].
  1784     
  1786 
  1785     "Modified: / 19-02-2015 / 11:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1787     "Modified: / 19-02-2015 / 11:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1788     "Modified (format): / 02-08-2017 / 17:07:55 / mawalch"
  1786 !
  1789 !
  1787 
  1790 
  1788 generateMissingTranslations: keys for: languages using: translator    
  1791 generateMissingTranslations: keys for: languages using: translator    
  1789     keys do:[:string |
  1792     keys do:[:string |
  1790         languages do:[:lang | 
  1793         languages do:[:lang | 
  3300     keys add:'no'.
  3303     keys add:'no'.
  3301 
  3304 
  3302     self addLanguage:#'de'.
  3305     self addLanguage:#'de'.
  3303     self addLanguage:#'fr'.
  3306     self addLanguage:#'fr'.
  3304 
  3307 
  3305     self at:'open' language:#'de' put:'öffnen'.
  3308     self at:'open' language:#'de' put:'öffnen'.
  3306     self at:'close' language:#'de' put:'schließen'.
  3309     self at:'close' language:#'de' put:'schließen'.
  3307     self at:'yes' language:#'de' put:'ja'.
  3310     self at:'yes' language:#'de' put:'ja'.
  3308     self at:'no' language:#'de' put:'nein'.
  3311     self at:'no' language:#'de' put:'nein'.
  3309     self at:'cancel' language:#'de' put:'abbrechen'.
  3312     self at:'cancel' language:#'de' put:'abbrechen'.
  3310 
  3313 
  3311     self at:'open' language:#'fr' put:'ouvrir'.
  3314     self at:'open' language:#'fr' put:'ouvrir'.