[Seaside] Where to set a session locale?

Boris Popov, DeepCove Labs boris at deepcovelabs.com
Thu Oct 21 08:18:20 UTC 2010


If you load Seaside-I18N you'll have access to a new filter that sets the locale for the session via,

self session locale: #en_CA

The only catch (and it's a biggie that I hope Cincom addresses soon given their push for web applications) is that current versions of VisualWorks do not support multiple message catalogues per-image out-of-the-box. I have the following hack in place to get around that,

MessageCatalogManager class>>updateCatalogs

	| id manager |
	 id := Locale current languageID.
	 manager := self new: id.
	 MessageCatalog withAllSubclasses do: [:class | class catalogsDo: [:catalog | manager add: catalog]].

and I manually force load of all catalogues via,

MyApplicationRoot class>>refreshCatalogs

	| path |
	path := '.\messages' asLogicalFileSpecification.
	(IndexedFileMessageCatalog directories includes: path)
			[IndexedFileMessageCatalog directoriesModel
				value: ((IndexedFileMessageCatalog directories)
						add: path;
	IndexedFileMessageCatalog compileAllCatalogsInSearchDirectories.
	MessageCatalogManager.Managers values do: [:ea | ea flushCatalogs].
	[self supportedLanguages do: 
			[:lang |
			Locale current: lang locale.
			IndexedFileMessageCatalog updateDirectories.
			MessageCatalogManager updateCatalogs].
	UserMessage flushCaches]
			ensure: [Locale current: self supportedLanguages first locale].

Hope this helps,


DeepCove Labs Ltd.
+1 (604) 689-0322
4th floor, 595 Howe Street
Vancouver, British Columbia
Canada V6C 2T5

PacNet Services (Europe) Ltd.
+353 (0)61 714-360
Shannon Airport House, SFZ
County Clare, Ireland


This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments.

Thank you.

-----Original Message-----
From: seaside-bounces at lists.squeakfoundation.org [mailto:seaside-bounces at lists.squeakfoundation.org] On Behalf Of Georg Heeg
Sent: 21 October 2010 07:26
To: 'Seaside - general discussion'
Cc: Uta Seewald-Heeg
Subject: [Seaside] Where to set a session locale?

I am currently working with a group of master students of software localization at Anhalt University on project to localize seaBreeze, the seaBreeze editor, seaBreeze documentation, seaBreeze tutorial and on a framework to create multilingual seaBreeze applications easily.

Thus I looked into Seaside how to embed our ideas and I got pretty happy:
Seaside 3.0 has all the infrastructure needed to create multilingual web applications. VisualWorks UserMessage lookup uses Seaside session information to get to the right locale. That's all great.

Now I have a question: Where shall I set the session locale? Actually my idea is to initialize it from the 'accept-language' property of the WARequest if it is not yet set in the session. I think the statement should look like this:

	self someMessage session locale ifNil: [self someMessage session
locale: (self someOtherMessage request acceptLanguage)]

Hints are welcome.

Georg Heeg

Georg Heeg eK, Dortmund und Köthen, HR Dortmund A 12812 Tel. +49-3496-214328, Fax +49-3496-214712

seaside mailing list
seaside at lists.squeakfoundation.org

More information about the seaside mailing list