[Seaside-dev] Seaside-Gettext sneak peak

Philippe Marschall philippe.marschall at gmail.com
Sun May 9 18:14:45 UTC 2010


Hi

Up until now if you wanted to have a multilingual Seaside application
in Pharo you had to "roll your own" which can be a bit uncool. Hilaire
ported the gettext package from the OLPC to Pharo and I wrote a small
Seaside layer on top of it.

What you need:
1. update to the very latest Seaside 3.0
2. unzip the attached file in your image folder
3. load Gettext from PharoInbox
4. load Seaside-Gettext-Core from [1]
5. load Seaside-Gettext-Examples from [1]
6. go to http://127.0.0.1:8080/gettext

Usage:
Right now the API is:

html translate: 'text to translate'
html translate: 'other text to translate' to: aWALocale

which renders the translation. This has the problem that is doesn't
work for attributes, I'll need to come up with a solution for this,
API proposals are welcome.

Gettext Workflow:
1. write your application using the API above
2. register your domain. A domain is a way to group strings, you might
have Pier and a reporting application running in the same image and
want each to use it's own dictionary:
TextDomainManager registerCategoryPrefix: 'Seaside-Gettext-Examples'
domain: 'gettext'
3. export the template
WAGetTextExporter new exportTemplate
4. create the translation files e.g. using poedit [2]
5. put the translation files in locale/<locale>/LC_MESSAGES/<domain>.(po|mo)
6. done

One of the nice things about gettext is that there are external tools
like poedit [2] to manage the translation files which you can give to
your translators. No more need to mess around with Excel. There are
also tools [3] that display how much of your application is already
translated.

 [1] http://www.squeaksource.com/Seaside29Addons
 [2] http://www.poedit.net/
 [3] http://l10n.gnome.org/languages/de/gnome-office/ui/

Cheers
Philippe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: locale.zip
Type: application/zip
Size: 7841 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/seaside-dev/attachments/20100509/b0d98fe6/locale.zip


More information about the seaside-dev mailing list