[Seaside] Re: [Pharo-users] i18n tools

Panu Suominen panu.j.m.suominen at gmail.com
Sun Sep 12 19:01:11 UTC 2010


Because of the responses I have received here, I am pretty sure the
code I attached has no use for others, but
I decided to send it here anyways. I have had such hard time to find
any resources about translating text in seaside
that this can not make the situation much worse. :)

Attached change set will add asTranslation method to String class.
This method will create LazyTranslation
which does the actual translation "on the fly" when needed.

This approach enables seaside to translate text without using
translate: -method, but remember to use
the WALocalizationContextFilter with the application. Using render:
-will render the text
with the locale used by the session and text: will use the local of the image.

Also magritte forms get translated correctly without any modifications
to the magritte code. To use it write
descriptions following way:

descriptionEmail
	^MAStringDescription new
		accessor: #email;
		label: 'Email' asTranslation;
		addCondition: [:value | value includes: $@] labelled: 'Email is not
valid.' asTranslation;
		beRequired;
		priority: 10;
		yourself.

I know that the code is bad, but I really needed the feature. At least
I hope that I get a lots of reasons why
the approach I have taken is really a wrong way to go. Sorry to bother
you with this so much.

-- 
Panu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gettext-translation.1.cs
Type: text/x-csharp
Size: 2590 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100912/df4c31f3/gettext-translation.1.bin


More information about the seaside mailing list