[etoys-dev] Translation support

Bert Freudenberg bert at freudenbergs.de
Tue May 4 15:28:07 EDT 2010


On 04.05.2010, at 10:14, Ricardo Moran wrote:
> I'm watching the packages of all the methods with translations in it and I found some methods that don't belong to any package:
> 
> a MethodReference Flaps class >> newNCPartsBinFlap
> a MethodReference Flaps class >> newConnectorsFlap
> a MethodReference TestRunner class >> descriptionForPartsBin
> a MethodReference Flaps class >> newClassDiagramConnectorsFlap
> a MethodReference TestRunner class >> windowColorSpecification
> a MethodReference Flaps class >> quadsDefiningFSMConnectorsFlap
> a MethodReference Flaps class >> quadsDefiningConnectorsFlap
> a MethodReference TestRunner class >> registerInFlapsRegistry
> 
> I used the following code (again, I may have made a mistake):
> ==============
> domains := Dictionary new.
> 
> "Count tile phrases"
> GetTextExporter2 new appendVocabularies: domains.
> 
> "Count tile phrases"
> GetTextExporter2 new 
> 		appendStringReceivers: #translated into: domains;
> 		appendStringReceivers: #translatedNoop into: domains.
> 
> phrases := Set new.
> domains do: [:domain | domain do: [:translations | translations do: [:each | phrases add: each]]].
> 
> phrases select: [:each| (PackageOrganizer default packageOfMethod: each ifNone: [nil]) isNil]
> ==============
> 
> The methods from Flaps clearly belong to "Connectors". But what should we do with the others? Move it to the same package of their class? Also, why they don't belong to any package? Isn't that an error?
> 
> Richo


Yes, it's an error. I had some code that checked for unpackaged methods but it was faulty and did not find them:

	| packaged |
	packaged := false.
	MCWorkingCopy managersForClass: Flaps class selector: #newConnectorsFlap
		do: [:wc | packaged := true ].
	packaged

So that Monticello code is buggy :( Below I have a snippet that does work (but make sure there are no spurious MC packages in the MC browser before).

I will move the methods to their proper package.

Also, there are some packages registered that do not correspond to a Monticello package anymore:

	PackageOrganizer default packages difference: (MCWorkingCopy allManagers collect: [:ea | ea packageInfo])

I just posted an update to fix that.

- Bert -

"Find all unpackaged classes and methods by category"
| allClasses allMethods packagedClasses packagedMethods unpackagedClasses unpackagedMethods |
(PackageOrganizer default packages difference: (MCWorkingCopy allManagers collect: [:wc | wc packageInfo])) do: [:pkg | PackageOrganizer default unregisterPackage: pkg].
allClasses := Smalltalk allClasses.
allMethods := SystemNavigation default selectAllMethods: [:m |
	m selector ifNil: [false] ifNotNilDo: [:sel | sel isDoIt not]].
packagedClasses := Set new.
packagedMethods := Set new.
PackageOrganizer default packages do: [:pkg |
	packagedClasses addAll: pkg classes.
	packagedMethods addAll: pkg methods].
unpackagedClasses := Dictionary new.
unpackagedMethods := Dictionary new.
(allClasses difference: packagedClasses) do: [:cls |
	(unpackagedClasses at: cls category asString ifAbsentPut: [OrderedCollection new])
		add: cls.
	allMethods := allMethods reject: [:m | cls name = m classSymbol]].
(allMethods difference: packagedMethods) do: [:mref |
	(unpackagedMethods at: mref category asString ifAbsentPut: [OrderedCollection new])
		add: mref].
{unpackagedClasses. unpackagedMethods} explore
-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: http://lists.squeakland.org/pipermail/etoys-dev/attachments/20100504/9dc33b14/attachment.html


More information about the etoys-dev mailing list