Where to set a session locale?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Where to set a session locale?

Georg Heeg
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Where to set a session locale?

Boris Popov, DeepCove Labs (SNN)
Georg,

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)
                ifFalse:
                        [IndexedFileMessageCatalog directoriesModel
                                value: ((IndexedFileMessageCatalog directories)
                                                add: path;
                                                yourself)].
        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,

-Boris

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

PacNet Services (Europe) Ltd.
+353 (0)61 714-360
Shannon Airport House, SFZ
County Clare, Ireland
http://tinyurl.com/y952amr

CONFIDENTIALITY NOTICE

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: [hidden email] [mailto:[hidden email]] 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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

AW: [Seaside] Where to set a session locale?

Georg Heeg
Boris,

Thank you. My question was slightly different: Where to place the
initialization of the session locale taken from the settings in the browser
as transferred in the http request?

Georg

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

> -----Ursprüngliche Nachricht-----
> Von: [hidden email] [mailto:seaside-
> [hidden email]] Im Auftrag von Boris Popov, DeepCove
> Labs
> Gesendet: Donnerstag, 21. Oktober 2010 10:18
> An: Seaside - general discussion
> Cc: Uta Seewald-Heeg
> Betreff: RE: [Seaside] Where to set a session locale?
>
> Georg,
>
> 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)
> ifFalse:
> [IndexedFileMessageCatalog directoriesModel
> value: ((IndexedFileMessageCatalog
> directories)
> add: path;
> yourself)].
> 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,
>
> -Boris
>
> --
> DeepCove Labs Ltd.
> +1 (604) 689-0322
> 4th floor, 595 Howe Street
> Vancouver, British Columbia
> Canada V6C 2T5
> http://tinyurl.com/r7uw4
>
> PacNet Services (Europe) Ltd.
> +353 (0)61 714-360
> Shannon Airport House, SFZ
> County Clare, Ireland
> http://tinyurl.com/y952amr
>
> CONFIDENTIALITY NOTICE
>
> 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: [hidden email] [mailto:seaside-
> [hidden email]] 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
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Where to set a session locale?

Boris Popov, DeepCove Labs (SNN)
Georg,

Ah,

YourApplicationRoot>>initialRequest: aRequest

        super initialRequest: aRequest.
        self session locale: #en_CA.

You could then pick a proper locale using the information gleaned from "aRequest acceptLanguage".

-Boris

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

PacNet Services (Europe) Ltd.
+353 (0)61 714-360
Shannon Airport House, SFZ
County Clare, Ireland
http://tinyurl.com/y952amr

CONFIDENTIALITY NOTICE

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: [hidden email] [mailto:[hidden email]] On Behalf Of Georg Heeg
Sent: 21 October 2010 09:42
To: 'Seaside - general discussion'
Cc: 'Uta Seewald-Heeg'
Subject: AW: [Seaside] Where to set a session locale?

Boris,

Thank you. My question was slightly different: Where to place the initialization of the session locale taken from the settings in the browser as transferred in the http request?

Georg

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

> -----Ursprüngliche Nachricht-----
> Von: [hidden email] [mailto:seaside-
> [hidden email]] Im Auftrag von Boris Popov,
> DeepCove Labs
> Gesendet: Donnerstag, 21. Oktober 2010 10:18
> An: Seaside - general discussion
> Cc: Uta Seewald-Heeg
> Betreff: RE: [Seaside] Where to set a session locale?
>
> Georg,
>
> 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)
> ifFalse:
> [IndexedFileMessageCatalog directoriesModel
> value: ((IndexedFileMessageCatalog
> directories)
> add: path;
> yourself)].
> 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,
>
> -Boris
>
> --
> DeepCove Labs Ltd.
> +1 (604) 689-0322
> 4th floor, 595 Howe Street
> Vancouver, British Columbia
> Canada V6C 2T5
> http://tinyurl.com/r7uw4
>
> PacNet Services (Europe) Ltd.
> +353 (0)61 714-360
> Shannon Airport House, SFZ
> County Clare, Ireland
> http://tinyurl.com/y952amr
>
> CONFIDENTIALITY NOTICE
>
> 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: [hidden email] [mailto:seaside-
> [hidden email]] 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
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside