[squeak-dev] The Trunk: GetText-ul.38.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Jul 28 16:04:57 UTC 2016
Levente Uzonyi uploaded a new version of GetText to project The Trunk:
http://source.squeak.org/trunk/GetText-ul.38.mcz
==================== Summary ====================
Name: GetText-ul.38
Author: ul
Time: 28 July 2016, 6:04:51.67039 pm
UUID: 391f6add-8779-418e-aca7-8b3f282fd463
Ancestors: GetText-mt.37
- fixed two erroneous underscore conversions
=============== Diff against GetText-mt.37 ===============
Item was changed:
----- 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: '_'.
- 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 changed:
----- 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 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: '_'.
- 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)]!
More information about the Squeak-dev
mailing list
|