[Sugar-devel] Translating etoys home screen

Bert Freudenberg bert at freudenbergs.de
Wed Oct 9 07:52:07 EDT 2013


On 09.10.2013, at 12:31, Chris Leonard <cjlhomeaddress at gmail.com> wrote:

> Bert,
> 
> Would this POT capture everything that is needed?
> 
> I can add it to Templates in Etoys and propagate it across langs.
> 
> If you set it up in an SVN directory, we could even work on pushing it
> to your repo, in the meantime, it would at least be in Pootle.


I'm attaching a zip resulting from running the snippet below which exports all translated strings from a project. In theory that could be used to automate project translations in the future. And if someone makes the gallery and tutorial projects translatable (by turning on the "translatable" property on the right strings and providing one translation at least) we could use the snippet to gather those strings, too.

- Bert -

| original translations msgids msgid msgstr ext |
original := LocaleID isoString: 'en'.
translations := Dictionary new.
msgids := Dictionary new.
World allMorphs do: [:m | (m isTextMorph and: [m translatable]) ifTrue: [
	msgid := (m translations at: original) asString.
	msgids at: m externalName put: msgid.
	m translations keysAndValuesDo: [:k :v |
		(translations at: k ifAbsentPut: [Dictionary new])
			at: msgid put: v asString]]].
translations keysAndValuesDo: [:locale :trans |
	ext := locale = original ifTrue: ['.pot'] ifFalse: ['-', locale asString,'.po'].
	FileStream fileNamed: 'Project-', Project current name, ext do: [:f |
		f lineEndConvention: #lf.
		msgids keys asSortedCollection do: [:name |
			msgid := msgids at: name.
			msgstr := trans at: msgid.
			locale = original ifTrue: [msgstr := ''].
			f nextPutAll: '#: ', Project current name, '.pr ', name; cr.
			f nextPutAll: 'msgid "', (msgid copyReplaceAll: String cr with: '\n'), '"'; cr.
			f nextPutAll: 'msgstr "', (msgstr copyReplaceAll: String cr with: '\n'), '"'; cr.
			f cr.]]]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Project-Home-PO.zip
Type: application/zip
Size: 2509 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20131009/edbb2ae2/attachment.zip>


More information about the Sugar-devel mailing list