Etoys: GetText-bf.15.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Etoys: GetText-bf.15.mcz

commits-2
Bert Freudenberg uploaded a new version of GetText to project Etoys:
http://source.squeak.org/etoys/GetText-bf.15.mcz

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

Name: GetText-bf.15
Author: bf
Time: 24 June 2012, 6:19:43 pm
UUID: 094ae43c-61bb-4f27-a5c4-40d7f39a9a94
Ancestors: GetText-Richo.14

If a literal was marked as translatable, but no strings are found in it, then export the symbols. Normally, only strings are exported, not symbols.

=============== Diff against GetText-Richo.14 ===============

Item was changed:
  ----- Method: TranslatedReceiverFinder>>findWordsWith:in: (in category 'accessing') -----
  findWordsWith: aSymbol in: aMethodReference
  "Find words for translation with the symbol in a method. See
  LanguageEditorTest >>testFindTranslatedWords"
  "| message |
  message := MethodReference new setStandardClass: Morph class
  methodSymbol: #supplementaryPartsDescriptions.
+ self new findWordsWith: #translatedNoop in: message"
- self new findWordsWIth: #translatedNoop in: message"
  | messages keywords aParseNode |
  aParseNode := aMethodReference decompile.
  "Find from string literal"
  messages := Set new.
  self
  search: aSymbol
  messageNode: aParseNode
  addTo: messages.
  keywords := OrderedCollection new.
  messages
  select: [:aMessageNode | aMessageNode receiver isMemberOf: LiteralNode]
+ thenDo: [:aMessageNode |
+ (self stringsIn: aMessageNode receiver key addTo: keywords)
+ ifFalse: [self symbolsIn: aMessageNode receiver key addTo: keywords]].
- thenDo: [:aMessageNode | aMessageNode receiver key
- literalStringsDo: [:literal | keywords add: literal]].
  "Find from array literal"
  self
  arraySearch: aSymbol
  messageNode: aParseNode
  addTo: keywords.
  ^ keywords!

Item was added:
+ ----- Method: TranslatedReceiverFinder>>stringsIn:addTo: (in category 'private') -----
+ stringsIn: aLiteral addTo: aCollection
+ "deeply find strings in aLiteral, add them to aCollection, answer true if any found"
+ | found |
+ found := false.
+ aLiteral literalStringsDo: [:literal |
+ found := true.
+ aCollection add: literal].
+ ^found!

Item was added:
+ ----- Method: TranslatedReceiverFinder>>symbolsIn:addTo: (in category 'private') -----
+ symbolsIn: aLiteral addTo: aCollection
+ "if no strings were found in aLiteral, but it was marked as translatable, use the symbols"
+ aLiteral isSymbol ifTrue: [aCollection add: aLiteral].
+ aLiteral isArray ifTrue: [
+ aLiteral do: [:each | self symbolsIn: each addTo: aCollection]].
+ !

_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev