Tim Felgentreff uploaded a new version of GetText to project The Trunk:
http://source.squeak.org/trunk/GetText-tfel.40.mcz ==================== Summary ==================== Name: GetText-tfel.40 Author: tfel Time: 5 August 2016, 3:52:12.522259 pm UUID: 7a16aac5-9583-3b49-8c90-2d5b6eed882e Ancestors: GetText-tfel.39 update the exporter to also catch dynamic translations =============== Diff against GetText-ul.38 =============== Item was changed: Object subclass: #GetTextExporter instanceVariableNames: 'stream' classVariableNames: '' poolDictionaries: '' category: 'GetText-Editor'! + !GetTextExporter commentStamp: 'tfel 8/4/2016 16:18' prior: 0! - !GetTextExporter commentStamp: '<historical>' prior: 0! Export translations to gettext format divided into categories. "Export gettext template files" GetTextExporter new exportTemplate. "Export translation files for current locale" + GetTextExporter new exportTranslator: (NaturalLanguageTranslator current). - GetTextExporter new exportTranslator: (InternalTranslator newLocaleID: LocaleID current). "Export all gettext template and po files." GetTextExporter exportAll. ! Item was added: + ----- Method: GetTextExporter>>appendTranslationsAlreadyIn:to: (in category 'exporting') ----- + appendTranslationsAlreadyIn: translator to: domains + | d | + translator moFiles keysAndValuesDo: [:domain :mo | + mo ifNotNil: [ + d := domains at: domain ifAbsentPut: [Dictionary new]. + mo translations keysAndValuesDo: [:key :translation | + d at: key asString ifAbsentPut: [{MethodReference class: Object selector: #yourself}]]]]! Item was changed: ----- Method: GetTextExporter>>createExtraInformation (in category 'private') ----- createExtraInformation | extras | extras := OrderedCollection new. #( + 'ATTENTION TRANSLATORS!! This should be the name of your language as you would like it to appear in the Languages menu, e.g. "EspaƱol" or "English"' 'Language-Name' + 'ATTENTION TRANSLATORS!! Put in the directionality of your language, that is "LTR" for left-to-right or "RTL" for right-to-left' 'Language-Direction' - 'Language name as you''d like it to appear in the Languages menu' 'Language-Name' - 'Directionality of language' 'Language-Direction' ) 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 stream nextPutAll: tag. stream space. + aString ifEmpty: [stream nextPutAll: '""'; cr. ^ self]. aString lineIndicesDo: [:start :endWithoutDelimiters :end | | line | line := (end = endWithoutDelimiters) ifTrue: [aString copyFrom: start to: endWithoutDelimiters] ifFalse: [(aString at: endWithoutDelimiters + 1) = Character cr ifTrue: [aString copyFrom: start to: endWithoutDelimiters + 1] ifFalse: [(aString copyFrom: start to: endWithoutDelimiters) copyWith: Character cr]]. stream nextPut: $"; nextPutAll: (self formatString: line); nextPut: $"; cr].! Item was changed: ----- 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. + self appendTranslationsAlreadyIn: translator to: domains. domains keysAndValuesDo: [:domainName :value | self export: value translator: translator domain: domainName]! Item was changed: ----- Method: GetTextExporter>>translationFor:in: (in category 'private') ----- translationFor: aKey in: translator | translation | translator ifNil: [^ '']. TextDomainManager allKnownDomains do: [:domain | translation := translator translate: aKey inDomain: domain. aKey = translation ifFalse: [^translation] ]. + ^ ''! - ^ aKey! |
Free forum by Nabble | Edit this page |