A new version of GetText was added to project Etoys Inbox: http://source.squeak.org/etoysinbox/GetText-Richo.4.mcz
==================== Summary ====================
Name: GetText-Richo.4 Author: Richo Time: 25 May 2010, 10:00:15 pm UUID: c298047b-f0a7-7a44-ba35-f4080500e595 Ancestors: GetText-bf.2
* Removed unused classes: GetTextExporter and LanguageEditor. * Renamed GetTextExporter2 to GetTextExported.
=============== Diff against GetText-bf.2 ===============
Item was added: + ----- Method: GetTextExporter>>stream: (in category 'accessing') ----- + stream: aStream + stream := aStream!
Item was changed: ----- Method: GetTextExporter>>exportTag:singleLine: (in category 'private') ----- exportTag: tag singleLine: aString stream nextPutAll: tag. stream space. stream nextPut: $". stream nextPutAll: (self formatString: aString). stream nextPut: $". stream cr!
Item was added: + ----- Method: GetTextExporter>>translationFor:in: (in category 'private') ----- + translationFor: aKey in: translator + translator ifNil: [^'']. + translator translations at: aKey ifPresent: [:s | ^s]. + "If we have old camelCase translations, make space-separated words" + translator translations at: aKey toCamelCase ifPresent: [:s | + (s includes: Character space) ifTrue: [^s]. + ^s fromCamelCase]. + ^''!
Item was added: + ----- Method: GetTextExporter classSide>>listAllHelp (in category 'utilities') ----- + listAllHelp + "self listAllHelp" + | spec specs oCatalog flap flapSelectors allKeys oCatalogHelp flapHelp | + oCatalog := Dictionary new. + Morph withAllSubclasses + do: [:aClass | (aClass class includesSelector: #descriptionForPartsBin) + ifTrue: [spec := aClass descriptionForPartsBin. + oCatalog at: spec formalName put: spec documentation]]. + Morph withAllSubclasses + do: [:aClass | (aClass class includesSelector: #supplementaryPartsDescriptions) + ifTrue: [specs := aClass supplementaryPartsDescriptions. + specs + do: [:each | oCatalog at: each formalName put: each documentation]]]. + flap := Dictionary new. + flapSelectors := #(#defaultsQuadsDefiningPlugInSuppliesFlap #defaultsQuadsDefiningStackToolsFlap #defaultsQuadsDefiningSuppliesFlap #defaultsQuadsDefiningToolsFlap #defaultsQuadsDefiningWidgetsFlap #defaultsQuadsDefiningScriptingFlap ). + flapSelectors + do: [:selector | + specs := Flaps perform: selector. + specs + do: [:each | flap at: each third put: each fourth]]. + allKeys := oCatalog keys intersection: flap keys. + allKeys asArray sort + do: [:each | + oCatalogHelp := oCatalog + at: each + ifAbsent: ['']. + flapHelp := flap + at: each + ifAbsent: ['']. + oCatalogHelp = flapHelp + ifFalse: [Transcript cr; show: 'Name: ' , each. + Transcript cr; show: 'O: ' , oCatalogHelp. + Transcript cr; show: 'F: ' , flapHelp. + Transcript cr. + + ]]!
Item was added: + ----- Method: GetTextExporter>>stream (in category 'accessing') ----- + stream + ^ stream!
Item was changed: + ----- Method: GetTextExporter>>exportHeaderLineKey:value: (in category 'private') ----- - ----- Method: GetTextExporter>>exportHeaderLineKey:value: (in category 'private-headers') ----- exportHeaderLineKey: keyString value: valueString stream nextPut: $"; nextPutAll: keyString; nextPut: $:; space; nextPutAll: valueString; nextPutAll: '\n'; nextPut: $"; + cr.! - cr!
Item was added: + ----- Method: GetTextExporter>>exportInformation: (in category 'private') ----- + exportInformation: anOrderedCollection + anOrderedCollection do: [:each | + self exportRecordHeader: each second. + self exportPhrase: each third translation: '']. + stream cr.!
Item was added: + ----- Method: GetTextExporter>>appendTranslations: (in category 'exporting') ----- + appendTranslations: domains + self appendStringReceivers: #translated into: domains. + self appendStringReceivers: #translatedNoop into: domains. + self appendVocabularies: domains. + !
Item was changed: + ----- Method: GetTextExporter>>exportPhrase:translation: (in category 'private') ----- - ----- Method: GetTextExporter>>exportPhrase:translation: (in category 'private-translations') ----- exportPhrase: phraseString translation: translationString + | normalizedTrans tmp transStartsWithCR transEndsWithCR| phraseString isEmpty ifTrue: [^ self]. self exportTag: 'msgid' msg: phraseString. + translationString size = 0 ifTrue: [ + normalizedTrans _ '' + ] ifFalse: [ + transEndsWithCR _ translationString last = (Character cr). + phraseString last = (Character cr) ifTrue: [ + transEndsWithCR ifTrue: [ + normalizedTrans _ translationString + ] ifFalse: [ + normalizedTrans _ translationString , String cr + ] + ] ifFalse: [ + transEndsWithCR ifTrue: [ + normalizedTrans _ translationString allButLast + ] ifFalse: [ + normalizedTrans _ translationString + ] + ]. + transStartsWithCR _ normalizedTrans first = (Character cr). + phraseString first = (Character cr) ifTrue: [ + transStartsWithCR ifFalse: [ + tmp _ (Character cr asString) , normalizedTrans. + normalizedTrans _ tmp. + ] + ] ifFalse: [ + transStartsWithCR ifTrue: [ + normalizedTrans _ normalizedTrans allButFirst + ] + ] + ]. + self exportTag: 'msgstr' msg: normalizedTrans. - self exportTag: 'msgstr' msg: translationString. stream cr!
Item was changed: + ----- Method: GetTextExporter>>currentDateAndTime (in category 'private') ----- - ----- Method: GetTextExporter>>currentDateAndTime (in category 'private-headers') ----- currentDateAndTime ^ String streamContents: [:aStream | aStream nextPutAll: Date today yyyymmdd; space. Time now print24: true showSeconds: false on: aStream. aStream nextPutAll: '-0000']!
Item was added: + ----- Method: GetTextExporter classSide>>verifyMsgID: (in category 'utilities') ----- + verifyMsgID: localeID + "GetTextExporter2 verifyMsgID: (LocaleID isoString: 'test-US')" + "InternalTranslator removeLocaleID: (LocaleID isoString: 'test-US')" + "Test gettext keyword extract function without file I/O. + A language named <langName> will be made. And + all possible translated words are shown with extra X charactor like + 'XwordX' in the language." + | src | + InternalTranslator removeLocaleID: localeID. + src := localeID translator. + self keys + do: [:key | src generics at: key put: 'X' , key , 'X']!
Item was added: + ----- Method: GetTextExporter>>appendStringReceivers:into: (in category 'private') ----- + appendStringReceivers: aSymbol into: domains + | literals references domainName methodReference keywords found | + + found := TranslatedReceiverFinder new stringReceiversWithContext: aSymbol. + found do: [ :assoc | + methodReference := assoc key. + keywords := assoc value. + domainName _ self getTextDomainForPackage: + (PackageOrganizer default packageOfMethod: methodReference ifNone: [TextDomainManager defaultDomain]). + literals _ domains at: domainName ifAbsentPut: [Dictionary new]. + keywords do: [ :literal | + references _ literals at: literal ifAbsentPut: [OrderedCollection new]. + references add: methodReference. + ]. + ]. + !
Item was added: + ----- Method: GetTextExporter classSide>>coverageStatus (in category 'utilities') ----- + coverageStatus + "self coverageStatus" + | keys diff | + keys := self keys. + diff := InternalTranslator allKnownPhrases keys difference: keys. + Transcript cr; show: 'Detected keywords by GetTextExporter2: ' , keys size printString. + Transcript cr; show: 'All known phrases in InternalTranslator: ' , InternalTranslator allKnownPhrases size printString. + Transcript cr; show: 'Coverage: ' , (keys size / InternalTranslator allKnownPhrases size * 100.0) printString , '%'. + diff inspect!
Item was changed: + ----- Method: GetTextExporter>>createHeaders (in category 'private') ----- - ----- Method: GetTextExporter>>createHeaders (in category 'private-headers') ----- createHeaders | headers | headers := OrderedCollection new. headers add: 'Project-Id-Version' -> 'eToys'. headers add: 'POT-Creation-Date' -> self currentDateAndTime. headers add: 'PO-Revision-Date' -> self currentDateAndTime. headers add: 'Last-Translator' -> ''. headers add: 'Language-Team' -> ''. headers add: 'MIME-Version' -> '1.0'. headers add: 'Content-Type' -> ('text/plain; charset=', stream converter class encodingNames first). headers add: 'Content-Transfer-Encoding' -> '8bit'. + headers add: 'X-Etoys-SystemVersion' -> (SystemVersion current asString). ^ headers!
Item was added: + ----- Method: GetTextExporter>>appendVocabularies: (in category 'private') ----- + appendVocabularies: domains + | literalsForDomain references domainName methodReference | + + EToyVocabulary allPhrasesWithContextToTranslate do: [ :r | + methodReference := (MethodReference new setStandardClass: (r second) methodSymbol: (r third)). + "domainName _ self getTextDomainForPackage: (PackageOrganizer default packageOfMethod: methodReference)". + domainName := 'Etoys-Tiles'. + literalsForDomain _ domains at: domainName ifAbsentPut: [Dictionary new]. + r fourth do: [ :literal | + references _ literalsForDomain at: literal ifAbsentPut: [OrderedCollection new]. + references add: methodReference. + ]. + ]. + !
Item was added: + ----- Method: GetTextExporter classSide>>keys (in category 'utilities') ----- + keys + | categories | + categories := Dictionary new. + self new appendTranslations: categories. + ^ categories values + inject: Set new + into: [:set :next | set addAll: next keys; + yourself]!
Item was added: + ----- Method: GetTextExporter>>exportTranslator: (in category 'exporting') ----- + exportTranslator: translator + "Export translation files. the file extention is 'po', or 'pot' if translator is nil " + "GetTextExporter2 new exportTranslator: NaturalLanguageTranslator current " + | domains | + domains := Dictionary new. + self appendTranslations: domains. + domains + keysAndValuesDo: [:domainName :value | + self + export: value + translator: translator + domain: domainName]!
Item was added: + ----- Method: GetTextExporter>>getTextDomainForPackage: (in category 'as yet unclassified') ----- + getTextDomainForPackage: aPackageInfo + ^TextDomainManager domainForPackage: aPackageInfo!
Item was changed: ----- Method: GetTextExporter>>formatReplacements (in category 'private') ----- formatReplacements | replacements | replacements := OrderedCollection new. replacements add: '' -> '\'. replacements add: String cr -> '\n'. replacements add: String tab -> '\t'. replacements add: '"' -> '"'. ^ replacements!
Item was added: + ----- Method: GetTextExporter>>exportRecordHeader: (in category 'private') ----- + exportRecordHeader: context + stream + nextPutAll: '#: '; + nextPutAll: context; + cr.!
Item was added: + ----- Method: GetTextExporter>>dirNameDomain:translator: (in category 'exporting') ----- + dirNameDomain: domain translator: translator + "Answer a file name for the domain. Make one if it is not exist yet. + Make template file name if translator is nil" + "self new dirNameDomain: 'etoys' translator: + NaturalLanguageTranslator current" + "self new dirNameDomain: 'etoys' translator: nil" + | fileName dirName pathName | + "safeCategory := category copyReplaceAll: ' ' with: '_'." + fileName := translator + ifNil: [domain , '.pot'] + ifNotNil: [translator localeID posixName , '.po']. + dirName := 'po', FileDirectory slash, domain. + pathName := dirName , FileDirectory slash , fileName. + (FileDirectory default directoryNamed: dirName) assureExistence. + ^ pathName!
Item was added: + ----- Method: GetTextExporter classSide>>exportAll (in category 'utilities') ----- + exportAll + "GetTextExporter2 exportAll" + self new exportTemplate. + InternalTranslator availableLanguageLocaleIDs + do: [:each | self new exportTranslator: each translator]!
Item was added: + ----- Method: GetTextExporter classSide>>exportTemplate (in category 'utilities') ----- + exportTemplate + "GetTextExporter2 exportTemplate" + self new exportTemplate.!
Item was added: + ----- Method: GetTextExporter>>dirNameCategory:translator: (in category 'exporting') ----- + dirNameCategory: category translator: translator + "Answer a file name for the category. Make one if it is not exist yet. + Make template file name if translator is nil" + "self new dirNameCategory: 'Morphic-Scripting Support' translator: + NaturalLanguageTranslator current" + "self new dirNameCategory: 'Morphic-Scripting Support' translator: nil" + | safeCategory fileName dirName pathName | + safeCategory := category copyReplaceAll: ' ' with: '_'. + fileName := translator + ifNil: [safeCategory , '.pot'] + ifNotNil: [translator localeID posixName , '.po']. + dirName := (safeCategory findTokens: '-') + inject: 'po' + into: [:aString :next | aString , FileDirectory slash , next]. + pathName := dirName , FileDirectory slash , fileName. + (FileDirectory default directoryNamed: dirName) assureExistence. + ^ pathName!
Item was added: + ----- Method: GetTextExporter>>createExtraInformation (in category 'private') ----- + createExtraInformation + | extras | + extras := OrderedCollection new. + #( + 'Language name as you''d like it to appear in the Languages menu' 'Language-Name' + 'Scale to apply to font size (2 for twice as large)' 'Font-Scale' + 'Directionality of language' 'Language-Direction' + 'Use this if you do not want any of the text to be bolded, for legibility' 'Suppress-Bold' + 'Font to use on a Windows system' 'Win-Font' + 'Font to use on a Mac system' 'Mac-Font' + 'Font to use on a Linux system' 'Linux-Font') pairsDo: [:first :second | + extras add: (Array with: '' with: first with: second). + ]. + ^ extras!
Item was changed: ----- Method: GetTextExporter>>exportTag:msg: (in category 'private') ----- exportTag: tag msg: aString | pos end line | (aString indexOf: Character cr) = 0 ifTrue: [self exportTag: tag singleLine: aString] ifFalse: [self exportTag: tag singleLine: ''. pos := 1. end := 0. [end < aString size] whileTrue: [end := aString indexOf: Character cr startingAt: pos. end = 0 ifTrue: [end := aString size]. line := aString copyFrom: pos to: end. stream nextPut: $"; nextPutAll: (self formatString: line); nextPut: $"; cr. pos := end + 1]]!
Item was added: + ----- Method: GetTextExporter>>exportBody:translator: (in category 'file out') ----- + exportBody: literals translator: translator + "Export a gettext file body. literals is a dictionary of keyword -> + #(MethodReference...) in the textDomain." + "Build {sortKey. comment. msgid } to optimize sorting (getting category is + too slow). + If there are two or more methods for a mgsid, only first method + (alphabetical) is used for sorting." + | sorted msgid sortedMethods category sortKey comment triplets commentUnderLined | + triplets := literals associations + collect: [:assoc | + msgid := assoc key. + sortedMethods := assoc value asArray sort. + category := (Smalltalk at: sortedMethods first classSymbol) category asString. + sortKey := category , ',' , sortedMethods first printString , ',' , msgid. + comment := (sortedMethods + collect: [:each | each actualClass asString , '>>' , each methodSymbol asString]) + inject: category + into: [:result :methodName | result , ',' , methodName]. + "Replace white spaces to _ because gettext tool might + replace a space to a new line some times, and it makes + difficult to take a diff." + commentUnderLined := comment copyReplaceAll: ' ' with: '_'. + Array + with: sortKey + with: commentUnderLined + with: msgid]. + "Sort and output the words" + sorted := triplets + sort: [:a :b | a first <= b first]. + sorted + do: [:triplet | + comment := triplet second. + msgid := triplet third. + self exportRecordHeader: comment. + self + exportPhrase: msgid + translation: (self translationFor: msgid in: translator)]!
Item was changed: ----- Method: GetTextExporter>>formatString: (in category 'private') ----- formatString: aString | result | result := aString. self formatReplacements do: [:each | result := result copyReplaceAll: each key with: each value]. ^ result!
Item was changed: + Object subclass: #GetTextExporter + instanceVariableNames: 'stream' - GetTextInterchange subclass: #GetTextExporter - instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'GetText-Editor'!
+ !GetTextExporter commentStamp: '<historical>' prior: 0! + Export translations to gettext format divided into categories. - !GetTextExporter commentStamp: 'tak 7/23/2007 00:31' prior: 0! - Export translations to one .po file.
+ "Export gettext template files" + GetTextExporter2 new exportTemplate. + + "Export translation files for current locale" + GetTextExporter2 new exportTranslator: (InternalTranslator newLocaleID: LocaleID current). + + "Export all gettext template and po files." + GetTextExporter2 exportAll. + + "To register a class category as a new domain" + TextDomainManager registerClassCategory: 'Morphic-Books' domain: 'Book'. + "Remove a class category" + TextDomainManager unregisterClassCategory: 'Morphic-Books'.! - GetTextExporter new export: NaturalLanguageTranslator current - !
Item was added: + ----- Method: GetTextExporter>>exportTemplate (in category 'exporting') ----- + exportTemplate + "GetTextExporter2 new exportTemplate" + self exportTranslator: nil!
Item was added: + ----- Method: GetTextExporter>>exportHeader: (in category 'private') ----- + exportHeader: domainName + | headers | + self exportTag: 'msgid' msg: ''. + self exportTag: 'msgstr' msg: ''. + headers := self createHeaders. + headers add: 'X-Etoys-Domain' -> domainName. + headers do: [:each | self exportHeaderLineKey: each key value: each value]. + stream cr; cr!
Item was added: + ----- Method: GetTextExporter classSide>>verifyExport (in category 'utilities') ----- + verifyExport + "Same as #verifyMsgID: but it writes / reads .po files actually" + "GetTextExporter2 verifyExport" + "InternalTranslator removeLocaleID: (LocaleID isoString: 'test-US')" + | src dst localeID | + localeID := LocaleID isoString: 'test-US'. + self verifyMsgID: localeID. + src := localeID translator. + self new exportTranslator: src. + InternalTranslator removeLocaleID: localeID. + dst := localeID translator. + GetTextImporter import: dst allDirectory: FileDirectory default!
Item was added: + ----- Method: GetTextExporter>>export:translator:domain: (in category 'private') ----- + export: literals translator: translator domain: domainName + | fileName | + "Export a gettext file in a category. literals is a dictionary of keyword -> #(MethodReference...) in the textDomain." + fileName := self dirNameDomain: domainName translator: translator. + [stream := FileStream forceNewFileNamed: fileName. + stream lineEndConvention: #lf. + stream converter: UTF8TextConverter new. + self exportHeader: domainName. + self exportInformation: self createExtraInformation. + self exportBody: literals translator: translator] + ensure: [stream close]!
Item was removed: - ----- Method: LanguageEditor>>translationsFilterWording (in category 'gui methods') ----- - translationsFilterWording - ^ (self translationsFilter isEmpty - ifTrue: ['filter' translated] - ifFalse: ['filtering: {1}' translated format:{self translationsFilter}]) !
Item was removed: - ----- Method: LanguageEditor>>numberOfTimesStringIsUsed: (in category 'stef') ----- - numberOfTimesStringIsUsed: aString - - ^ (self systemNavigation allSelect: [:method | method - hasLiteralSuchThat: [:lit | lit isString - and: [lit includesSubstring: aString caseSensitive: true]]]) size!
Item was removed: - ----- Method: LanguageEditor>>delete (in category 'open/close') ----- - delete - "Remove the receiver as a submorph of its owner" - self model: nil. - super delete !
Item was removed: - ----- Method: LanguageEditor>>untranslatedFilter (in category 'accessing') ----- - untranslatedFilter - ^ untranslatedFilter - ifNil: ['']!
Item was removed: - ----- Method: GetTextExporter>>exportTranslations (in category 'private-translations') ----- - exportTranslations - | keys size | - keys := language translations keys asArray sort. - size := keys size. - ProgressInitiationException - display: 'Exporting translated phrases as a gettext file.' - during: [:bar | 1 - to: size - do: [:index | - self - exportPhrase: (keys at: index) - translation: (language translations - at: (keys at: index)). - bar value: index / size]]!
Item was removed: - ----- Method: LanguageEditor class>>unload (in category 'initialize-release') ----- - unload - "the receiver is being unloaded" - (TheWorldMenu respondsTo: #registerOpenCommand:) - ifTrue: ["" - TheWorldMenu unregisterOpenCommand: 'Language Editor'. - TheWorldMenu unregisterOpenCommand: 'Language Editor for...'] !
Item was removed: - ----- Method: LanguageEditor>>translator (in category 'private') ----- - translator - ^translator!
Item was removed: - ----- Method: LanguageEditor>>initializeToolbars (in category 'initialization - toolbar') ----- - initializeToolbars - "initialize the receiver's toolbar" - self - addMorph: self createMainToolbar - frame: (0 @ 0 corner: 1 @ 0.09). - "" - self - addMorph: self createTranslationsToolbar - frame: (0 @ 0.09 corner: 0.5 @ 0.18). - self - addMorph: self createUntranslatedToolbar - frame: (0.5 @ 0.09 corner: 1 @ 0.18)!
Item was removed: - ----- Method: LanguageEditor>>reportString (in category 'reporting') ----- - reportString - "answer a string with a report of the receiver" - | stream | - stream := String new writeStream. - self printReportOn: stream. - ^ stream contents!
Item was removed: - ----- Method: LanguageEditor>>refreshBoth (in category 'updating') ----- - refreshBoth - self refreshUntranslated - !
Item was removed: - ----- Method: LanguageEditor>>addTranslation (in category 'gui methods') ----- - addTranslation - "translate a phrase" - | phrase | - phrase := FillInTheBlank - request: 'enter the original:' translated - initialAnswer: ''. - - (phrase isNil - or: [phrase = '']) - ifTrue: ["" - self beep. - ^ self]. - "" - self translatePhrase: phrase!
Item was removed: - ----- Method: LanguageEditor>>refreshUntranslated (in category 'updating') ----- - refreshUntranslated - "refresh the untranslated panel" - self refreshTranslations. - self selectedUntranslated: 0. - untranslated := nil. - self changed: #untranslated. - !
Item was removed: - ----- Method: LanguageEditor>>checkUntranslatedPhrase: (in category 'private') ----- - checkUntranslatedPhrase: phraseString - "check the phrase an aswer a string with a comment or a nil - meaning no-comments" - - (self translations includes: phraseString) - ifTrue: [^ 'possible double-translation' translated]. - - ^ nil!
Item was removed: - ----- Method: LanguageEditor class>>open (in category 'opening') ----- - open - "open the receiver on any language" - " - LanguageEditor open. - " - | menu | - menu := MenuMorph new defaultTarget: self. - menu addTitle: 'Language Editor for...' translated. - "" - (InternalTranslator availableLanguageLocaleIDs - asSortedCollection: [:x :y | x asString <= y asString]) - do: [:eachLanguage | "" - menu - add: eachLanguage name - target: self - selector: #openOn: - argument: eachLanguage]. - "" - menu popUpInWorld!
Item was removed: - ----- Method: GetTextExporter2>>translationFor:in: (in category 'private') ----- - translationFor: aKey in: translator - translator ifNil: [^'']. - translator translations at: aKey ifPresent: [:s | ^s]. - "If we have old camelCase translations, make space-separated words" - translator translations at: aKey toCamelCase ifPresent: [:s | - (s includes: Character space) ifTrue: [^s]. - ^s fromCamelCase]. - ^''!
Item was removed: - ----- Method: LanguageEditor>>translationsKeystroke: (in category 'gui methods') ----- - translationsKeystroke: aChar - "Respond to a Command key in the translations list." - aChar == $x - ifTrue: [^ self removeTranslation]. - aChar == $E - ifTrue: [^ self browseMethodsWithTranslation]!
Item was removed: - ----- Method: GetTextExporter2>>exportTranslator: (in category 'exporting') ----- - exportTranslator: translator - "Export translation files. the file extention is 'po', or 'pot' if translator is nil " - "GetTextExporter2 new exportTranslator: NaturalLanguageTranslator current " - | domains | - domains := Dictionary new. - self appendTranslations: domains. - domains - keysAndValuesDo: [:domainName :value | - self - export: value - translator: translator - domain: domainName]!
Item was removed: - ----- Method: GetTextExporter2>>appendTranslations: (in category 'exporting') ----- - appendTranslations: domains - self appendStringReceivers: #translated into: domains. - self appendStringReceivers: #translatedNoop into: domains. - self appendVocabularies: domains. - !
Item was removed: - ----- Method: LanguageEditor>>identifyUnusedStrings (in category 'stef') ----- - identifyUnusedStrings - "self new identifyUnusedStrings" - translationsList getList - do: [:each | - Transcript show: each. - Transcript show: (Smalltalk - allSelect: [:method | method - hasLiteralSuchThat: [:lit | lit isString - and: [lit includesSubstring: each caseSensitive: true]]]) size printString; cr]!
Item was removed: - ----- Method: LanguageEditor>>initializePanels (in category 'initialization') ----- - initializePanels - "initialize the receiver's panels" - translationsList := PluggableListMorphOfMany - on: self - list: #translations - primarySelection: #selectedTranslation - changePrimarySelection: #selectedTranslation: - listSelection: #selectedTranslationsAt: - changeListSelection: #selectedTranslationsAt:put: - menu: #translationsMenu: - keystroke: #translationsKeystroke:. - translationsList setBalloonText: 'List of all the translated phrases.' translated. - "" - untranslatedList := PluggableListMorph - on: self - list: #untranslated - selected: #selectedUntranslated - changeSelected: #selectedUntranslated: - menu: #untranslatedMenu: - keystroke: #untranslatedKeystroke:. - untranslatedList setBalloonText: 'List of all the untranslated phrases.' translated. - "" - translationText := PluggableTextMorph - on: self - text: #translation - accept: #translation: - readSelection: nil - menu: nil. - translationText setBalloonText: 'Translation for the selected phrase in the upper list.' translated. - "" - self - addMorph: translationsList - frame: (0 @ 0.18 corner: 0.5 @ 0.66). - self - addMorph: untranslatedList - frame: (0.5 @ 0.18 corner: 1 @ 0.93). - self - addMorph: translationText - frame: (0 @ 0.66 corner: 0.5 @ 0.93). - self hResizing: #shrinkWrap!
Item was removed: - ----- Method: LanguageEditor class>>openOnDefault (in category 'opening') ----- - openOnDefault - "open the receiver on the default language" - self openOn: LocaleID current!
Item was removed: - ----- Method: LanguageEditor>>translation: (in category 'accessing') ----- - translation: aStringOrText - "change the translation for the selected phrase" - | phrase | - self selectedTranslation isZero - ifTrue: [^ self]. - phrase _ self translations at: self selectedTranslation. - translator - phrase: phrase - translation: aStringOrText asString. - newerKeys add: phrase. - ^ true!
Item was removed: - ----- Method: LanguageEditor>>applyTranslations (in category 'gui methods') ----- - applyTranslations - "private - try to apply the translations as much as possible all - over the image" - Project current updateLocaleDependents!
Item was removed: - ----- Method: GetTextExporter2>>stream: (in category 'accessing') ----- - stream: aStream - stream := aStream!
Item was removed: - ----- Method: GetTextExporter2 classSide>>coverageStatus (in category 'utilities') ----- - coverageStatus - "self coverageStatus" - | keys diff | - keys := self keys. - diff := InternalTranslator allKnownPhrases keys difference: keys. - Transcript cr; show: 'Detected keywords by GetTextExporter2: ' , keys size printString. - Transcript cr; show: 'All known phrases in InternalTranslator: ' , InternalTranslator allKnownPhrases size printString. - Transcript cr; show: 'Coverage: ' , (keys size / InternalTranslator allKnownPhrases size * 100.0) printString , '%'. - diff inspect!
Item was removed: - ----- Method: GetTextExporter2 classSide>>verifyMsgID: (in category 'utilities') ----- - verifyMsgID: localeID - "GetTextExporter2 verifyMsgID: (LocaleID isoString: 'test-US')" - "InternalTranslator removeLocaleID: (LocaleID isoString: 'test-US')" - "Test gettext keyword extract function without file I/O. - A language named <langName> will be made. And - all possible translated words are shown with extra X charactor like - 'XwordX' in the language." - | src | - InternalTranslator removeLocaleID: localeID. - src := localeID translator. - self keys - do: [:key | src generics at: key put: 'X' , key , 'X']!
Item was removed: - ----- Method: LanguageEditor>>selectedTranslationsAt: (in category 'accessing') ----- - selectedTranslationsAt: index - ^ selectedTranslations includes: index!
Item was removed: - ----- Method: LanguageEditor>>getTextImport (in category 'gui methods') ----- - getTextImport - | menu | - menu := MenuMorph new defaultTarget: self. - menu addTitle: 'Choose translation file' translated. - menu add: 'All *.po files' translated action: #getTextImportAll. - menu add: 'Choose a file' translated action: #getTextImportAFile. - menu popUpInWorld!
Item was removed: - ----- Method: GetTextExporter2>>exportHeaderLineKey:value: (in category 'private') ----- - exportHeaderLineKey: keyString value: valueString - stream nextPut: $"; - nextPutAll: keyString; - nextPut: $:; - space; - nextPutAll: valueString; - nextPutAll: '\n'; - nextPut: $"; - cr.!
Item was removed: - ----- Method: LanguageEditor>>translations (in category 'accessing') ----- - translations - "answet the translator's translations" - | allTranslations filterString | - translations ifNotNil: [^translations]. - allTranslations := self translator translations keys. - "" - filterString := self translationsFilter. - "" - filterString isEmpty - ifFalse: [allTranslations := allTranslations - select: [:each | "" - ('*' , filterString , '*' match: each) - or: ['*' , filterString , '*' - match: (self translator translate: each)]]]. - "" - ^ translations _ allTranslations asSortedCollection asArray!
Item was removed: - ----- Method: LanguageEditor>>searchUntranslated (in category 'gui methods') ----- - searchUntranslated - | search | - search := FillInTheBlank request: 'search for' translated initialAnswer: ''. - (search isNil - or: [search isEmpty]) - ifTrue: ["" - self beep. - ^ self]. - "" - self searchUntranslated: search!
Item was removed: - ----- Method: GetTextExporter2>>dirNameDomain:translator: (in category 'exporting') ----- - dirNameDomain: domain translator: translator - "Answer a file name for the domain. Make one if it is not exist yet. - Make template file name if translator is nil" - "self new dirNameDomain: 'etoys' translator: - NaturalLanguageTranslator current" - "self new dirNameDomain: 'etoys' translator: nil" - | fileName dirName pathName | - "safeCategory := category copyReplaceAll: ' ' with: '_'." - fileName := translator - ifNil: [domain , '.pot'] - ifNotNil: [translator localeID posixName , '.po']. - dirName := 'po', FileDirectory slash, domain. - pathName := dirName , FileDirectory slash , fileName. - (FileDirectory default directoryNamed: dirName) assureExistence. - ^ pathName!
Item was removed: - ----- Method: GetTextExporter2>>createHeaders (in category 'private') ----- - createHeaders - | headers | - headers := OrderedCollection new. - headers add: 'Project-Id-Version' -> 'eToys'. - headers add: 'POT-Creation-Date' -> self currentDateAndTime. - headers add: 'PO-Revision-Date' -> self currentDateAndTime. - headers add: 'Last-Translator' -> ''. - headers add: 'Language-Team' -> ''. - headers add: 'MIME-Version' -> '1.0'. - headers add: 'Content-Type' -> ('text/plain; charset=', stream converter class encodingNames first). - headers add: 'Content-Transfer-Encoding' -> '8bit'. - headers add: 'X-Etoys-SystemVersion' -> (SystemVersion current asString). - ^ headers!
Item was removed: - ----- Method: LanguageEditor>>codeSelectedTranslationAsMimeString (in category 'gui methods') ----- - codeSelectedTranslationAsMimeString - | keys code tmpStream s2 gzs cont | - keys := selectedTranslations - collect: [:key | self translations at: key]. - code := String - streamContents: [:aStream | self translator fileOutOn: aStream keys: keys withBOM: false]. - - tmpStream _ MultiByteBinaryOrTextStream on: ''. - tmpStream converter: UTF8TextConverter new. - tmpStream nextPutAll: code. - s2 _ RWBinaryOrTextStream on: ''. - gzs := GZipWriteStream on: s2. - tmpStream reset. - gzs nextPutAll: (tmpStream binary contentsOfEntireFile asString) contents. - gzs close. - s2 reset. - - cont _ String streamContents: [:strm | - strm nextPutAll: '"Gzip+Base64 encoded translation for;'; cr. - strm nextPutAll: '#('. - keys do: [:each | strm nextPutAll: '''', each, ''' '.]. - strm nextPutAll: ')"'; cr; cr. - strm nextPutAll: 'NaturalLanguageTranslator loadForLocaleIsoString: '. - strm nextPut: $'. - strm nextPutAll: translator localeID isoString. - strm nextPut: $'. - strm nextPutAll: ' fromGzippedMimeLiteral: '. - strm nextPut: $'. - strm nextPutAll: (Base64MimeConverter mimeEncode: s2) contents. - strm nextPutAll: '''.'. - strm cr. - ]. - - (StringHolder new contents: cont) - openLabel: 'exported codes in Gzip+Base64 encoding' translated!
Item was removed: - ----- Method: LanguageEditor>>selectTranslationPhrase: (in category 'gui methods') ----- - selectTranslationPhrase: phraseString - self selectedTranslation: (self translations indexOf: phraseString)!
Item was removed: - ----- Method: GetTextExporter2 classSide>>verifyExport (in category 'utilities') ----- - verifyExport - "Same as #verifyMsgID: but it writes / reads .po files actually" - "GetTextExporter2 verifyExport" - "InternalTranslator removeLocaleID: (LocaleID isoString: 'test-US')" - | src dst localeID | - localeID := LocaleID isoString: 'test-US'. - self verifyMsgID: localeID. - src := localeID translator. - GetTextExporter2 new exportTranslator: src. - InternalTranslator removeLocaleID: localeID. - dst := localeID translator. - GetTextImporter import: dst allDirectory: FileDirectory default!
Item was removed: - ----- Method: LanguageEditor>>printReportOn: (in category 'reporting') ----- - printReportOn: aStream - "append to aStream a report of the receiver with swiki format" - self printHeaderReportOn: aStream. - self printUntranslatedReportOn: aStream. - self printTranslationsReportOn: aStream!
Item was removed: - ----- Method: GetTextExporter2 classSide>>listAllHelp (in category 'utilities') ----- - listAllHelp - "self listAllHelp" - | spec specs oCatalog flap flapSelectors allKeys oCatalogHelp flapHelp | - oCatalog := Dictionary new. - Morph withAllSubclasses - do: [:aClass | (aClass class includesSelector: #descriptionForPartsBin) - ifTrue: [spec := aClass descriptionForPartsBin. - oCatalog at: spec formalName put: spec documentation]]. - Morph withAllSubclasses - do: [:aClass | (aClass class includesSelector: #supplementaryPartsDescriptions) - ifTrue: [specs := aClass supplementaryPartsDescriptions. - specs - do: [:each | oCatalog at: each formalName put: each documentation]]]. - flap := Dictionary new. - flapSelectors := #(#defaultsQuadsDefiningPlugInSuppliesFlap #defaultsQuadsDefiningStackToolsFlap #defaultsQuadsDefiningSuppliesFlap #defaultsQuadsDefiningToolsFlap #defaultsQuadsDefiningWidgetsFlap #defaultsQuadsDefiningScriptingFlap ). - flapSelectors - do: [:selector | - specs := Flaps perform: selector. - specs - do: [:each | flap at: each third put: each fourth]]. - allKeys := oCatalog keys intersection: flap keys. - allKeys asArray sort - do: [:each | - oCatalogHelp := oCatalog - at: each - ifAbsent: ['']. - flapHelp := flap - at: each - ifAbsent: ['']. - oCatalogHelp = flapHelp - ifFalse: [Transcript cr; show: 'Name: ' , each. - Transcript cr; show: 'O: ' , oCatalogHelp. - Transcript cr; show: 'F: ' , flapHelp. - Transcript cr. - - ]]!
Item was removed: - ----- Method: LanguageEditor class>>initialize (in category 'initialize-release') ----- - initialize - "initialize the receiver" - (TheWorldMenu respondsTo: #registerOpenCommand:) - ifTrue: ["" - TheWorldMenu registerOpenCommand: {'Language Editor' translated. {self. #openOnDefault}}. - TheWorldMenu registerOpenCommand: {'Language Editor for...' translated. {self. #open}}]!
Item was removed: - ----- Method: GetTextExporter2>>exportInformation: (in category 'private') ----- - exportInformation: anOrderedCollection - anOrderedCollection do: [:each | - self exportRecordHeader: each second. - self exportPhrase: each third translation: '']. - stream cr.!
Item was removed: - ----- Method: LanguageEditor>>createMainToolbar (in category 'initialization - toolbar') ----- - createMainToolbar - "create a toolbar for the receiver" - | toolbar | - toolbar := self createRow. - "" - " toolbar - addMorphBack: (self - createUpdatingButtonWording: #debugWording - action: #switchDebug - help: 'Switch the debug flag')." - toolbar addTransparentSpacerOfSize: 5 @ 0. - "" - toolbar - addMorphBack: (self - createButtonLabel: 'new' - action: #newTranslations - help: 'Create translations for new language.'). - toolbar - addMorphBack: (self - createButtonLabel: 'save' - action: #saveToFile - help: 'Save the translations to a file'). - toolbar - addMorphBack: (self - createButtonLabel: 'load' - action: #loadFromFile - help: 'Load the translations from a file'). - toolbar - addMorphBack: (self - createButtonLabel: 'merge' - action: #mergeFromFile - help: 'Merge the current translations with the translations in a file'). - "" - toolbar addTransparentSpacerOfSize: 5 @ 0. - toolbar - addMorphBack: (self - createButtonLabel: 'apply' - action: #applyTranslations - help: 'Apply the translations as much as possible.'). - "" - toolbar addTransparentSpacerOfSize: 5 @ 0. - toolbar - addMorphBack: (self - createButtonLabel: 'check translations' - action: #check - help: 'Check the translations and report the results.'). - toolbar - addMorphBack: (self - createButtonLabel: 'report' - action: #report - help: 'Create a report.'). - toolbar - addMorphBack: (self - createButtonLabel: 'gettext' - action: #getText - help: 'Interface with gettext.'). - "" - ^ toolbar!
Item was removed: - ----- Method: LanguageEditor>>mergeFromFile (in category 'gui methods') ----- - mergeFromFile - | fileName | - fileName := self selectTranslationFileName. - fileName isNil - ifTrue: ["" - self beep. - ^ self]. - "" - Cursor wait - showWhile: [ - self translator loadFromFileNamed: fileName. - self refreshBoth]!
Item was removed: - ----- Method: LanguageEditor>>translation (in category 'accessing') ----- - translation - "answer the translation for the selected phrase" - self selectedTranslation isZero - ifTrue: [^ '<select a phrase from the upper list>' translated]. - "" - ^ self translator - translate: (self translations at: self selectedTranslation)!
Item was removed: - ----- Method: LanguageEditor>>getTextExport (in category 'gui methods') ----- - getTextExport - Cursor wait - showWhile: [GetTextExporter2 new exportTranslator: self model]!
Item was removed: - ----- Method: LanguageEditor>>filterTranslations (in category 'gui methods') ----- - filterTranslations - | filter | - filter := FillInTheBlank request: 'filter with - (empty string means no-filtering)' translated initialAnswer: self translationsFilter. - "" - self filterTranslations: filter!
Item was removed: - ----- Method: GetTextExporter2>>exportRecordHeader: (in category 'private') ----- - exportRecordHeader: context - stream - nextPutAll: '#: '; - nextPutAll: context; - cr.!
Item was removed: - ----- Method: LanguageEditor>>browseMethodsWithUntranslated (in category 'gui methods') ----- - browseMethodsWithUntranslated - | untrans | - self selectedUntranslated isZero - ifTrue: ["" - self beep. - self inform: 'select the untrans phrase to look for' translated. - ^ self]. - "" - untrans := self untranslated at: self selectedUntranslated. - SystemNavigation default browseMethodsWithLiteral: untrans. - !
Item was removed: - ----- Method: LanguageEditor>>selectedUntranslated (in category 'accessing') ----- - selectedUntranslated - "answer the selectedUntranslated" - ^ selectedUntranslated!
Item was removed: - ----- Method: LanguageEditor>>untranslatedKeystroke: (in category 'gui methods') ----- - untranslatedKeystroke: aChar - "Respond to a Command key in the translations list." - aChar == $t - ifTrue: [^ self translate]. - aChar == $E - ifTrue: [^ self browseMethodsWithUntranslated]!
Item was removed: - ----- Method: LanguageEditor>>filterTranslations: (in category 'gui methods') ----- - filterTranslations: aString - | filter | - filter := aString ifNil:['']. - "" - translationsFilter _ filter. - self refreshTranslations. - !
Item was removed: - ----- 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 := (PopUpMenu - labelArray: (results - collect: [:each | each copy replaceAll: Character cr with: $])) - startUpWithCaption: 'select the untranslated phrase...' translated. - "" - index isZero - ifTrue: ["" - self beep. - ^ self]. - "" - self - selectUntranslatedPhrase: (results at: index)!
Item was removed: - ----- Method: LanguageEditor>>deselectAllTranslation (in category 'gui methods') ----- - deselectAllTranslation - selectedTranslations := IdentitySet new. - self changed: #allSelections!
Item was removed: - ----- Method: LanguageEditor>>check (in category 'private') ----- - check - "check the translations and answer a collection with the results" - | results counter phrasesCount checkMethod | - results := OrderedCollection new. - untranslated := self untranslated. - phrasesCount := self translations size + self untranslated size. - counter := 0. - checkMethod := self class checkMethods at: self translator localeID printString ifAbsent: [^results]. - - self translations - keysAndValuesDo: [:phrase :translation | - | result | - result := self perform: checkMethod with: phrase with: translation. - (result notNil - and: [result notEmpty]) - ifTrue: [results add: {phrase. translation. result}]. - - counter := counter + 1. - (counter isDivisibleBy: 50) - ifTrue: [| percent | - percent := counter / phrasesCount * 100 roundTo: 0.01. - Transcript - show: ('- checked {1} phrases of {2} ({3}%)...' translated format: {counter. phrasesCount. percent}); - cr]]. - - self untranslated - do: [:phrase | - | result | - result := self checkUntranslatedPhrase: phrase. - (result notNil - and: [result notEmpty]) - ifTrue: [results add: {phrase. nil. result}]. - - counter := counter + 1. - (counter isDivisibleBy: 50) - ifTrue: [| percent | - percent := counter / phrasesCount * 100 roundTo: 0.01. - Transcript - show: ('- checked {1} phrases of {2} ({3}%)...' translated format: {counter. phrasesCount. percent}); - cr]]. - - ^ results!
Item was removed: - ----- Method: GetTextExporter2>>dirNameCategory:translator: (in category 'exporting') ----- - dirNameCategory: category translator: translator - "Answer a file name for the category. Make one if it is not exist yet. - Make template file name if translator is nil" - "self new dirNameCategory: 'Morphic-Scripting Support' translator: - NaturalLanguageTranslator current" - "self new dirNameCategory: 'Morphic-Scripting Support' translator: nil" - | safeCategory fileName dirName pathName | - safeCategory := category copyReplaceAll: ' ' with: '_'. - fileName := translator - ifNil: [safeCategory , '.pot'] - ifNotNil: [translator localeID posixName , '.po']. - dirName := (safeCategory findTokens: '-') - inject: 'po' - into: [:aString :next | aString , FileDirectory slash , next]. - pathName := dirName , FileDirectory slash , fileName. - (FileDirectory default directoryNamed: dirName) assureExistence. - ^ pathName!
Item was removed: - ----- Method: GetTextExporter2>>exportPhrase:translation: (in category 'private') ----- - exportPhrase: phraseString translation: translationString - | normalizedTrans tmp transStartsWithCR transEndsWithCR| - phraseString isEmpty - ifTrue: [^ self]. - self exportTag: 'msgid' msg: phraseString. - translationString size = 0 ifTrue: [ - normalizedTrans _ '' - ] ifFalse: [ - transEndsWithCR _ translationString last = (Character cr). - phraseString last = (Character cr) ifTrue: [ - transEndsWithCR ifTrue: [ - normalizedTrans _ translationString - ] ifFalse: [ - normalizedTrans _ translationString , String cr - ] - ] ifFalse: [ - transEndsWithCR ifTrue: [ - normalizedTrans _ translationString allButLast - ] ifFalse: [ - normalizedTrans _ translationString - ] - ]. - transStartsWithCR _ normalizedTrans first = (Character cr). - phraseString first = (Character cr) ifTrue: [ - transStartsWithCR ifFalse: [ - tmp _ (Character cr asString) , normalizedTrans. - normalizedTrans _ tmp. - ] - ] ifFalse: [ - transStartsWithCR ifTrue: [ - normalizedTrans _ normalizedTrans allButFirst - ] - ] - ]. - self exportTag: 'msgstr' msg: normalizedTrans. - stream cr!
Item was removed: - ----- Method: LanguageEditor>>printTranslationsReportOn: (in category 'reporting') ----- - printTranslationsReportOn: aStream - "append to aStream a report of the receiver's translations" - | originalPhrases | - aStream nextPutAll: '!!'; - nextPutAll: 'translations' translated; - cr. - - originalPhrases := self translator translations keys asSortedCollection. - - originalPhrases - do: [:each | - aStream - nextPutAll: ('|{1}|{2}|' format: {self asHtml: each. self - asHtml: (self translator translate: each)}); - cr]. - - aStream cr; cr!
Item was removed: - ----- Method: LanguageEditor>>getTextExportTemplate (in category 'gui methods') ----- - getTextExportTemplate - Cursor wait - showWhile: [GetTextExporter2 new exportTemplate] !
Item was removed: - ----- Method: LanguageEditor>>createUpdatingButtonWording:action:help: (in category 'initialization - toolbar') ----- - createUpdatingButtonWording: wordingSelector action: actionSelector help: helpString - "create a toolbar for the receiver" - | button | - button := (UpdatingSimpleButtonMorph newWithLabel: '-') target: self; - wordingSelector: wordingSelector; - actionSelector: actionSelector; - setBalloonText: helpString translated; - color: translator defaultBackgroundColor twiceDarker; - borderWidth: 1; - borderColor: #raised; cornerStyle: #square. - "" - ^ button!
Item was removed: - ----- Method: LanguageEditor>>selectedTranslation (in category 'accessing') ----- - selectedTranslation - "answer the selectedTranslation" - ^ selectedTranslation!
Item was removed: - ----- Method: GetTextExporter2>>createExtraInformation (in category 'private') ----- - createExtraInformation - | extras | - extras := OrderedCollection new. - #( - 'Language name as you''d like it to appear in the Languages menu' 'Language-Name' - 'Scale to apply to font size (2 for twice as large)' 'Font-Scale' - 'Directionality of language' 'Language-Direction' - 'Use this if you do not want any of the text to be bolded, for legibility' 'Suppress-Bold' - 'Font to use on a Windows system' 'Win-Font' - 'Font to use on a Mac system' 'Mac-Font' - 'Font to use on a Linux system' 'Linux-Font') pairsDo: [:first :second | - extras add: (Array with: '' with: first with: second). - ]. - ^ extras!
Item was removed: - ----- Method: LanguageEditor>>loadFromFile (in category 'gui methods') ----- - loadFromFile - | fileName | - fileName := self selectTranslationFileName. - fileName isNil - ifTrue: ["" - self beep. - ^ self]. - "" - Cursor wait - showWhile: [ - self translator loadFromFileNamed: fileName. - self refreshBoth]!
Item was removed: - ----- Method: GetTextExporter2>>export:translator:domain: (in category 'private') ----- - export: literals translator: translator domain: domainName - | fileName | - "Export a gettext file in a category. literals is a dictionary of keyword -> #(MethodReference...) in the textDomain." - fileName := self dirNameDomain: domainName translator: translator. - [stream := FileStream forceNewFileNamed: fileName. - stream lineEndConvention: #lf. - stream converter: UTF8TextConverter new. - self exportHeader: domainName. - self exportInformation: self createExtraInformation. - self exportBody: literals translator: translator] - ensure: [stream close]!
Item was removed: - ----- Method: LanguageEditor>>createUntranslatedToolbar (in category 'initialization - toolbar') ----- - createUntranslatedToolbar - "create a toolbar for the receiver" - | toolbar | - toolbar := self createRow. - "" - toolbar - addMorphBack: (self - createUpdatingButtonWording: #untranslatedFilterWording - action: #filterUntranslated - help: 'Filter the untranslated list.'). - toolbar addTransparentSpacerOfSize: 5 @ 0. - "" - toolbar - addMorphBack: (self - createButtonLabel: 'search' - action: #searchUntranslated - help: 'Search for a untranslated phrase containing...'). - toolbar addTransparentSpacerOfSize: 5 @ 0. - toolbar - addMorphBack: (self - createButtonLabel: 'remove' - action: #removeUntranslated - help: 'Remove the selected untranslated phrease. If none is selected, ask for the one to remove.'). - "" - toolbar addTransparentSpacerOfSize: 5 @ 0. - toolbar - addMorphBack: (self - createButtonLabel: 'translate' - action: #translate - help: 'Translate the selected untranslated phrase or a new phrase'). - "" - toolbar addTransparentSpacerOfSize: 5 @ 0. - toolbar - addMorphBack: (self - createButtonLabel: 'where' - action: #browseMethodsWithUntranslated - help: 'Launch a browser on all methods that contain the phrase as a substring of any literal String.'). - toolbar addTransparentSpacerOfSize: 5 @ 0. - toolbar - addMorphBack: (self - createButtonLabel: 'r-unused' - action: #removeUntranslatedButUnusedStrings - help: 'Remove all the strings that are not used by the system'). - ^ toolbar!
Item was removed: - ----- Method: LanguageEditor class>>ensureVisibilityOfWindow: (in category 'private') ----- - ensureVisibilityOfWindow: aWindow - "private - activate the window" - | | - aWindow expand. - aWindow comeToFront. - "" - aWindow - right: (aWindow right min: World right). - aWindow - bottom: (aWindow bottom min: World bottom). - aWindow - left: (aWindow left max: World left). - aWindow - top: (aWindow top max: World top). - "" - aWindow flash; flash!
Item was removed: - ----- Method: LanguageEditor>>withUnboundModelDo: (in category 'private') ----- - withUnboundModelDo: aBlock - "Private - Evaluate aBlock with the receiver temporary - unbound from the model. - - Useful to perform a batch of modifications to the model - without updating the view." - | formerModel | - formerModel := self model. - self model: nil. - [aBlock value: formerModel] - ensure: [self model: formerModel]!
Item was removed: - ----- Method: LanguageEditor>>checkPhrase:translation: (in category 'private') ----- - checkPhrase: phraseString translation: translationString - ^nil!
Item was removed: - ----- Method: LanguageEditor>>createStatusbar (in category 'initialization - statusbar') ----- - createStatusbar - "create the statusbar for the receiver" - | statusbar | - statusbar := self createRow. - statusbar addMorph: ((UpdatingStringMorph on: self selector: #status) growable: true; - useStringFormat; - hResizing: #spaceFill; - stepTime: 2000). - ^ statusbar!
Item was removed: - ----- Method: GetTextExporter2 classSide>>exportTemplate (in category 'utilities') ----- - exportTemplate - "GetTextExporter2 exportTemplate" - self new exportTemplate.!
Item was removed: - ----- Method: GetTextExporter2>>exportTag:singleLine: (in category 'private') ----- - exportTag: tag singleLine: aString - stream nextPutAll: tag. - stream space. - stream nextPut: $". - stream - nextPutAll: (self formatString: aString). - stream nextPut: $". - stream cr!
Item was removed: - ----- Method: LanguageEditor>>newTranslations (in category 'gui methods') ----- - newTranslations - "private - try to apply the translations as much as possible all - over the image" - | result newID | - result := FillInTheBlank request: 'New locale ID string?' translated initialAnswer: Locale current determineLocaleID isoString. - result isEmpty - ifTrue: ["Do nothing" - ^ self]. - newID := LocaleID isoString: result. - InternalTranslator - newLocaleID: (LocaleID isoString: result). - self class openOn: newID!
Item was removed: - ----- Method: GetTextExporter>>exportUntranslated (in category 'private-translations') ----- - exportUntranslated - | keys | - keys := language untranslated keys asArray sort. - ProgressInitiationException - display: 'Exporting untranslated phrases as a gettext file.' - at: Sensor cursorPoint - from: 1 - to: keys size - during: [:bar | 1 - to: keys size - do: [:index | - self - exportPhrase: (keys at: index) - translation: ''. - bar value: index]]!
Item was removed: - ----- Method: LanguageEditor>>perform:orSendTo: (in category 'message handling') ----- - perform: selector orSendTo: otherTarget - "I wish to intercept and handle selector myself" - ^ self perform: selector!
Item was removed: - ----- Method: GetTextExporter2>>exportTemplate (in category 'exporting') ----- - exportTemplate - "GetTextExporter2 new exportTemplate" - self exportTranslator: nil!
Item was removed: - ----- Method: LanguageEditor>>translationsMenu: (in category 'gui methods') ----- - translationsMenu: aMenu - ^ aMenu add: 'remove (x)' translated action: #removeTranslation; - add: 'where (E)' translated action: #browseMethodsWithTranslation; - add: 'select all' translated action: #selectAllTranslation; - add: 'deselect all' translated action: #deselectAllTranslation; - add: 'select changed keys' translated action: #selectNewerKeys; - add: 'export selection' translated action: #codeSelectedTranslation; - add: 'export selection in do-it form' translated action: #codeSelectedTranslationAsMimeString; - add: 'reset changed keys' translated action: #resetNewerKeys; - yourself!
Item was removed: - ----- Method: LanguageEditor>>translatePhrase: (in category 'gui methods') ----- - translatePhrase: aString - "translate aString" - | translation | - translation := FillInTheBlank - multiLineRequest: 'translation for: ' translated , '''' , aString , '''' - centerAt: Sensor cursorPoint - initialAnswer: aString - answerHeight: 200. - "" - (translation isNil - or: [translation = '']) - ifTrue: ["" - self beep. - ^ self]. - "" - self phrase: aString translation: translation!
Item was removed: - ----- Method: LanguageEditor>>printUntranslatedReportOn: (in category 'reporting') ----- - printUntranslatedReportOn: aStream - "append to aStream a report of the receiver's translations" - aStream nextPutAll: '!!'; - nextPutAll: 'not translated' translated; - cr. - - self untranslated asSortedCollection - do: [:each | - aStream - nextPutAll: ('|{1}|' format: {self asHtml: each}); - cr]. - - aStream cr; cr!
Item was removed: - ----- Method: LanguageEditor>>initializeStatusbar (in category 'initialization - statusbar') ----- - initializeStatusbar - "initialize the receiver's statusbar" - self - addMorph: self createStatusbar - frame: (0 @ 0.93 corner: 1 @ 1)!
Item was removed: - ----- Method: LanguageEditor>>filterUntranslated: (in category 'gui methods') ----- - filterUntranslated: aString - | filter | - filter := aString - ifNil: ['']. - "" - untranslatedFilter := filter. - self refreshUntranslated!
Item was removed: - ----- Method: LanguageEditor>>untranslatedMenu: (in category 'gui methods') ----- - untranslatedMenu: aMenu - ^ aMenu add: 'remove' translated action: #removeUntranslated; - add: 'translate (t)' translated action: #translate; - add: 'where (E)' translated action: #browseMethodsWithUntranslated; - yourself!
Item was removed: - ----- Method: GetTextExporter2 classSide>>exportAll (in category 'utilities') ----- - exportAll - "GetTextExporter2 exportAll" - self new exportTemplate. - InternalTranslator availableLanguageLocaleIDs - do: [:each | self new exportTranslator: each translator]!
Item was removed: - ----- Method: GetTextExporter>>export: (in category 'exporting') ----- - export: aLanguage - language := aLanguage. - [stream := FileStream forceNewFileNamed: self defaultFileName. - stream lineEndConvention: #lf. - stream converter: UTF8TextConverter new. - self exportHeader. - self exportTranslations. - self exportUntranslated] - ensure: [stream close]!
Item was removed: - ----- Method: LanguageEditor>>removeTranslation (in category 'gui methods') ----- - removeTranslation - "remove the selected translation" - | translation | - self selectedTranslation isZero - ifTrue: ["" - 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 refreshBoth!
Item was removed: - ----- Method: LanguageEditor>>removeTranslatedButUnusedStrings (in category 'stef') ----- - removeTranslatedButUnusedStrings - (self confirm: 'Are you sure that you want to remove unused strings?' translated) - ifFalse: [^ self]. - translationsList getList - do: [:each | - | timesUsed | - timesUsed := self numberOfTimesStringIsUsed: each. - Transcript show: each. - Transcript show: timesUsed printString; - cr. - timesUsed isZero - ifTrue: [self translator removeTranslationFor: each]]!
Item was removed: - ----- Method: LanguageEditor>>asHtml: (in category 'reporting') ----- - asHtml: aString - | stream | - stream := String new writeStream. - - aString - do: [:each | - each caseOf: { - [Character cr] -> [stream nextPutAll: '<br>']. - [$&] -> [stream nextPutAll: '&']. - [$<] -> [stream nextPutAll: '<']. - [$>] -> [stream nextPutAll: '>']. - [$*] -> [stream nextPutAll: '☆']. - [$@] -> [stream nextPutAll: '&at;']} - otherwise: [stream nextPut: each]]. - - ^ stream contents!
Item was removed: - ----- Method: GetTextExporter2>>stream (in category 'accessing') ----- - stream - ^ stream!
Item was removed: - ----- Method: LanguageEditor>>translate (in category 'gui methods') ----- - translate - "translate a phrase" - | phrase | - phrase := self phraseToTranslate. - "" - (phrase isNil - or: [phrase = '']) - ifTrue: ["" - self beep. - ^ self]. - "" - self translatePhrase: phrase. - self refreshBoth!
Item was removed: - ----- Method: LanguageEditor>>update: (in category 'updating') ----- - update: aSymbol - "Receive a change notice from an object of whom the receiver - is a dependent." - super update: aSymbol. - "" - aSymbol == #untranslated - ifTrue: [self refreshUntranslated]. - aSymbol == #translations - ifTrue: [self refreshTranslations]!
Item was removed: - ----- Method: LanguageEditor>>selectAllTranslation (in category 'gui methods') ----- - selectAllTranslation - selectedTranslations := (1 to: self translations size) asIdentitySet. - self changed: #allSelections!
Item was removed: - ----- Method: GetTextExporter2 classSide>>keys (in category 'utilities') ----- - keys - | categories | - categories := Dictionary new. - GetTextExporter2 new appendTranslations: categories. - ^ categories values - inject: Set new - into: [:set :next | set addAll: next keys; - yourself]!
Item was removed: - ----- Method: LanguageEditor class>>on: (in category 'instance creation') ----- - on: localeID - "answer an instance of the receiver on aLanguage" - ^ self new - initializeOn: (InternalTranslator cachedTranslations - at: localeID - ifAbsent: [self - error: ('Translator for {1} is not found' translated format: {localeID})])!
Item was removed: - ----- Method: GetTextExporter2>>exportBody:translator: (in category 'file out') ----- - exportBody: literals translator: translator - "Export a gettext file body. literals is a dictionary of keyword -> - #(MethodReference...) in the textDomain." - "Build {sortKey. comment. msgid } to optimize sorting (getting category is - too slow). - If there are two or more methods for a mgsid, only first method - (alphabetical) is used for sorting." - | sorted msgid sortedMethods category sortKey comment triplets commentUnderLined | - triplets := literals associations - collect: [:assoc | - msgid := assoc key. - sortedMethods := assoc value asArray sort. - category := (Smalltalk at: sortedMethods first classSymbol) category asString. - sortKey := category , ',' , sortedMethods first printString , ',' , msgid. - comment := (sortedMethods - collect: [:each | each actualClass asString , '>>' , each methodSymbol asString]) - inject: category - into: [:result :methodName | result , ',' , methodName]. - "Replace white spaces to _ because gettext tool might - replace a space to a new line some times, and it makes - difficult to take a diff." - commentUnderLined := comment copyReplaceAll: ' ' with: '_'. - Array - with: sortKey - with: commentUnderLined - with: msgid]. - "Sort and output the words" - sorted := triplets - sort: [:a :b | a first <= b first]. - sorted - do: [:triplet | - comment := triplet second. - msgid := triplet third. - self exportRecordHeader: comment. - self - exportPhrase: msgid - translation: (self translationFor: msgid in: translator)]!
Item was removed: - ----- Method: LanguageEditor>>refreshTranslations (in category 'updating') ----- - refreshTranslations - "refresh the translations panel" - self selectedTranslation: 0. - translations := nil. - self changed: #translations. - !
Item was removed: - ----- Method: LanguageEditor>>getTextImportAFile (in category 'gui methods') ----- - getTextImportAFile - | result | - result := (StandardFileMenu new pattern: '*.po'; - - oldFileFrom: (FileDirectory default directoryNamed: 'po')) startUpWithCaption: 'Select a File:' translated. - result - ifNil: [^ self]. - self - withUnboundModelDo: [:trans | Cursor wait - showWhile: [GetTextImporter new - import: trans - fileNamed: (result directory fullNameFor: result name)]]!
Item was removed: - ----- Method: LanguageEditor>>status (in category 'gui methods') ----- - status - "answer a status string" - | translationsSize untranslatedSize | - translationsSize := self translator translations size. - untranslatedSize := self translator untranslated size. - ^ '| {1} phrases | {2} translated | {3} untranslated |' translated format: {translationsSize + untranslatedSize. translationsSize. untranslatedSize}!
Item was removed: - ----- Method: LanguageEditor>>phrase:translation: (in category 'gui methods') ----- - phrase: phraseString translation: translationString - "set the models's translation for phraseString" - self translator phrase: phraseString translation: translationString. - self refreshBoth. - - newerKeys add: phraseString. - !
Item was removed: - ----- Method: LanguageEditor>>createRow (in category 'initialization - toolbar') ----- - createRow - "create a row" - | row | - row := AlignmentMorph newRow. - row layoutInset: 3; - wrapCentering: #center; - cellPositioning: #leftCenter. - "" - ^ row!
Item was removed: - ----- Method: LanguageEditor>>browseMethodsWithTranslation (in category 'gui methods') ----- - browseMethodsWithTranslation - | translation | - self selectedTranslation isZero - ifTrue: ["" - self beep. - self inform: 'select the translation to look for' translated. - ^ self]. - "" - translation := self translations at: self selectedTranslation. - self systemNavigation browseMethodsWithLiteral: translation!
Item was removed: - ----- Method: LanguageEditor>>removeUntranslated (in category 'gui methods') ----- - removeUntranslated - "remove the selected untranslated phrase" - | untrans | - self selectedUntranslated isZero - ifTrue: ["" - self beep. - self inform: 'select the untranslated phrase to remove' translated. - ^ self]. - "" - untrans := self untranslated at: self selectedUntranslated. - "" - (self - confirm: ('Removing "{1}". - Are you sure you want to do this?' translated format: {untrans})) - ifFalse: [^ self]. - "" - self translator removeUntranslated: untrans!
Item was removed: - ----- Method: LanguageEditor>>untranslated (in category 'accessing') ----- - untranslated - "answer the translator's untranslated phrases" - - - | all filterString | - untranslated ifNotNil: [^ untranslated]. - all := self translator untranslated. - "" - filterString := self untranslatedFilter. - "" - filterString isEmpty - ifFalse: [all := all - select: [:each | "" - ('*' , filterString , '*' match: each) - or: ['*' , filterString , '*' - match: (self translator translate: each)]]]. - "" - ^ untranslated _ all asSortedCollection asArray!
Item was removed: - ----- Method: LanguageEditor>>okToChange (in category 'updating') ----- - okToChange - "Allows a controller to ask this of any model" - self selectedTranslation isZero - ifTrue: [^ true]. - "" - translationText hasUnacceptedEdits - ifFalse: [^ true]. - ^ (CustomMenu confirm: 'Discard the changes to currently selected translated phrase?' translated) - and: ["" - translationText hasUnacceptedEdits: false. - true]!
Item was removed: - ----- Method: GetTextExporter2>>appendStringReceivers:into: (in category 'private') ----- - appendStringReceivers: aSymbol into: domains - | literals references domainName methodReference keywords found | - - found := TranslatedReceiverFinder new stringReceiversWithContext: aSymbol. - found do: [ :assoc | - methodReference := assoc key. - keywords := assoc value. - domainName _ self getTextDomainForPackage: - (PackageOrganizer default packageOfMethod: methodReference ifNone: [TextDomainManager defaultDomain]). - literals _ domains at: domainName ifAbsentPut: [Dictionary new]. - keywords do: [ :literal | - references _ literals at: literal ifAbsentPut: [OrderedCollection new]. - references add: methodReference. - ]. - ]. - !
Item was removed: - ----- Method: LanguageEditor>>selectTranslationFileName (in category 'gui methods') ----- - selectTranslationFileName - "answer a file with a translation" - | file | - file := (StandardFileMenu oldFileMenu: FileDirectory default withPattern: '*.translation') - startUpWithCaption: 'Select the file...' translated. - ^ file isNil - ifFalse: [file directory fullNameFor: file name]!
Item was removed: - ----- Method: LanguageEditor class>>checkMethods (in category 'private') ----- - checkMethods - ^CheckMethods ifNil: [CheckMethods := self initCheckMethods]!
Item was removed: - ----- Method: LanguageEditor>>selectedUntranslated: (in category 'accessing') ----- - selectedUntranslated: anInteger - "change the selectedUntranslated" - selectedUntranslated := anInteger. - "" - self changed: #selectedUntranslated!
Item was removed: - ----- Method: LanguageEditor>>translationsFilter (in category 'accessing') ----- - translationsFilter - ^translationsFilter ifNil:['']!
Item was removed: - ----- Method: GetTextExporter2>>formatReplacements (in category 'private') ----- - formatReplacements - | replacements | - replacements := OrderedCollection new. - replacements add: '' -> '\'. - replacements add: String cr -> '\n'. - replacements add: String tab -> '\t'. - replacements add: '"' -> '"'. - ^ replacements!
Item was removed: - ----- Method: LanguageEditor>>searchTranslation: (in category 'gui methods') ----- - searchTranslation: aString - | results index | - results := self translations - select: [:each | "" - ('*' , aString , '*' match: each) - or: ['*' , aString , '*' match: (self translator translate: each)]]. - "" - results isEmpty - ifTrue: ["" - self inform: 'no matches for' translated , ' ''' , aString , ''''. - ^ self]. - "" - results size = 1 - ifTrue: ["" - self selectTranslationPhrase: results first. - ^ self]. - "" - index := (PopUpMenu - labelArray: (results - collect: [:each | "" - (each copy replaceAll: Character cr with: $) - , ' -> ' - , ((self translator translate: each) copy replaceAll: Character cr with: $)])) - startUpWithCaption: 'select the translation...' translated. - "" - index isZero - ifTrue: ["" - self beep. - ^ self]. - "" - self - selectTranslationPhrase: (results at: index)!
Item was removed: - ----- Method: LanguageEditor class>>initCheckMethods (in category 'initialize-release') ----- - initCheckMethods - "LanguageEditor initCheckMethods" - - | registry | - registry := Dictionary new. - registry - at: 'es' put: #checkSpanishPhrase:translation:; - yourself. - ^registry!
Item was removed: - ----- Method: LanguageEditor>>phraseToTranslate (in category 'gui methods') ----- - phraseToTranslate - "answer a phrase to translate. use the selected untranslated phrase or ask for a new one" - ^ self selectedUntranslated isZero - ifTrue: [FillInTheBlank - multiLineRequest: 'new phrase to translate' translated - centerAt: Sensor cursorPoint - initialAnswer: '' - answerHeight: 200] - ifFalse: [self untranslated at: self selectedUntranslated]!
Item was removed: - ----- Method: LanguageEditor>>filterUntranslated (in category 'gui methods') ----- - filterUntranslated - | filter | - filter := FillInTheBlank request: 'filter with - (empty string means no-filtering)' translated initialAnswer: self untranslatedFilter. - "" - self filterUntranslated: filter!
Item was removed: - ----- Method: LanguageEditor>>report (in category 'gui methods') ----- - report - self reportString openInWorkspaceWithTitle: 'report' translated!
Item was removed: - ----- Method: LanguageEditor>>createTranslationsToolbar (in category 'initialization - toolbar') ----- - createTranslationsToolbar - "create a toolbar for the receiver" - | toolbar | - toolbar := self createRow. - "" - toolbar - addMorphBack: (self - createUpdatingButtonWording: #translationsFilterWording - action: #filterTranslations - help: 'Filter the translations list.'). - toolbar addTransparentSpacerOfSize: 5 @ 0. - "" - toolbar - addMorphBack: (self - createButtonLabel: 'search' - action: #searchTranslation - help: 'Search for a translation containing...'). - toolbar addTransparentSpacerOfSize: 5 @ 0. - toolbar - addMorphBack: (self - createButtonLabel: 'remove' - action: #removeTranslation - help: 'Remove the selected translation. If none is selected, ask for the one to remove.'). - "" - toolbar addTransparentSpacerOfSize: 5 @ 0. - toolbar - addMorphBack: (self - createButtonLabel: 'where' - action: #browseMethodsWithTranslation - help: 'Launch a browser on all methods that contain the phrase as a substring of any literal String.'). - toolbar addTransparentSpacerOfSize: 5 @ 0. - toolbar - addMorphBack: (self - createButtonLabel: 'r-unused' - action: #removeTranslatedButUnusedStrings - help: 'Remove all the strings that are not used by the system'). - toolbar addTransparentSpacerOfSize: 5 @ 0. - toolbar - addMorphBack: (self - createButtonLabel: 'add ' - action: #addTranslation - help: 'Add a new phrase'). - - ^ toolbar!
Item was removed: - ----- Method: LanguageEditor>>codeSelectedTranslation (in category 'gui methods') ----- - codeSelectedTranslation - | keys code | - keys := selectedTranslations - collect: [:key | self translations at: key]. - code := String - streamContents: [:aStream | self translator fileOutOn: aStream keys: keys withBOM: false]. - (StringHolder new contents: code) - openLabel: 'exported codes' translated!
Item was removed: - ----- Method: GetTextExporter2>>exportTag:msg: (in category 'private') ----- - exportTag: tag msg: aString - | pos end line | - (aString indexOf: Character cr) - = 0 - ifTrue: [self exportTag: tag singleLine: aString] - ifFalse: [self exportTag: tag singleLine: ''. - pos := 1. - end := 0. - [end < aString size] - whileTrue: [end := aString indexOf: Character cr startingAt: pos. - end = 0 - ifTrue: [end := aString size]. - line := aString copyFrom: pos to: end. - stream nextPut: $"; - - nextPutAll: (self formatString: line); - nextPut: $"; - cr. - pos := end + 1]]!
Item was removed: - ----- Method: LanguageEditor>>selectNewerKeys (in category 'gui methods') ----- - selectNewerKeys - - | index | - self deselectAllTranslation. - newerKeys do: [:k | - index _ self translations indexOf: k ifAbsent: [0]. - index > 0 ifTrue: [ - self selectedTranslationsAt: index put: true - ]. - ]. - !
Item was removed: - ----- Method: GetTextExporter2>>currentDateAndTime (in category 'private') ----- - currentDateAndTime - ^ String - streamContents: [:aStream | - aStream nextPutAll: Date today yyyymmdd; - space. - Time now - print24: true - showSeconds: false - on: aStream. - aStream nextPutAll: '-0000']!
Item was removed: - ----- Method: LanguageEditor>>checkSpanishPhrase:translation: (in category 'private') ----- - checkSpanishPhrase: phraseString translation: translationString - "check the translation and aswer a string with a comment or a - nil meaning no-comments" - | superResult | - superResult := self checkPhrase: phraseString translation: translationString. - superResult isNil - ifFalse: [^ superResult]. - "For some reason, MCInstaller couldn't read Spanish character. " - "((translationString includes: $?) - and: [(translationString includes: $¿) not]) - ifTrue: [^ '¿Olvidó el signo de pregunta?']. - ((translationString includes: $!!) - and: [(translationString includes: $¡) not]) - ifTrue: [^ '¿Olvidó el signo de admiración?']. - " - ^ nil - !
Item was removed: - ----- Method: LanguageEditor>>getTextImportAll (in category 'gui methods') ----- - getTextImportAll - self - withUnboundModelDo: [:trans | Cursor wait - showWhile: [GetTextImporter import: trans allDirectory: FileDirectory default]]. - self refreshBoth!
Item was removed: - ----- Method: LanguageEditor>>initializeNewerKeys (in category 'initialization') ----- - initializeNewerKeys - - newerKeys _ Set new. - !
Item was removed: - ----- Method: GetTextExporter>>exportHeader (in category 'private-headers') ----- - exportHeader - self exportTag: 'msgid' msg: ''. - self exportTag: 'msgstr' msg: ''. - self createHeaders - do: [:each | self exportHeaderLineKey: each key value: each value]. - stream cr; cr!
Item was removed: - SystemWindow subclass: #LanguageEditor - instanceVariableNames: 'translator translations untranslated selectedTranslation selectedTranslations selectedUntranslated translationsList untranslatedList translationText translationsFilter untranslatedFilter newerKeys' - classVariableNames: 'CheckMethods' - poolDictionaries: '' - category: 'GetText-Editor'! - - !LanguageEditor commentStamp: 'dgd 11/16/2003 15:02' prior: 0! - Editor for Babel's languages. - - Open it from - - World Menu >> open... >> Language Editor (to open on default language) - World Menu >> open... >> Language Editor for... (to choose the language) - - Or click: - - LanguageEditor openOnDefault. - LanguageEditor open. - - See http://swiki.agro.uba.ar/small_land/191 for documentation - !
Item was removed: - ----- Method: GetTextExporter2>>getTextDomainForPackage: (in category 'as yet unclassified') ----- - getTextDomainForPackage: aPackageInfo - ^TextDomainManager domainForPackage: aPackageInfo!
Item was removed: - Object subclass: #GetTextExporter2 - instanceVariableNames: 'stream' - classVariableNames: '' - poolDictionaries: '' - category: 'GetText-Editor'! - - !GetTextExporter2 commentStamp: '<historical>' prior: 0! - Export translations to gettext format divided into categories. - - "Export gettext template files" - GetTextExporter2 new exportTemplate. - - "Export translation files for current locale" - GetTextExporter2 new exportTranslator: (InternalTranslator newLocaleID: LocaleID current). - - "Export all gettext template and po files." - GetTextExporter2 exportAll. - - "To register a class category as a new domain" - TextDomainManager registerClassCategory: 'Morphic-Books' domain: 'Book'. - "Remove a class category" - TextDomainManager unregisterClassCategory: 'Morphic-Books'.!
Item was removed: - ----- Method: LanguageEditor>>selectedTranslation: (in category 'accessing') ----- - selectedTranslation: anInteger - "change the receiver's selectedTranslation" - selectedTranslation := anInteger. - "" - self changed: #selectedTranslation. - self changed: #translation!
Item was removed: - ----- Method: LanguageEditor>>searchTranslation (in category 'gui methods') ----- - searchTranslation - | search | - search := FillInTheBlank request: 'search for' translated initialAnswer: ''. - (search isNil - or: [search isEmpty]) - ifTrue: ["" - self beep. - ^ self]. - "" - self searchTranslation: search!
Item was removed: - ----- Method: LanguageEditor>>removeUntranslatedButUnusedStrings (in category 'stef') ----- - removeUntranslatedButUnusedStrings - (self confirm: 'Are you sure that you want to remove unused strings?' translated) - ifFalse: [^ self]. - untranslatedList getList - do: [:each | - | timesUsed | - timesUsed := self numberOfTimesStringIsUsed: each. - Transcript show: each. - Transcript show: timesUsed printString; - cr. - timesUsed isZero - ifTrue: [self translator removeUntranslated: each]]. - - self refreshUntranslated. - !
Item was removed: - ----- Method: LanguageEditor>>resetNewerKeys (in category 'gui methods') ----- - resetNewerKeys - - self initializeNewerKeys. - !
Item was removed: - ----- Method: GetTextExporter2>>exportHeader: (in category 'private') ----- - exportHeader: domainName - | headers | - self exportTag: 'msgid' msg: ''. - self exportTag: 'msgstr' msg: ''. - headers := self createHeaders. - headers add: 'X-Etoys-Domain' -> domainName. - headers do: [:each | self exportHeaderLineKey: each key value: each value]. - stream cr; cr!
Item was removed: - ----- Method: GetTextExporter2>>appendVocabularies: (in category 'private') ----- - appendVocabularies: domains - | literalsForDomain references domainName methodReference | - - EToyVocabulary allPhrasesWithContextToTranslate do: [ :r | - methodReference := (MethodReference new setStandardClass: (r second) methodSymbol: (r third)). - "domainName _ self getTextDomainForPackage: (PackageOrganizer default packageOfMethod: methodReference)". - domainName := 'Etoys-Tiles'. - literalsForDomain _ domains at: domainName ifAbsentPut: [Dictionary new]. - r fourth do: [ :literal | - references _ literalsForDomain at: literal ifAbsentPut: [OrderedCollection new]. - references add: methodReference. - ]. - ]. - !
Item was removed: - ----- Method: LanguageEditor>>selectUntranslatedPhrase: (in category 'gui methods') ----- - selectUntranslatedPhrase: phraseString - self - selectedUntranslated: (self untranslated indexOf: phraseString)!
Item was removed: - ----- Method: LanguageEditor class>>openOn: (in category 'instance creation') ----- - openOn: aLanguage - "open an instance on aLanguage" - World submorphs - do: [:each | "" - ((each isKindOf: LanguageEditor) - and: [each translator == aLanguage]) - ifTrue: ["" - self ensureVisibilityOfWindow: each. - ^ self]]. - "" - ^ (self on: aLanguage) openInWorld!
Item was removed: - ----- Method: LanguageEditor>>untranslatedFilterWording (in category 'gui methods') ----- - untranslatedFilterWording - ^ self untranslatedFilter isEmpty - ifTrue: ['filter' translated] - ifFalse: ['filtering: {1}' translated format: {self untranslatedFilter}]!
Item was removed: - ----- Method: LanguageEditor>>saveToFile (in category 'gui methods') ----- - saveToFile - "save the translator to a file" - | fileName | - fileName := FillInTheBlank request: 'file name' translated initialAnswer: translator localeID isoString , '.translation'. - (fileName isNil - or: [fileName isEmpty]) - ifTrue: ["" - self beep. - ^ self]. - "" - Cursor wait - showWhile: [ - self translator saveToFileNamed: fileName]!
Item was removed: - ----- Method: LanguageEditor>>initializeOn: (in category 'initialization') ----- - initializeOn: aLanguage - "initialize the receiver on aLanguage" - "" - selectedTranslation := 0. - selectedUntranslated := 0. - selectedTranslations := IdentitySet new. - "" - translator := aLanguage. - "" - self model: aLanguage. - self setLabel: 'Language editor for: ' translated , self translator name. - "" - self initializeToolbars. - self initializePanels. - self initializeStatusbar. - self initializeNewerKeys. - !
Item was removed: - ----- Method: LanguageEditor>>createButtonLabel:action:help: (in category 'initialization - toolbar') ----- - createButtonLabel: aString action: actionSelector help: helpString - "create a toolbar for the receiver" - | button | - button := SimpleButtonMorph new target: self; - label: aString translated "font: Preferences standardButtonFont"; - actionSelector: actionSelector; - setBalloonText: helpString translated; - color: translator defaultBackgroundColor twiceDarker; - borderWidth: 2; - borderColor: #raised. - "" - ^ button!
Item was removed: - ----- Method: LanguageEditor>>selectedTranslationsAt:put: (in category 'accessing') ----- - selectedTranslationsAt: index put: value - value = true - ifTrue: [selectedTranslations add: index] - ifFalse: [selectedTranslations - remove: index - ifAbsent: []]!
Item was removed: - ----- Method: GetTextExporter2>>formatString: (in category 'private') ----- - formatString: aString - | result | - result := aString. - self formatReplacements - do: [:each | result := result copyReplaceAll: each key with: each value]. - ^ result!
Item was removed: - ----- Method: LanguageEditor>>printHeaderReportOn: (in category 'reporting') ----- - printHeaderReportOn: aStream - "append to aStream a header report of the receiver with swiki - format" - aStream nextPutAll: '!!!!'; - - nextPutAll: ('Language: {1}' translated format: {self translator localeID isoString}); - cr. - - aStream nextPutAll: '- '; - - nextPutAll: ('{1} translated phrases' translated format: {self translator translations size}); - cr. - - aStream nextPutAll: '- '; - - nextPutAll: ('{1} untranslated phrases' translated format: {self translator untranslated size}); - cr. - - aStream cr; cr!
Item was removed: - ----- Method: LanguageEditor>>getText (in category 'gui methods') ----- - getText - | menu | - menu := MenuMorph new defaultTarget: self. - "" - menu - add: 'gettext template' translated - target: self - selector: #getTextExportTemplate. - menu lastItem setBalloonText: 'exports the translations to gettext separated format.' translated. - menu - add: 'gettext export' translated - target: self - selector: #getTextExport. - menu lastItem setBalloonText: 'Exports the translations to GetText format.' translated. - - "" - menu - add: 'gettext import' translated - target: self - selector: #getTextImport. - menu lastItem setBalloonText: 'Imports the translations from GetText format.' translated. - "" - menu popUpInWorld!
etoys-dev@lists.squeakfoundation.org