Re: multilanguage (AA)

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

Re: multilanguage (AA)

pablo
Yes me too!

2010/11/15 <[hidden email]>
Send seaside mailing list submissions to
       [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
       http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
or, via email, send a message with subject or body 'help' to
       [hidden email]

You can reach the person managing the list at
       [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of seaside digest..."


Today's Topics:

  1. Re: multilanguage (AA)
  2. Re: making a read-only checkbox (Gilles Schtickzelle)
  3. Re: making a read-only checkbox (Diogenes Moreira)


----------------------------------------------------------------------

Message: 1
Date: Mon, 15 Nov 2010 12:04:21 +0000
From: AA <[hidden email]>
Subject: Re: [Seaside] multilanguage
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=US-ASCII

Yes, please! I'd love to hear details about how you did this...

Amir


On Sat, 13 Nov 2010 14:34:25 -0200
Sebastian Sastre <[hidden email]> wrote:

> Hi Carlos,
>
> our apps are trilingual and we basically implemented #translated in String to delegate what to do to the session. Then the session decides the destination language and delegates the translation to the polyglot helper we've made.
>
> Once you have that, all you need is a little webapp that allows you to edit the phrases of each translation.
>
> I can promise you that this is not big deal, maybe I should blog details about it
>
> sebastian


------------------------------

Message: 2
Date: Mon, 15 Nov 2010 12:17:07 +0100
From: Gilles Schtickzelle <[hidden email]>
Subject: Re: [Seaside] making a read-only checkbox
To: Seaside - general discussion <[hidden email]>
Message-ID:
       <AANLkTi=[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Ah yes thank you!

I had tried to add a 'disabled: true' but apparently I put it at the wrong
place and it wasn't working.
Now it's all good thanks.

On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:

> Hi Giles,
>
> I have a form with a bunch of checkboxes. I want some of them to be
>> disabled depending on wether some other are checked or not.
>> I just can't figure out how to make a read-only checkbox (so that it would
>> still show but would be greyed out).
>
>
> Try:
>
> html checkbox
>  value: true;
> disabled: true;
> with: 'a disabled checkbox'
>
>
> #disabled: works for all form elements.
>
>
>
>
>> Is there such a thing in seaside (optimally with jquery so they can be
>> updated on the fly when the user check/uncheck a box).
>>
>
> html checkbox
>  id: #myDisabledCheckbox;
> value: true;
> disabled: true;
>  with: 'a disabled checkbox'.
>  html checkbox
>  value: true;
> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
> (html jQuery this attributeAt: 'checked'));
>  with: 'mirror the other checkbox'
>
>
> To put this example together I Googled 'jQuery checkbox' - found
> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
> translated the result into Seaside jQuery.
>
> Hope this helps
>
> Nick
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20101115/68ef2694/attachment.html

------------------------------

Message: 3
Date: Mon, 15 Nov 2010 08:53:12 -0300
From: Diogenes Moreira <[hidden email]>
Subject: Re: [Seaside] making a read-only checkbox
To: Seaside - general discussion <[hidden email]>
Message-ID:
       <AANLkTi=3aFRs-3vDi_m2v119SV527ZU5R++=[hidden email]>
Content-Type: text/plain; charset=ISO-8859-1

Here the net, not only the fish...
The next when you need knows a property in a seaside object, take a
look to WAHtmlCanvas and WARenderCanvas, in that objects methods
seaside builds the htmls components. In your case, in your case the
object whon represent to checkbox is WACheckboxTag.
Otherwise, if the standars object don't have the properties/messages
(that is very extrange, but may be happend) that you need, you can use
message attributesAt:put: to set an other properties

Best Regards

2010/11/15, Gilles Schtickzelle <[hidden email]>:
> Ah yes thank you!
>
> I had tried to add a 'disabled: true' but apparently I put it at the wrong
> place and it wasn't working.
> Now it's all good thanks.
>
> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>
>> Hi Giles,
>>
>> I have a form with a bunch of checkboxes. I want some of them to be
>>> disabled depending on wether some other are checked or not.
>>> I just can't figure out how to make a read-only checkbox (so that it
>>> would
>>> still show but would be greyed out).
>>
>>
>> Try:
>>
>> html checkbox
>>  value: true;
>> disabled: true;
>> with: 'a disabled checkbox'
>>
>>
>> #disabled: works for all form elements.
>>
>>
>>
>>
>>> Is there such a thing in seaside (optimally with jquery so they can be
>>> updated on the fly when the user check/uncheck a box).
>>>
>>
>> html checkbox
>>  id: #myDisabledCheckbox;
>> value: true;
>> disabled: true;
>>  with: 'a disabled checkbox'.
>>  html checkbox
>>  value: true;
>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>> (html jQuery this attributeAt: 'checked'));
>>  with: 'mirror the other checkbox'
>>
>>
>> To put this example together I Googled 'jQuery checkbox' - found
>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>> translated the result into Seaside jQuery.
>>
>> Hope this helps
>>
>> Nick
>>
>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>>
>

--
Enviado desde mi dispositivo móvil


------------------------------

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


End of seaside Digest, Vol 95, Issue 30
***************************************


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

Re: multilanguage (blog post)

sebastianconcept@gmail.co
 

o/


On Nov 15, 2010, at 2:17 PM, Pablo Gancharov wrote:

Yes me too!

2010/11/15 <[hidden email]>
Send seaside mailing list submissions to
       [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
       http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
or, via email, send a message with subject or body 'help' to
       [hidden email]

You can reach the person managing the list at
       [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of seaside digest..."


Today's Topics:

  1. Re: multilanguage (AA)
  2. Re: making a read-only checkbox (Gilles Schtickzelle)
  3. Re: making a read-only checkbox (Diogenes Moreira)


----------------------------------------------------------------------

Message: 1
Date: Mon, 15 Nov 2010 12:04:21 +0000
From: AA <[hidden email]>
Subject: Re: [Seaside] multilanguage
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=US-ASCII

Yes, please! I'd love to hear details about how you did this...

Amir


On Sat, 13 Nov 2010 14:34:25 -0200
Sebastian Sastre <[hidden email]> wrote:

> Hi Carlos,
>
> our apps are trilingual and we basically implemented #translated in String to delegate what to do to the session. Then the session decides the destination language and delegates the translation to the polyglot helper we've made.
>
> Once you have that, all you need is a little webapp that allows you to edit the phrases of each translation.
>
> I can promise you that this is not big deal, maybe I should blog details about it
>
> sebastian


------------------------------

Message: 2
Date: Mon, 15 Nov 2010 12:17:07 +0100
From: Gilles Schtickzelle <[hidden email]>
Subject: Re: [Seaside] making a read-only checkbox
To: Seaside - general discussion <[hidden email]>
Message-ID:
       <AANLkTi=[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Ah yes thank you!

I had tried to add a 'disabled: true' but apparently I put it at the wrong
place and it wasn't working.
Now it's all good thanks.

On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:

> Hi Giles,
>
> I have a form with a bunch of checkboxes. I want some of them to be
>> disabled depending on wether some other are checked or not.
>> I just can't figure out how to make a read-only checkbox (so that it would
>> still show but would be greyed out).
>
>
> Try:
>
> html checkbox
>  value: true;
> disabled: true;
> with: 'a disabled checkbox'
>
>
> #disabled: works for all form elements.
>
>
>
>
>> Is there such a thing in seaside (optimally with jquery so they can be
>> updated on the fly when the user check/uncheck a box).
>>
>
> html checkbox
>  id: #myDisabledCheckbox;
> value: true;
> disabled: true;
>  with: 'a disabled checkbox'.
>  html checkbox
>  value: true;
> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
> (html jQuery this attributeAt: 'checked'));
>  with: 'mirror the other checkbox'
>
>
> To put this example together I Googled 'jQuery checkbox' - found
> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
> translated the result into Seaside jQuery.
>
> Hope this helps
>
> Nick
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20101115/68ef2694/attachment.html

------------------------------

Message: 3
Date: Mon, 15 Nov 2010 08:53:12 -0300
From: Diogenes Moreira <[hidden email]>
Subject: Re: [Seaside] making a read-only checkbox
To: Seaside - general discussion <[hidden email]>
Message-ID:
       <AANLkTi=3aFRs-3vDi_m2v119SV527ZU5R++=[hidden email]>
Content-Type: text/plain; charset=ISO-8859-1

Here the net, not only the fish...
The next when you need knows a property in a seaside object, take a
look to WAHtmlCanvas and WARenderCanvas, in that objects methods
seaside builds the htmls components. In your case, in your case the
object whon represent to checkbox is WACheckboxTag.
Otherwise, if the standars object don't have the properties/messages
(that is very extrange, but may be happend) that you need, you can use
message attributesAt:put: to set an other properties

Best Regards

2010/11/15, Gilles Schtickzelle <[hidden email]>:
> Ah yes thank you!
>
> I had tried to add a 'disabled: true' but apparently I put it at the wrong
> place and it wasn't working.
> Now it's all good thanks.
>
> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>
>> Hi Giles,
>>
>> I have a form with a bunch of checkboxes. I want some of them to be
>>> disabled depending on wether some other are checked or not.
>>> I just can't figure out how to make a read-only checkbox (so that it
>>> would
>>> still show but would be greyed out).
>>
>>
>> Try:
>>
>> html checkbox
>>  value: true;
>> disabled: true;
>> with: 'a disabled checkbox'
>>
>>
>> #disabled: works for all form elements.
>>
>>
>>
>>
>>> Is there such a thing in seaside (optimally with jquery so they can be
>>> updated on the fly when the user check/uncheck a box).
>>>
>>
>> html checkbox
>>  id: #myDisabledCheckbox;
>> value: true;
>> disabled: true;
>>  with: 'a disabled checkbox'.
>>  html checkbox
>>  value: true;
>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>> (html jQuery this attributeAt: 'checked'));
>>  with: 'mirror the other checkbox'
>>
>>
>> To put this example together I Googled 'jQuery checkbox' - found
>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>> translated the result into Seaside jQuery.
>>
>> Hope this helps
>>
>> Nick
>>
>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>>
>

--
Enviado desde mi dispositivo móvil


------------------------------

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


End of seaside Digest, Vol 95, Issue 30
***************************************

_______________________________________________
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: multilanguage (blog post)

Carlos Crosetti-3
great!  I will come back with feedback soon, thanks so much
----- Original Message -----
Sent: Tuesday, November 16, 2010 5:13 PM
Subject: Re: [Seaside] Re: multilanguage (blog post)

 

o/


On Nov 15, 2010, at 2:17 PM, Pablo Gancharov wrote:

Yes me too!

2010/11/15 <[hidden email]>
Send seaside mailing list submissions to
       [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
       http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
or, via email, send a message with subject or body 'help' to
       [hidden email]

You can reach the person managing the list at
       [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of seaside digest..."


Today's Topics:

  1. Re: multilanguage (AA)
  2. Re: making a read-only checkbox (Gilles Schtickzelle)
  3. Re: making a read-only checkbox (Diogenes Moreira)


----------------------------------------------------------------------

Message: 1
Date: Mon, 15 Nov 2010 12:04:21 +0000
From: AA <[hidden email]>
Subject: Re: [Seaside] multilanguage
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=US-ASCII

Yes, please! I'd love to hear details about how you did this...

Amir


On Sat, 13 Nov 2010 14:34:25 -0200
Sebastian Sastre <[hidden email]> wrote:

> Hi Carlos,
>
> our apps are trilingual and we basically implemented #translated in String to delegate what to do to the session. Then the session decides the destination language and delegates the translation to the polyglot helper we've made.
>
> Once you have that, all you need is a little webapp that allows you to edit the phrases of each translation.
>
> I can promise you that this is not big deal, maybe I should blog details about it
>
> sebastian


------------------------------

Message: 2
Date: Mon, 15 Nov 2010 12:17:07 +0100
From: Gilles Schtickzelle <[hidden email]>
Subject: Re: [Seaside] making a read-only checkbox
To: Seaside - general discussion <[hidden email]>
Message-ID:
       <AANLkTi=[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Ah yes thank you!

I had tried to add a 'disabled: true' but apparently I put it at the wrong
place and it wasn't working.
Now it's all good thanks.

On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:

> Hi Giles,
>
> I have a form with a bunch of checkboxes. I want some of them to be
>> disabled depending on wether some other are checked or not.
>> I just can't figure out how to make a read-only checkbox (so that it would
>> still show but would be greyed out).
>
>
> Try:
>
> html checkbox
>  value: true;
> disabled: true;
> with: 'a disabled checkbox'
>
>
> #disabled: works for all form elements.
>
>
>
>
>> Is there such a thing in seaside (optimally with jquery so they can be
>> updated on the fly when the user check/uncheck a box).
>>
>
> html checkbox
>  id: #myDisabledCheckbox;
> value: true;
> disabled: true;
>  with: 'a disabled checkbox'.
>  html checkbox
>  value: true;
> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
> (html jQuery this attributeAt: 'checked'));
>  with: 'mirror the other checkbox'
>
>
> To put this example together I Googled 'jQuery checkbox' - found
> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
> translated the result into Seaside jQuery.
>
> Hope this helps
>
> Nick
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20101115/68ef2694/attachment.html

------------------------------

Message: 3
Date: Mon, 15 Nov 2010 08:53:12 -0300
From: Diogenes Moreira <[hidden email]>
Subject: Re: [Seaside] making a read-only checkbox
To: Seaside - general discussion <[hidden email]>
Message-ID:
       <AANLkTi=3aFRs-3vDi_m2v119SV527ZU5R++=[hidden email]>
Content-Type: text/plain; charset=ISO-8859-1

Here the net, not only the fish...
The next when you need knows a property in a seaside object, take a
look to WAHtmlCanvas and WARenderCanvas, in that objects methods
seaside builds the htmls components. In your case, in your case the
object whon represent to checkbox is WACheckboxTag.
Otherwise, if the standars object don't have the properties/messages
(that is very extrange, but may be happend) that you need, you can use
message attributesAt:put: to set an other properties

Best Regards

2010/11/15, Gilles Schtickzelle <[hidden email]>:

> Ah yes thank you!
>
> I had tried to add a 'disabled: true' but apparently I put it at the wrong
> place and it wasn't working.
> Now it's all good thanks.
>
> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>
>> Hi Giles,
>>
>> I have a form with a bunch of checkboxes. I want some of them to be
>>> disabled depending on wether some other are checked or not.
>>> I just can't figure out how to make a read-only checkbox (so that it
>>> would
>>> still show but would be greyed out).
>>
>>
>> Try:
>>
>> html checkbox
>>  value: true;
>> disabled: true;
>> with: 'a disabled checkbox'
>>
>>
>> #disabled: works for all form elements.
>>
>>
>>
>>
>>> Is there such a thing in seaside (optimally with jquery so they can be
>>> updated on the fly when the user check/uncheck a box).
>>>
>>
>> html checkbox
>>  id: #myDisabledCheckbox;
>> value: true;
>> disabled: true;
>>  with: 'a disabled checkbox'.
>>  html checkbox
>>  value: true;
>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>> (html jQuery this attributeAt: 'checked'));
>>  with: 'mirror the other checkbox'
>>
>>
>> To put this example together I Googled 'jQuery checkbox' - found
>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>> translated the result into Seaside jQuery.
>>
>> Hope this helps
>>
>> Nick
>>
>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>>
>

--
Enviado desde mi dispositivo móvil


------------------------------

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


End of seaside Digest, Vol 95, Issue 30
***************************************

_______________________________________________
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: multilanguage (blog post)

Levente Uzonyi-2
In reply to this post by sebastianconcept@gmail.co
On Tue, 16 Nov 2010, Sebastian Sastre wrote:

> Okay, here: Multiligual web applications design ala Smalltalk

We implemented this a bit differently (in Seaside 2.8). In Squeak String
>> #translated is already used, so we're using #localized as the selector:

String >> localized

  | session |
  (session := WACurrentSession value) ifNil: [ ^self ].
  ^session translator
  translate: self
  inContext: session parent name

The context is important, because the same phrase may have different
translations in different contexts. There's a default context which is
used as a fallback during lookup. If a phrase doesn't have a translation
in the requested context, the default context is used. There's also String
>> #localizedInContext: which lets you pass a custom context if necessary.

There's a global Translator singleton that maps languages to translators
(for that language). A translator for a language has a single dictionary
which maps context-phrase pairs to their translations. All phrases are in
english by default, so there's no lookup if the language is english.

The translator objects are cached by the session.

The db is looked up every time a translation is missing for a
context-phrase pair. If there's a match in the database, then it's stored,
otherwise not.

Concurrent access is implemented by copy-on-write. This may sound
inefficient, but it works well with a few thousand phrases and less than
100 contexts.

We also have a decoration which collects translations on the current page.
This allows the user (editor) to translate them during viewing. It's
implemented with notifications.


Levente

Btw, there's a bug in your blog app. It refreshes every second if there's
no session data in the url when a post is viewed.

>
> sebastian
>
> o/
>
>
> On Nov 15, 2010, at 2:17 PM, Pablo Gancharov wrote:
>
>> Yes me too!
>>
>> 2010/11/15 <[hidden email]>
>> Send seaside mailing list submissions to
>>        [hidden email]
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>        http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> or, via email, send a message with subject or body 'help' to
>>        [hidden email]
>>
>> You can reach the person managing the list at
>>        [hidden email]
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of seaside digest..."
>>
>>
>> Today's Topics:
>>
>>   1. Re: multilanguage (AA)
>>   2. Re: making a read-only checkbox (Gilles Schtickzelle)
>>   3. Re: making a read-only checkbox (Diogenes Moreira)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Mon, 15 Nov 2010 12:04:21 +0000
>> From: AA <[hidden email]>
>> Subject: Re: [Seaside] multilanguage
>> To: [hidden email]
>> Message-ID: <[hidden email]>
>> Content-Type: text/plain; charset=US-ASCII
>>
>> Yes, please! I'd love to hear details about how you did this...
>>
>> Amir
>>
>>
>> On Sat, 13 Nov 2010 14:34:25 -0200
>> Sebastian Sastre <[hidden email]> wrote:
>>
>>> Hi Carlos,
>>>
>>> our apps are trilingual and we basically implemented #translated in String to delegate what to do to the session. Then the session decides the destination language and delegates the translation to the polyglot helper we've made.
>>>
>>> Once you have that, all you need is a little webapp that allows you to edit the phrases of each translation.
>>>
>>> I can promise you that this is not big deal, maybe I should blog details about it
>>>
>>> sebastian
>>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Mon, 15 Nov 2010 12:17:07 +0100
>> From: Gilles Schtickzelle <[hidden email]>
>> Subject: Re: [Seaside] making a read-only checkbox
>> To: Seaside - general discussion <[hidden email]>
>> Message-ID:
>>        <AANLkTi=[hidden email]>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> Ah yes thank you!
>>
>> I had tried to add a 'disabled: true' but apparently I put it at the wrong
>> place and it wasn't working.
>> Now it's all good thanks.
>>
>> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>>
>>> Hi Giles,
>>>
>>> I have a form with a bunch of checkboxes. I want some of them to be
>>>> disabled depending on wether some other are checked or not.
>>>> I just can't figure out how to make a read-only checkbox (so that it would
>>>> still show but would be greyed out).
>>>
>>>
>>> Try:
>>>
>>> html checkbox
>>>  value: true;
>>> disabled: true;
>>> with: 'a disabled checkbox'
>>>
>>>
>>> #disabled: works for all form elements.
>>>
>>>
>>>
>>>
>>>> Is there such a thing in seaside (optimally with jquery so they can be
>>>> updated on the fly when the user check/uncheck a box).
>>>>
>>>
>>> html checkbox
>>>  id: #myDisabledCheckbox;
>>> value: true;
>>> disabled: true;
>>>  with: 'a disabled checkbox'.
>>>  html checkbox
>>>  value: true;
>>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>>> (html jQuery this attributeAt: 'checked'));
>>>  with: 'mirror the other checkbox'
>>>
>>>
>>> To put this example together I Googled 'jQuery checkbox' - found
>>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>>> translated the result into Seaside jQuery.
>>>
>>> Hope this helps
>>>
>>> Nick
>>>
>>>
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20101115/68ef2694/attachment.html
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Mon, 15 Nov 2010 08:53:12 -0300
>> From: Diogenes Moreira <[hidden email]>
>> Subject: Re: [Seaside] making a read-only checkbox
>> To: Seaside - general discussion <[hidden email]>
>> Message-ID:
>>        <AANLkTi=3aFRs-3vDi_m2v119SV527ZU5R++=[hidden email]>
>> Content-Type: text/plain; charset=ISO-8859-1
>>
>> Here the net, not only the fish...
>> The next when you need knows a property in a seaside object, take a
>> look to WAHtmlCanvas and WARenderCanvas, in that objects methods
>> seaside builds the htmls components. In your case, in your case the
>> object whon represent to checkbox is WACheckboxTag.
>> Otherwise, if the standars object don't have the properties/messages
>> (that is very extrange, but may be happend) that you need, you can use
>> message attributesAt:put: to set an other properties
>>
>> Best Regards
>>
>> 2010/11/15, Gilles Schtickzelle <[hidden email]>:
>>> Ah yes thank you!
>>>
>>> I had tried to add a 'disabled: true' but apparently I put it at the wrong
>>> place and it wasn't working.
>>> Now it's all good thanks.
>>>
>>> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>>>
>>>> Hi Giles,
>>>>
>>>> I have a form with a bunch of checkboxes. I want some of them to be
>>>>> disabled depending on wether some other are checked or not.
>>>>> I just can't figure out how to make a read-only checkbox (so that it
>>>>> would
>>>>> still show but would be greyed out).
>>>>
>>>>
>>>> Try:
>>>>
>>>> html checkbox
>>>>  value: true;
>>>> disabled: true;
>>>> with: 'a disabled checkbox'
>>>>
>>>>
>>>> #disabled: works for all form elements.
>>>>
>>>>
>>>>
>>>>
>>>>> Is there such a thing in seaside (optimally with jquery so they can be
>>>>> updated on the fly when the user check/uncheck a box).
>>>>>
>>>>
>>>> html checkbox
>>>>  id: #myDisabledCheckbox;
>>>> value: true;
>>>> disabled: true;
>>>>  with: 'a disabled checkbox'.
>>>>  html checkbox
>>>>  value: true;
>>>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>>>> (html jQuery this attributeAt: 'checked'));
>>>>  with: 'mirror the other checkbox'
>>>>
>>>>
>>>> To put this example together I Googled 'jQuery checkbox' - found
>>>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>>>> translated the result into Seaside jQuery.
>>>>
>>>> Hope this helps
>>>>
>>>> Nick
>>>>
>>>>
>>>> _______________________________________________
>>>> seaside mailing list
>>>> [hidden email]
>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>
>>>>
>>>
>>
>> --
>> Enviado desde mi dispositivo móvil
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>>
>> End of seaside Digest, Vol 95, Issue 30
>> ***************************************
>>
>> _______________________________________________
>> 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: multilanguage (blog post)

AA-2
In reply to this post by sebastianconcept@gmail.co
Thanks, this is very useful!

Amir


On Tue, 16 Nov 2010 18:13:58 -0200
Sebastian Sastre <[hidden email]> wrote:

> Okay, here: Multiligual web applications design ala Smalltalk
>  
> sebastian
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: multilanguage

sebastianconcept@gmail.co
In reply to this post by Levente Uzonyi-2
Right. Here some points that I think you should have in mind (we did, and went well):
- you can't fail. An exception in string will get the image down. That's why  our version has a context wrapping all and capturing an error just to do nothing but return the same string.
- Our convention is that a session will take care of the translatable but we didn't assume things about its parent (nor its name) to make it application neutral.
- We thought about using the context (of the text) to be defined by the component from where that text came but we decided not to do that unless is absolutely necessary. Turns out our lazy guess were right because we still managed to do everything without that (without relinquishing UI expressivity). But if things are going to evolve, something to provide contextual info is the way to go (as you guys did).
- Caching per session is largely suboptimal. I can't think of a situation where you need to cache translated stuff per session. Try to do that caching per application instead. You should get response times that are "slower" only for the first session. Once warm, everything that comes next for that app should be a lot faster.




On Nov 17, 2010, at 12:18 AM, Levente Uzonyi wrote:

On Tue, 16 Nov 2010, Sebastian Sastre wrote:

Okay, here: Multiligual web applications design ala Smalltalk

We implemented this a bit differently (in Seaside 2.8). In Squeak String
#translated is already used, so we're using #localized as the selector:

String >> localized

| session |
(session := WACurrentSession value) ifNil: [ ^self ].
^session translator
translate: self
inContext: session parent name

The context is important, because the same phrase may have different translations in different contexts. There's a default context which is used as a fallback during lookup. If a phrase doesn't have a translation in the requested context, the default context is used. There's also String
#localizedInContext: which lets you pass a custom context if necessary.

There's a global Translator singleton that maps languages to translators (for that language). A translator for a language has a single dictionary which maps context-phrase pairs to their translations. All phrases are in english by default, so there's no lookup if the language is english.

The translator objects are cached by the session.

The db is looked up every time a translation is missing for a context-phrase pair. If there's a match in the database, then it's stored, otherwise not.

Concurrent access is implemented by copy-on-write. This may sound inefficient, but it works well with a few thousand phrases and less than 100 contexts.

We also have a decoration which collects translations on the current page. This allows the user (editor) to translate them during viewing. It's implemented with notifications.


Levente

Btw, there's a bug in your blog app. It refreshes every second if there's no session data in the url when a post is viewed.


sebastian

o/


On Nov 15, 2010, at 2:17 PM, Pablo Gancharov wrote:

Yes me too!

2010/11/15 <[hidden email]>
Send seaside mailing list submissions to
      [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
      http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
or, via email, send a message with subject or body 'help' to
      [hidden email]

You can reach the person managing the list at
      [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of seaside digest..."


Today's Topics:

 1. Re: multilanguage (AA)
 2. Re: making a read-only checkbox (Gilles Schtickzelle)
 3. Re: making a read-only checkbox (Diogenes Moreira)


----------------------------------------------------------------------

Message: 1
Date: Mon, 15 Nov 2010 12:04:21 +0000
From: AA <[hidden email]>
Subject: Re: [Seaside] multilanguage
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=US-ASCII

Yes, please! I'd love to hear details about how you did this...

Amir


On Sat, 13 Nov 2010 14:34:25 -0200
Sebastian Sastre <[hidden email]> wrote:

Hi Carlos,

our apps are trilingual and we basically implemented #translated in String to delegate what to do to the session. Then the session decides the destination language and delegates the translation to the polyglot helper we've made.

Once you have that, all you need is a little webapp that allows you to edit the phrases of each translation.

I can promise you that this is not big deal, maybe I should blog details about it

sebastian


------------------------------

Message: 2
Date: Mon, 15 Nov 2010 12:17:07 +0100
From: Gilles Schtickzelle <[hidden email]>
Subject: Re: [Seaside] making a read-only checkbox
To: Seaside - general discussion <[hidden email]>
Message-ID:
      <[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Ah yes thank you!

I had tried to add a 'disabled: true' but apparently I put it at the wrong
place and it wasn't working.
Now it's all good thanks.

On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:

Hi Giles,

I have a form with a bunch of checkboxes. I want some of them to be
disabled depending on wether some other are checked or not.
I just can't figure out how to make a read-only checkbox (so that it would
still show but would be greyed out).


Try:

html checkbox
value: true;
disabled: true;
with: 'a disabled checkbox'


#disabled: works for all form elements.




Is there such a thing in seaside (optimally with jquery so they can be
updated on the fly when the user check/uncheck a box).


html checkbox
id: #myDisabledCheckbox;
value: true;
disabled: true;
with: 'a disabled checkbox'.
html checkbox
value: true;
onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
(html jQuery this attributeAt: 'checked'));
with: 'mirror the other checkbox'


To put this example together I Googled 'jQuery checkbox' - found
http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
translated the result into Seaside jQuery.

Hope this helps

Nick


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20101115/68ef2694/attachment.html

------------------------------

Message: 3
Date: Mon, 15 Nov 2010 08:53:12 -0300
From: Diogenes Moreira <[hidden email]>
Subject: Re: [Seaside] making a read-only checkbox
To: Seaside - general discussion <[hidden email]>
Message-ID:
      <[hidden email]>
Content-Type: text/plain; charset=ISO-8859-1

Here the net, not only the fish...
The next when you need knows a property in a seaside object, take a
look to WAHtmlCanvas and WARenderCanvas, in that objects methods
seaside builds the htmls components. In your case, in your case the
object whon represent to checkbox is WACheckboxTag.
Otherwise, if the standars object don't have the properties/messages
(that is very extrange, but may be happend) that you need, you can use
message attributesAt:put: to set an other properties

Best Regards

2010/11/15, Gilles Schtickzelle <[hidden email]>:
Ah yes thank you!

I had tried to add a 'disabled: true' but apparently I put it at the wrong
place and it wasn't working.
Now it's all good thanks.

On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:

Hi Giles,

I have a form with a bunch of checkboxes. I want some of them to be
disabled depending on wether some other are checked or not.
I just can't figure out how to make a read-only checkbox (so that it
would
still show but would be greyed out).


Try:

html checkbox
value: true;
disabled: true;
with: 'a disabled checkbox'


#disabled: works for all form elements.




Is there such a thing in seaside (optimally with jquery so they can be
updated on the fly when the user check/uncheck a box).


html checkbox
id: #myDisabledCheckbox;
value: true;
disabled: true;
with: 'a disabled checkbox'.
html checkbox
value: true;
onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
(html jQuery this attributeAt: 'checked'));
with: 'mirror the other checkbox'


To put this example together I Googled 'jQuery checkbox' - found
http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
translated the result into Seaside jQuery.

Hope this helps

Nick


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




--
Enviado desde mi dispositivo móvil


------------------------------

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


End of seaside Digest, Vol 95, Issue 30
***************************************

_______________________________________________
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: multilanguage

Levente Uzonyi-2
On Wed, 17 Nov 2010, Sebastian Sastre wrote:

> Right. Here some points that I think you should have in mind (we did, and went well):
> - you can't fail. An exception in string will get the image down. That's why  our version has a context wrapping all and capturing an error just to do nothing but return the same string.

It never failed in the last 2.5 years. :)

> - Our convention is that a session will take care of the translatable but we didn't assume things about its parent (nor its name) to make it application neutral.

That's right, our solution is not general in the sense that it
has to use subclasses of specialized session and application classes.

> - We thought about using the context (of the text) to be defined by the component from where that text came but we decided not to do that unless is absolutely necessary. Turns out our lazy guess were right because we still managed to do everything without that (without relinquishing UI expressivity). But if things are going to evolve, something to provide contextual info is the way to go (as you guys did).

We needed the context, otherwise the translations were wrong.

> - Caching per session is largely suboptimal. I can't think of a situation where you need to cache translated stuff per session. Try to do that caching per application instead. You should get response times that are "slower" only for the first session. Once warm, everything that comes next for that app should be a lot faster.

You misunderstood this one or I wasn't clear. The translator objects are
shared, but cached in the session. This way we save a dictionary lookup +
a few message sends per phrase.


Levente

>
> sebastian
>
> o/
>
>
>
> On Nov 17, 2010, at 12:18 AM, Levente Uzonyi wrote:
>
>> On Tue, 16 Nov 2010, Sebastian Sastre wrote:
>>
>>> Okay, here: Multiligual web applications design ala Smalltalk
>>
>> We implemented this a bit differently (in Seaside 2.8). In Squeak String
>>>> #translated is already used, so we're using #localized as the selector:
>>
>> String >> localized
>>
>> | session |
>> (session := WACurrentSession value) ifNil: [ ^self ].
>> ^session translator
>> translate: self
>> inContext: session parent name
>>
>> The context is important, because the same phrase may have different translations in different contexts. There's a default context which is used as a fallback during lookup. If a phrase doesn't have a translation in the requested context, the default context is used. There's also String
>>>> #localizedInContext: which lets you pass a custom context if necessary.
>>
>> There's a global Translator singleton that maps languages to translators (for that language). A translator for a language has a single dictionary which maps context-phrase pairs to their translations. All phrases are in english by default, so there's no lookup if the language is english.
>>
>> The translator objects are cached by the session.
>>
>> The db is looked up every time a translation is missing for a context-phrase pair. If there's a match in the database, then it's stored, otherwise not.
>>
>> Concurrent access is implemented by copy-on-write. This may sound inefficient, but it works well with a few thousand phrases and less than 100 contexts.
>>
>> We also have a decoration which collects translations on the current page. This allows the user (editor) to translate them during viewing. It's implemented with notifications.
>>
>>
>> Levente
>>
>> Btw, there's a bug in your blog app. It refreshes every second if there's no session data in the url when a post is viewed.
>>
>>>
>>> sebastian
>>>
>>> o/
>>>
>>>
>>> On Nov 15, 2010, at 2:17 PM, Pablo Gancharov wrote:
>>>
>>>> Yes me too!
>>>>
>>>> 2010/11/15 <[hidden email]>
>>>> Send seaside mailing list submissions to
>>>>       [hidden email]
>>>>
>>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>>       http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>> or, via email, send a message with subject or body 'help' to
>>>>       [hidden email]
>>>>
>>>> You can reach the person managing the list at
>>>>       [hidden email]
>>>>
>>>> When replying, please edit your Subject line so it is more specific
>>>> than "Re: Contents of seaside digest..."
>>>>
>>>>
>>>> Today's Topics:
>>>>
>>>>  1. Re: multilanguage (AA)
>>>>  2. Re: making a read-only checkbox (Gilles Schtickzelle)
>>>>  3. Re: making a read-only checkbox (Diogenes Moreira)
>>>>
>>>>
>>>> ----------------------------------------------------------------------
>>>>
>>>> Message: 1
>>>> Date: Mon, 15 Nov 2010 12:04:21 +0000
>>>> From: AA <[hidden email]>
>>>> Subject: Re: [Seaside] multilanguage
>>>> To: [hidden email]
>>>> Message-ID: <[hidden email]>
>>>> Content-Type: text/plain; charset=US-ASCII
>>>>
>>>> Yes, please! I'd love to hear details about how you did this...
>>>>
>>>> Amir
>>>>
>>>>
>>>> On Sat, 13 Nov 2010 14:34:25 -0200
>>>> Sebastian Sastre <[hidden email]> wrote:
>>>>
>>>>> Hi Carlos,
>>>>>
>>>>> our apps are trilingual and we basically implemented #translated in String to delegate what to do to the session. Then the session decides the destination language and delegates the translation to the polyglot helper we've made.
>>>>>
>>>>> Once you have that, all you need is a little webapp that allows you to edit the phrases of each translation.
>>>>>
>>>>> I can promise you that this is not big deal, maybe I should blog details about it
>>>>>
>>>>> sebastian
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> Message: 2
>>>> Date: Mon, 15 Nov 2010 12:17:07 +0100
>>>> From: Gilles Schtickzelle <[hidden email]>
>>>> Subject: Re: [Seaside] making a read-only checkbox
>>>> To: Seaside - general discussion <[hidden email]>
>>>> Message-ID:
>>>>       <AANLkTi=[hidden email]>
>>>> Content-Type: text/plain; charset="iso-8859-1"
>>>>
>>>> Ah yes thank you!
>>>>
>>>> I had tried to add a 'disabled: true' but apparently I put it at the wrong
>>>> place and it wasn't working.
>>>> Now it's all good thanks.
>>>>
>>>> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>>>>
>>>>> Hi Giles,
>>>>>
>>>>> I have a form with a bunch of checkboxes. I want some of them to be
>>>>>> disabled depending on wether some other are checked or not.
>>>>>> I just can't figure out how to make a read-only checkbox (so that it would
>>>>>> still show but would be greyed out).
>>>>>
>>>>>
>>>>> Try:
>>>>>
>>>>> html checkbox
>>>>> value: true;
>>>>> disabled: true;
>>>>> with: 'a disabled checkbox'
>>>>>
>>>>>
>>>>> #disabled: works for all form elements.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Is there such a thing in seaside (optimally with jquery so they can be
>>>>>> updated on the fly when the user check/uncheck a box).
>>>>>>
>>>>>
>>>>> html checkbox
>>>>> id: #myDisabledCheckbox;
>>>>> value: true;
>>>>> disabled: true;
>>>>> with: 'a disabled checkbox'.
>>>>> html checkbox
>>>>> value: true;
>>>>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>>>>> (html jQuery this attributeAt: 'checked'));
>>>>> with: 'mirror the other checkbox'
>>>>>
>>>>>
>>>>> To put this example together I Googled 'jQuery checkbox' - found
>>>>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>>>>> translated the result into Seaside jQuery.
>>>>>
>>>>> Hope this helps
>>>>>
>>>>> Nick
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> seaside mailing list
>>>>> [hidden email]
>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>
>>>>>
>>>> -------------- next part --------------
>>>> An HTML attachment was scrubbed...
>>>> URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20101115/68ef2694/attachment.html
>>>>
>>>> ------------------------------
>>>>
>>>> Message: 3
>>>> Date: Mon, 15 Nov 2010 08:53:12 -0300
>>>> From: Diogenes Moreira <[hidden email]>
>>>> Subject: Re: [Seaside] making a read-only checkbox
>>>> To: Seaside - general discussion <[hidden email]>
>>>> Message-ID:
>>>>       <AANLkTi=3aFRs-3vDi_m2v119SV527ZU5R++=[hidden email]>
>>>> Content-Type: text/plain; charset=ISO-8859-1
>>>>
>>>> Here the net, not only the fish...
>>>> The next when you need knows a property in a seaside object, take a
>>>> look to WAHtmlCanvas and WARenderCanvas, in that objects methods
>>>> seaside builds the htmls components. In your case, in your case the
>>>> object whon represent to checkbox is WACheckboxTag.
>>>> Otherwise, if the standars object don't have the properties/messages
>>>> (that is very extrange, but may be happend) that you need, you can use
>>>> message attributesAt:put: to set an other properties
>>>>
>>>> Best Regards
>>>>
>>>> 2010/11/15, Gilles Schtickzelle <[hidden email]>:
>>>>> Ah yes thank you!
>>>>>
>>>>> I had tried to add a 'disabled: true' but apparently I put it at the wrong
>>>>> place and it wasn't working.
>>>>> Now it's all good thanks.
>>>>>
>>>>> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>>>>>
>>>>>> Hi Giles,
>>>>>>
>>>>>> I have a form with a bunch of checkboxes. I want some of them to be
>>>>>>> disabled depending on wether some other are checked or not.
>>>>>>> I just can't figure out how to make a read-only checkbox (so that it
>>>>>>> would
>>>>>>> still show but would be greyed out).
>>>>>>
>>>>>>
>>>>>> Try:
>>>>>>
>>>>>> html checkbox
>>>>>> value: true;
>>>>>> disabled: true;
>>>>>> with: 'a disabled checkbox'
>>>>>>
>>>>>>
>>>>>> #disabled: works for all form elements.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Is there such a thing in seaside (optimally with jquery so they can be
>>>>>>> updated on the fly when the user check/uncheck a box).
>>>>>>>
>>>>>>
>>>>>> html checkbox
>>>>>> id: #myDisabledCheckbox;
>>>>>> value: true;
>>>>>> disabled: true;
>>>>>> with: 'a disabled checkbox'.
>>>>>> html checkbox
>>>>>> value: true;
>>>>>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>>>>>> (html jQuery this attributeAt: 'checked'));
>>>>>> with: 'mirror the other checkbox'
>>>>>>
>>>>>>
>>>>>> To put this example together I Googled 'jQuery checkbox' - found
>>>>>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>>>>>> translated the result into Seaside jQuery.
>>>>>>
>>>>>> Hope this helps
>>>>>>
>>>>>> Nick
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> seaside mailing list
>>>>>> [hidden email]
>>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> --
>>>> Enviado desde mi dispositivo móvil
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> _______________________________________________
>>>> seaside mailing list
>>>> [hidden email]
>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>
>>>>
>>>> End of seaside Digest, Vol 95, Issue 30
>>>> ***************************************
>>>>
>>>> _______________________________________________
>>>> 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: multilanguage

sebastianconcept@gmail.co
Where do you cache the looked up phrases? in the session or somewhere (shared) else?


On Nov 17, 2010, at 10:50 AM, Levente Uzonyi wrote:

> On Wed, 17 Nov 2010, Sebastian Sastre wrote:
>
>> Right. Here some points that I think you should have in mind (we did, and went well):
>> - you can't fail. An exception in string will get the image down. That's why  our version has a context wrapping all and capturing an error just to do nothing but return the same string.
>
> It never failed in the last 2.5 years. :)
>
>> - Our convention is that a session will take care of the translatable but we didn't assume things about its parent (nor its name) to make it application neutral.
>
> That's right, our solution is not general in the sense that it has to use subclasses of specialized session and application classes.
>
>> - We thought about using the context (of the text) to be defined by the component from where that text came but we decided not to do that unless is absolutely necessary. Turns out our lazy guess were right because we still managed to do everything without that (without relinquishing UI expressivity). But if things are going to evolve, something to provide contextual info is the way to go (as you guys did).
>
> We needed the context, otherwise the translations were wrong.
>
>> - Caching per session is largely suboptimal. I can't think of a situation where you need to cache translated stuff per session. Try to do that caching per application instead. You should get response times that are "slower" only for the first session. Once warm, everything that comes next for that app should be a lot faster.
>
> You misunderstood this one or I wasn't clear. The translator objects are shared, but cached in the session. This way we save a dictionary lookup + a few message sends per phrase.
>
>
> Levente
>
>>
>> sebastian
>>
>> o/
>>
>>
>>
>> On Nov 17, 2010, at 12:18 AM, Levente Uzonyi wrote:
>>
>>> On Tue, 16 Nov 2010, Sebastian Sastre wrote:
>>>
>>>> Okay, here: Multiligual web applications design ala Smalltalk
>>>
>>> We implemented this a bit differently (in Seaside 2.8). In Squeak String
>>>>> #translated is already used, so we're using #localized as the selector:
>>>
>>> String >> localized
>>>
>>> | session |
>>> (session := WACurrentSession value) ifNil: [ ^self ].
>>> ^session translator
>>> translate: self
>>> inContext: session parent name
>>>
>>> The context is important, because the same phrase may have different translations in different contexts. There's a default context which is used as a fallback during lookup. If a phrase doesn't have a translation in the requested context, the default context is used. There's also String
>>>>> #localizedInContext: which lets you pass a custom context if necessary.
>>>
>>> There's a global Translator singleton that maps languages to translators (for that language). A translator for a language has a single dictionary which maps context-phrase pairs to their translations. All phrases are in english by default, so there's no lookup if the language is english.
>>>
>>> The translator objects are cached by the session.
>>>
>>> The db is looked up every time a translation is missing for a context-phrase pair. If there's a match in the database, then it's stored, otherwise not.
>>>
>>> Concurrent access is implemented by copy-on-write. This may sound inefficient, but it works well with a few thousand phrases and less than 100 contexts.
>>>
>>> We also have a decoration which collects translations on the current page. This allows the user (editor) to translate them during viewing. It's implemented with notifications.
>>>
>>>
>>> Levente
>>>
>>> Btw, there's a bug in your blog app. It refreshes every second if there's no session data in the url when a post is viewed.
>>>
>>>>
>>>> sebastian
>>>>
>>>> o/
>>>>
>>>>
>>>> On Nov 15, 2010, at 2:17 PM, Pablo Gancharov wrote:
>>>>
>>>>> Yes me too!
>>>>>
>>>>> 2010/11/15 <[hidden email]>
>>>>> Send seaside mailing list submissions to
>>>>>      [hidden email]
>>>>>
>>>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>>>      http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>> or, via email, send a message with subject or body 'help' to
>>>>>      [hidden email]
>>>>>
>>>>> You can reach the person managing the list at
>>>>>      [hidden email]
>>>>>
>>>>> When replying, please edit your Subject line so it is more specific
>>>>> than "Re: Contents of seaside digest..."
>>>>>
>>>>>
>>>>> Today's Topics:
>>>>>
>>>>> 1. Re: multilanguage (AA)
>>>>> 2. Re: making a read-only checkbox (Gilles Schtickzelle)
>>>>> 3. Re: making a read-only checkbox (Diogenes Moreira)
>>>>>
>>>>>
>>>>> ----------------------------------------------------------------------
>>>>>
>>>>> Message: 1
>>>>> Date: Mon, 15 Nov 2010 12:04:21 +0000
>>>>> From: AA <[hidden email]>
>>>>> Subject: Re: [Seaside] multilanguage
>>>>> To: [hidden email]
>>>>> Message-ID: <[hidden email]>
>>>>> Content-Type: text/plain; charset=US-ASCII
>>>>>
>>>>> Yes, please! I'd love to hear details about how you did this...
>>>>>
>>>>> Amir
>>>>>
>>>>>
>>>>> On Sat, 13 Nov 2010 14:34:25 -0200
>>>>> Sebastian Sastre <[hidden email]> wrote:
>>>>>
>>>>>> Hi Carlos,
>>>>>>
>>>>>> our apps are trilingual and we basically implemented #translated in String to delegate what to do to the session. Then the session decides the destination language and delegates the translation to the polyglot helper we've made.
>>>>>>
>>>>>> Once you have that, all you need is a little webapp that allows you to edit the phrases of each translation.
>>>>>>
>>>>>> I can promise you that this is not big deal, maybe I should blog details about it
>>>>>>
>>>>>> sebastian
>>>>>
>>>>>
>>>>> ------------------------------
>>>>>
>>>>> Message: 2
>>>>> Date: Mon, 15 Nov 2010 12:17:07 +0100
>>>>> From: Gilles Schtickzelle <[hidden email]>
>>>>> Subject: Re: [Seaside] making a read-only checkbox
>>>>> To: Seaside - general discussion <[hidden email]>
>>>>> Message-ID:
>>>>>      <AANLkTi=[hidden email]>
>>>>> Content-Type: text/plain; charset="iso-8859-1"
>>>>>
>>>>> Ah yes thank you!
>>>>>
>>>>> I had tried to add a 'disabled: true' but apparently I put it at the wrong
>>>>> place and it wasn't working.
>>>>> Now it's all good thanks.
>>>>>
>>>>> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>>>>>
>>>>>> Hi Giles,
>>>>>>
>>>>>> I have a form with a bunch of checkboxes. I want some of them to be
>>>>>>> disabled depending on wether some other are checked or not.
>>>>>>> I just can't figure out how to make a read-only checkbox (so that it would
>>>>>>> still show but would be greyed out).
>>>>>>
>>>>>>
>>>>>> Try:
>>>>>>
>>>>>> html checkbox
>>>>>> value: true;
>>>>>> disabled: true;
>>>>>> with: 'a disabled checkbox'
>>>>>>
>>>>>>
>>>>>> #disabled: works for all form elements.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Is there such a thing in seaside (optimally with jquery so they can be
>>>>>>> updated on the fly when the user check/uncheck a box).
>>>>>>>
>>>>>>
>>>>>> html checkbox
>>>>>> id: #myDisabledCheckbox;
>>>>>> value: true;
>>>>>> disabled: true;
>>>>>> with: 'a disabled checkbox'.
>>>>>> html checkbox
>>>>>> value: true;
>>>>>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>>>>>> (html jQuery this attributeAt: 'checked'));
>>>>>> with: 'mirror the other checkbox'
>>>>>>
>>>>>>
>>>>>> To put this example together I Googled 'jQuery checkbox' - found
>>>>>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>>>>>> translated the result into Seaside jQuery.
>>>>>>
>>>>>> Hope this helps
>>>>>>
>>>>>> Nick
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> seaside mailing list
>>>>>> [hidden email]
>>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>>
>>>>>>
>>>>> -------------- next part --------------
>>>>> An HTML attachment was scrubbed...
>>>>> URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20101115/68ef2694/attachment.html
>>>>>
>>>>> ------------------------------
>>>>>
>>>>> Message: 3
>>>>> Date: Mon, 15 Nov 2010 08:53:12 -0300
>>>>> From: Diogenes Moreira <[hidden email]>
>>>>> Subject: Re: [Seaside] making a read-only checkbox
>>>>> To: Seaside - general discussion <[hidden email]>
>>>>> Message-ID:
>>>>>      <AANLkTi=3aFRs-3vDi_m2v119SV527ZU5R++=[hidden email]>
>>>>> Content-Type: text/plain; charset=ISO-8859-1
>>>>>
>>>>> Here the net, not only the fish...
>>>>> The next when you need knows a property in a seaside object, take a
>>>>> look to WAHtmlCanvas and WARenderCanvas, in that objects methods
>>>>> seaside builds the htmls components. In your case, in your case the
>>>>> object whon represent to checkbox is WACheckboxTag.
>>>>> Otherwise, if the standars object don't have the properties/messages
>>>>> (that is very extrange, but may be happend) that you need, you can use
>>>>> message attributesAt:put: to set an other properties
>>>>>
>>>>> Best Regards
>>>>>
>>>>> 2010/11/15, Gilles Schtickzelle <[hidden email]>:
>>>>>> Ah yes thank you!
>>>>>>
>>>>>> I had tried to add a 'disabled: true' but apparently I put it at the wrong
>>>>>> place and it wasn't working.
>>>>>> Now it's all good thanks.
>>>>>>
>>>>>> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>>>>>>
>>>>>>> Hi Giles,
>>>>>>>
>>>>>>> I have a form with a bunch of checkboxes. I want some of them to be
>>>>>>>> disabled depending on wether some other are checked or not.
>>>>>>>> I just can't figure out how to make a read-only checkbox (so that it
>>>>>>>> would
>>>>>>>> still show but would be greyed out).
>>>>>>>
>>>>>>>
>>>>>>> Try:
>>>>>>>
>>>>>>> html checkbox
>>>>>>> value: true;
>>>>>>> disabled: true;
>>>>>>> with: 'a disabled checkbox'
>>>>>>>
>>>>>>>
>>>>>>> #disabled: works for all form elements.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Is there such a thing in seaside (optimally with jquery so they can be
>>>>>>>> updated on the fly when the user check/uncheck a box).
>>>>>>>>
>>>>>>>
>>>>>>> html checkbox
>>>>>>> id: #myDisabledCheckbox;
>>>>>>> value: true;
>>>>>>> disabled: true;
>>>>>>> with: 'a disabled checkbox'.
>>>>>>> html checkbox
>>>>>>> value: true;
>>>>>>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>>>>>>> (html jQuery this attributeAt: 'checked'));
>>>>>>> with: 'mirror the other checkbox'
>>>>>>>
>>>>>>>
>>>>>>> To put this example together I Googled 'jQuery checkbox' - found
>>>>>>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>>>>>>> translated the result into Seaside jQuery.
>>>>>>>
>>>>>>> Hope this helps
>>>>>>>
>>>>>>> Nick
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> seaside mailing list
>>>>>>> [hidden email]
>>>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Enviado desde mi dispositivo móvil
>>>>>
>>>>>
>>>>> ------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> seaside mailing list
>>>>> [hidden email]
>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>
>>>>>
>>>>> End of seaside Digest, Vol 95, Issue 30
>>>>> ***************************************
>>>>>
>>>>> _______________________________________________
>>>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: multilanguage

Levente Uzonyi-2
On Wed, 17 Nov 2010, Sebastian Sastre wrote:

> Where do you cache the looked up phrases? in the session or somewhere (shared) else?

We have singleton that has a dictionary with langage->translator mappings.
So the translator objects are there by default. When a session's language
is set, it looks up the translator in the singleton and stores it in an
instance variable.

A translator object knows it's own language and has a dictionary with
context+phrase->translation mappings.


Levente

>
>
> On Nov 17, 2010, at 10:50 AM, Levente Uzonyi wrote:
>
>> On Wed, 17 Nov 2010, Sebastian Sastre wrote:
>>
>>> Right. Here some points that I think you should have in mind (we did, and went well):
>>> - you can't fail. An exception in string will get the image down. That's why  our version has a context wrapping all and capturing an error just to do nothing but return the same string.
>>
>> It never failed in the last 2.5 years. :)
>>
>>> - Our convention is that a session will take care of the translatable but we didn't assume things about its parent (nor its name) to make it application neutral.
>>
>> That's right, our solution is not general in the sense that it has to use subclasses of specialized session and application classes.
>>
>>> - We thought about using the context (of the text) to be defined by the component from where that text came but we decided not to do that unless is absolutely necessary. Turns out our lazy guess were right because we still managed to do everything without that (without relinquishing UI expressivity). But if things are going to evolve, something to provide contextual info is the way to go (as you guys did).
>>
>> We needed the context, otherwise the translations were wrong.
>>
>>> - Caching per session is largely suboptimal. I can't think of a situation where you need to cache translated stuff per session. Try to do that caching per application instead. You should get response times that are "slower" only for the first session. Once warm, everything that comes next for that app should be a lot faster.
>>
>> You misunderstood this one or I wasn't clear. The translator objects are shared, but cached in the session. This way we save a dictionary lookup + a few message sends per phrase.
>>
>>
>> Levente
>>
>>>
>>> sebastian
>>>
>>> o/
>>>
>>>
>>>
>>> On Nov 17, 2010, at 12:18 AM, Levente Uzonyi wrote:
>>>
>>>> On Tue, 16 Nov 2010, Sebastian Sastre wrote:
>>>>
>>>>> Okay, here: Multiligual web applications design ala Smalltalk
>>>>
>>>> We implemented this a bit differently (in Seaside 2.8). In Squeak String
>>>>>> #translated is already used, so we're using #localized as the selector:
>>>>
>>>> String >> localized
>>>>
>>>> | session |
>>>> (session := WACurrentSession value) ifNil: [ ^self ].
>>>> ^session translator
>>>> translate: self
>>>> inContext: session parent name
>>>>
>>>> The context is important, because the same phrase may have different translations in different contexts. There's a default context which is used as a fallback during lookup. If a phrase doesn't have a translation in the requested context, the default context is used. There's also String
>>>>>> #localizedInContext: which lets you pass a custom context if necessary.
>>>>
>>>> There's a global Translator singleton that maps languages to translators (for that language). A translator for a language has a single dictionary which maps context-phrase pairs to their translations. All phrases are in english by default, so there's no lookup if the language is english.
>>>>
>>>> The translator objects are cached by the session.
>>>>
>>>> The db is looked up every time a translation is missing for a context-phrase pair. If there's a match in the database, then it's stored, otherwise not.
>>>>
>>>> Concurrent access is implemented by copy-on-write. This may sound inefficient, but it works well with a few thousand phrases and less than 100 contexts.
>>>>
>>>> We also have a decoration which collects translations on the current page. This allows the user (editor) to translate them during viewing. It's implemented with notifications.
>>>>
>>>>
>>>> Levente
>>>>
>>>> Btw, there's a bug in your blog app. It refreshes every second if there's no session data in the url when a post is viewed.
>>>>
>>>>>
>>>>> sebastian
>>>>>
>>>>> o/
>>>>>
>>>>>
>>>>> On Nov 15, 2010, at 2:17 PM, Pablo Gancharov wrote:
>>>>>
>>>>>> Yes me too!
>>>>>>
>>>>>> 2010/11/15 <[hidden email]>
>>>>>> Send seaside mailing list submissions to
>>>>>>      [hidden email]
>>>>>>
>>>>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>>>>      http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>> or, via email, send a message with subject or body 'help' to
>>>>>>      [hidden email]
>>>>>>
>>>>>> You can reach the person managing the list at
>>>>>>      [hidden email]
>>>>>>
>>>>>> When replying, please edit your Subject line so it is more specific
>>>>>> than "Re: Contents of seaside digest..."
>>>>>>
>>>>>>
>>>>>> Today's Topics:
>>>>>>
>>>>>> 1. Re: multilanguage (AA)
>>>>>> 2. Re: making a read-only checkbox (Gilles Schtickzelle)
>>>>>> 3. Re: making a read-only checkbox (Diogenes Moreira)
>>>>>>
>>>>>>
>>>>>> ----------------------------------------------------------------------
>>>>>>
>>>>>> Message: 1
>>>>>> Date: Mon, 15 Nov 2010 12:04:21 +0000
>>>>>> From: AA <[hidden email]>
>>>>>> Subject: Re: [Seaside] multilanguage
>>>>>> To: [hidden email]
>>>>>> Message-ID: <[hidden email]>
>>>>>> Content-Type: text/plain; charset=US-ASCII
>>>>>>
>>>>>> Yes, please! I'd love to hear details about how you did this...
>>>>>>
>>>>>> Amir
>>>>>>
>>>>>>
>>>>>> On Sat, 13 Nov 2010 14:34:25 -0200
>>>>>> Sebastian Sastre <[hidden email]> wrote:
>>>>>>
>>>>>>> Hi Carlos,
>>>>>>>
>>>>>>> our apps are trilingual and we basically implemented #translated in String to delegate what to do to the session. Then the session decides the destination language and delegates the translation to the polyglot helper we've made.
>>>>>>>
>>>>>>> Once you have that, all you need is a little webapp that allows you to edit the phrases of each translation.
>>>>>>>
>>>>>>> I can promise you that this is not big deal, maybe I should blog details about it
>>>>>>>
>>>>>>> sebastian
>>>>>>
>>>>>>
>>>>>> ------------------------------
>>>>>>
>>>>>> Message: 2
>>>>>> Date: Mon, 15 Nov 2010 12:17:07 +0100
>>>>>> From: Gilles Schtickzelle <[hidden email]>
>>>>>> Subject: Re: [Seaside] making a read-only checkbox
>>>>>> To: Seaside - general discussion <[hidden email]>
>>>>>> Message-ID:
>>>>>>      <AANLkTi=[hidden email]>
>>>>>> Content-Type: text/plain; charset="iso-8859-1"
>>>>>>
>>>>>> Ah yes thank you!
>>>>>>
>>>>>> I had tried to add a 'disabled: true' but apparently I put it at the wrong
>>>>>> place and it wasn't working.
>>>>>> Now it's all good thanks.
>>>>>>
>>>>>> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>>>>>>
>>>>>>> Hi Giles,
>>>>>>>
>>>>>>> I have a form with a bunch of checkboxes. I want some of them to be
>>>>>>>> disabled depending on wether some other are checked or not.
>>>>>>>> I just can't figure out how to make a read-only checkbox (so that it would
>>>>>>>> still show but would be greyed out).
>>>>>>>
>>>>>>>
>>>>>>> Try:
>>>>>>>
>>>>>>> html checkbox
>>>>>>> value: true;
>>>>>>> disabled: true;
>>>>>>> with: 'a disabled checkbox'
>>>>>>>
>>>>>>>
>>>>>>> #disabled: works for all form elements.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Is there such a thing in seaside (optimally with jquery so they can be
>>>>>>>> updated on the fly when the user check/uncheck a box).
>>>>>>>>
>>>>>>>
>>>>>>> html checkbox
>>>>>>> id: #myDisabledCheckbox;
>>>>>>> value: true;
>>>>>>> disabled: true;
>>>>>>> with: 'a disabled checkbox'.
>>>>>>> html checkbox
>>>>>>> value: true;
>>>>>>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>>>>>>> (html jQuery this attributeAt: 'checked'));
>>>>>>> with: 'mirror the other checkbox'
>>>>>>>
>>>>>>>
>>>>>>> To put this example together I Googled 'jQuery checkbox' - found
>>>>>>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>>>>>>> translated the result into Seaside jQuery.
>>>>>>>
>>>>>>> Hope this helps
>>>>>>>
>>>>>>> Nick
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> seaside mailing list
>>>>>>> [hidden email]
>>>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>>>
>>>>>>>
>>>>>> -------------- next part --------------
>>>>>> An HTML attachment was scrubbed...
>>>>>> URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20101115/68ef2694/attachment.html
>>>>>>
>>>>>> ------------------------------
>>>>>>
>>>>>> Message: 3
>>>>>> Date: Mon, 15 Nov 2010 08:53:12 -0300
>>>>>> From: Diogenes Moreira <[hidden email]>
>>>>>> Subject: Re: [Seaside] making a read-only checkbox
>>>>>> To: Seaside - general discussion <[hidden email]>
>>>>>> Message-ID:
>>>>>>      <AANLkTi=3aFRs-3vDi_m2v119SV527ZU5R++=[hidden email]>
>>>>>> Content-Type: text/plain; charset=ISO-8859-1
>>>>>>
>>>>>> Here the net, not only the fish...
>>>>>> The next when you need knows a property in a seaside object, take a
>>>>>> look to WAHtmlCanvas and WARenderCanvas, in that objects methods
>>>>>> seaside builds the htmls components. In your case, in your case the
>>>>>> object whon represent to checkbox is WACheckboxTag.
>>>>>> Otherwise, if the standars object don't have the properties/messages
>>>>>> (that is very extrange, but may be happend) that you need, you can use
>>>>>> message attributesAt:put: to set an other properties
>>>>>>
>>>>>> Best Regards
>>>>>>
>>>>>> 2010/11/15, Gilles Schtickzelle <[hidden email]>:
>>>>>>> Ah yes thank you!
>>>>>>>
>>>>>>> I had tried to add a 'disabled: true' but apparently I put it at the wrong
>>>>>>> place and it wasn't working.
>>>>>>> Now it's all good thanks.
>>>>>>>
>>>>>>> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>>>>>>>
>>>>>>>> Hi Giles,
>>>>>>>>
>>>>>>>> I have a form with a bunch of checkboxes. I want some of them to be
>>>>>>>>> disabled depending on wether some other are checked or not.
>>>>>>>>> I just can't figure out how to make a read-only checkbox (so that it
>>>>>>>>> would
>>>>>>>>> still show but would be greyed out).
>>>>>>>>
>>>>>>>>
>>>>>>>> Try:
>>>>>>>>
>>>>>>>> html checkbox
>>>>>>>> value: true;
>>>>>>>> disabled: true;
>>>>>>>> with: 'a disabled checkbox'
>>>>>>>>
>>>>>>>>
>>>>>>>> #disabled: works for all form elements.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> Is there such a thing in seaside (optimally with jquery so they can be
>>>>>>>>> updated on the fly when the user check/uncheck a box).
>>>>>>>>>
>>>>>>>>
>>>>>>>> html checkbox
>>>>>>>> id: #myDisabledCheckbox;
>>>>>>>> value: true;
>>>>>>>> disabled: true;
>>>>>>>> with: 'a disabled checkbox'.
>>>>>>>> html checkbox
>>>>>>>> value: true;
>>>>>>>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>>>>>>>> (html jQuery this attributeAt: 'checked'));
>>>>>>>> with: 'mirror the other checkbox'
>>>>>>>>
>>>>>>>>
>>>>>>>> To put this example together I Googled 'jQuery checkbox' - found
>>>>>>>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>>>>>>>> translated the result into Seaside jQuery.
>>>>>>>>
>>>>>>>> Hope this helps
>>>>>>>>
>>>>>>>> Nick
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> seaside mailing list
>>>>>>>> [hidden email]
>>>>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Enviado desde mi dispositivo móvil
>>>>>>
>>>>>>
>>>>>> ------------------------------
>>>>>>
>>>>>> _______________________________________________
>>>>>> seaside mailing list
>>>>>> [hidden email]
>>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>>
>>>>>>
>>>>>> End of seaside Digest, Vol 95, Issue 30
>>>>>> ***************************************
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: multilanguage

sebastianconcept@gmail.co
You are caching in that singleton then.
As long as your app needs to check the db only once per image per app per phrase (phrase-context in your case) you'll be running nicely


On Nov 17, 2010, at 11:05 AM, Levente Uzonyi wrote:

> On Wed, 17 Nov 2010, Sebastian Sastre wrote:
>
>> Where do you cache the looked up phrases? in the session or somewhere (shared) else?
>
> We have singleton that has a dictionary with langage->translator mappings. So the translator objects are there by default. When a session's language is set, it looks up the translator in the singleton and stores it in an instance variable.
>
> A translator object knows it's own language and has a dictionary with context+phrase->translation mappings.
>
>
> Levente
>
>>
>>
>> On Nov 17, 2010, at 10:50 AM, Levente Uzonyi wrote:
>>
>>> On Wed, 17 Nov 2010, Sebastian Sastre wrote:
>>>
>>>> Right. Here some points that I think you should have in mind (we did, and went well):
>>>> - you can't fail. An exception in string will get the image down. That's why  our version has a context wrapping all and capturing an error just to do nothing but return the same string.
>>>
>>> It never failed in the last 2.5 years. :)
>>>
>>>> - Our convention is that a session will take care of the translatable but we didn't assume things about its parent (nor its name) to make it application neutral.
>>>
>>> That's right, our solution is not general in the sense that it has to use subclasses of specialized session and application classes.
>>>
>>>> - We thought about using the context (of the text) to be defined by the component from where that text came but we decided not to do that unless is absolutely necessary. Turns out our lazy guess were right because we still managed to do everything without that (without relinquishing UI expressivity). But if things are going to evolve, something to provide contextual info is the way to go (as you guys did).
>>>
>>> We needed the context, otherwise the translations were wrong.
>>>
>>>> - Caching per session is largely suboptimal. I can't think of a situation where you need to cache translated stuff per session. Try to do that caching per application instead. You should get response times that are "slower" only for the first session. Once warm, everything that comes next for that app should be a lot faster.
>>>
>>> You misunderstood this one or I wasn't clear. The translator objects are shared, but cached in the session. This way we save a dictionary lookup + a few message sends per phrase.
>>>
>>>
>>> Levente
>>>
>>>>
>>>> sebastian
>>>>
>>>> o/
>>>>
>>>>
>>>>
>>>> On Nov 17, 2010, at 12:18 AM, Levente Uzonyi wrote:
>>>>
>>>>> On Tue, 16 Nov 2010, Sebastian Sastre wrote:
>>>>>
>>>>>> Okay, here: Multiligual web applications design ala Smalltalk
>>>>>
>>>>> We implemented this a bit differently (in Seaside 2.8). In Squeak String
>>>>>>> #translated is already used, so we're using #localized as the selector:
>>>>>
>>>>> String >> localized
>>>>>
>>>>> | session |
>>>>> (session := WACurrentSession value) ifNil: [ ^self ].
>>>>> ^session translator
>>>>> translate: self
>>>>> inContext: session parent name
>>>>>
>>>>> The context is important, because the same phrase may have different translations in different contexts. There's a default context which is used as a fallback during lookup. If a phrase doesn't have a translation in the requested context, the default context is used. There's also String
>>>>>>> #localizedInContext: which lets you pass a custom context if necessary.
>>>>>
>>>>> There's a global Translator singleton that maps languages to translators (for that language). A translator for a language has a single dictionary which maps context-phrase pairs to their translations. All phrases are in english by default, so there's no lookup if the language is english.
>>>>>
>>>>> The translator objects are cached by the session.
>>>>>
>>>>> The db is looked up every time a translation is missing for a context-phrase pair. If there's a match in the database, then it's stored, otherwise not.
>>>>>
>>>>> Concurrent access is implemented by copy-on-write. This may sound inefficient, but it works well with a few thousand phrases and less than 100 contexts.
>>>>>
>>>>> We also have a decoration which collects translations on the current page. This allows the user (editor) to translate them during viewing. It's implemented with notifications.
>>>>>
>>>>>
>>>>> Levente
>>>>>
>>>>> Btw, there's a bug in your blog app. It refreshes every second if there's no session data in the url when a post is viewed.
>>>>>
>>>>>>
>>>>>> sebastian
>>>>>>
>>>>>> o/
>>>>>>
>>>>>>
>>>>>> On Nov 15, 2010, at 2:17 PM, Pablo Gancharov wrote:
>>>>>>
>>>>>>> Yes me too!
>>>>>>>
>>>>>>> 2010/11/15 <[hidden email]>
>>>>>>> Send seaside mailing list submissions to
>>>>>>>     [hidden email]
>>>>>>>
>>>>>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>>>>>     http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>>> or, via email, send a message with subject or body 'help' to
>>>>>>>     [hidden email]
>>>>>>>
>>>>>>> You can reach the person managing the list at
>>>>>>>     [hidden email]
>>>>>>>
>>>>>>> When replying, please edit your Subject line so it is more specific
>>>>>>> than "Re: Contents of seaside digest..."
>>>>>>>
>>>>>>>
>>>>>>> Today's Topics:
>>>>>>>
>>>>>>> 1. Re: multilanguage (AA)
>>>>>>> 2. Re: making a read-only checkbox (Gilles Schtickzelle)
>>>>>>> 3. Re: making a read-only checkbox (Diogenes Moreira)
>>>>>>>
>>>>>>>
>>>>>>> ----------------------------------------------------------------------
>>>>>>>
>>>>>>> Message: 1
>>>>>>> Date: Mon, 15 Nov 2010 12:04:21 +0000
>>>>>>> From: AA <[hidden email]>
>>>>>>> Subject: Re: [Seaside] multilanguage
>>>>>>> To: [hidden email]
>>>>>>> Message-ID: <[hidden email]>
>>>>>>> Content-Type: text/plain; charset=US-ASCII
>>>>>>>
>>>>>>> Yes, please! I'd love to hear details about how you did this...
>>>>>>>
>>>>>>> Amir
>>>>>>>
>>>>>>>
>>>>>>> On Sat, 13 Nov 2010 14:34:25 -0200
>>>>>>> Sebastian Sastre <[hidden email]> wrote:
>>>>>>>
>>>>>>>> Hi Carlos,
>>>>>>>>
>>>>>>>> our apps are trilingual and we basically implemented #translated in String to delegate what to do to the session. Then the session decides the destination language and delegates the translation to the polyglot helper we've made.
>>>>>>>>
>>>>>>>> Once you have that, all you need is a little webapp that allows you to edit the phrases of each translation.
>>>>>>>>
>>>>>>>> I can promise you that this is not big deal, maybe I should blog details about it
>>>>>>>>
>>>>>>>> sebastian
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------
>>>>>>>
>>>>>>> Message: 2
>>>>>>> Date: Mon, 15 Nov 2010 12:17:07 +0100
>>>>>>> From: Gilles Schtickzelle <[hidden email]>
>>>>>>> Subject: Re: [Seaside] making a read-only checkbox
>>>>>>> To: Seaside - general discussion <[hidden email]>
>>>>>>> Message-ID:
>>>>>>>     <AANLkTi=[hidden email]>
>>>>>>> Content-Type: text/plain; charset="iso-8859-1"
>>>>>>>
>>>>>>> Ah yes thank you!
>>>>>>>
>>>>>>> I had tried to add a 'disabled: true' but apparently I put it at the wrong
>>>>>>> place and it wasn't working.
>>>>>>> Now it's all good thanks.
>>>>>>>
>>>>>>> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>>>>>>>
>>>>>>>> Hi Giles,
>>>>>>>>
>>>>>>>> I have a form with a bunch of checkboxes. I want some of them to be
>>>>>>>>> disabled depending on wether some other are checked or not.
>>>>>>>>> I just can't figure out how to make a read-only checkbox (so that it would
>>>>>>>>> still show but would be greyed out).
>>>>>>>>
>>>>>>>>
>>>>>>>> Try:
>>>>>>>>
>>>>>>>> html checkbox
>>>>>>>> value: true;
>>>>>>>> disabled: true;
>>>>>>>> with: 'a disabled checkbox'
>>>>>>>>
>>>>>>>>
>>>>>>>> #disabled: works for all form elements.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> Is there such a thing in seaside (optimally with jquery so they can be
>>>>>>>>> updated on the fly when the user check/uncheck a box).
>>>>>>>>>
>>>>>>>>
>>>>>>>> html checkbox
>>>>>>>> id: #myDisabledCheckbox;
>>>>>>>> value: true;
>>>>>>>> disabled: true;
>>>>>>>> with: 'a disabled checkbox'.
>>>>>>>> html checkbox
>>>>>>>> value: true;
>>>>>>>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>>>>>>>> (html jQuery this attributeAt: 'checked'));
>>>>>>>> with: 'mirror the other checkbox'
>>>>>>>>
>>>>>>>>
>>>>>>>> To put this example together I Googled 'jQuery checkbox' - found
>>>>>>>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>>>>>>>> translated the result into Seaside jQuery.
>>>>>>>>
>>>>>>>> Hope this helps
>>>>>>>>
>>>>>>>> Nick
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> seaside mailing list
>>>>>>>> [hidden email]
>>>>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>>>>
>>>>>>>>
>>>>>>> -------------- next part --------------
>>>>>>> An HTML attachment was scrubbed...
>>>>>>> URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20101115/68ef2694/attachment.html
>>>>>>>
>>>>>>> ------------------------------
>>>>>>>
>>>>>>> Message: 3
>>>>>>> Date: Mon, 15 Nov 2010 08:53:12 -0300
>>>>>>> From: Diogenes Moreira <[hidden email]>
>>>>>>> Subject: Re: [Seaside] making a read-only checkbox
>>>>>>> To: Seaside - general discussion <[hidden email]>
>>>>>>> Message-ID:
>>>>>>>     <AANLkTi=3aFRs-3vDi_m2v119SV527ZU5R++=[hidden email]>
>>>>>>> Content-Type: text/plain; charset=ISO-8859-1
>>>>>>>
>>>>>>> Here the net, not only the fish...
>>>>>>> The next when you need knows a property in a seaside object, take a
>>>>>>> look to WAHtmlCanvas and WARenderCanvas, in that objects methods
>>>>>>> seaside builds the htmls components. In your case, in your case the
>>>>>>> object whon represent to checkbox is WACheckboxTag.
>>>>>>> Otherwise, if the standars object don't have the properties/messages
>>>>>>> (that is very extrange, but may be happend) that you need, you can use
>>>>>>> message attributesAt:put: to set an other properties
>>>>>>>
>>>>>>> Best Regards
>>>>>>>
>>>>>>> 2010/11/15, Gilles Schtickzelle <[hidden email]>:
>>>>>>>> Ah yes thank you!
>>>>>>>>
>>>>>>>> I had tried to add a 'disabled: true' but apparently I put it at the wrong
>>>>>>>> place and it wasn't working.
>>>>>>>> Now it's all good thanks.
>>>>>>>>
>>>>>>>> On Mon, Nov 15, 2010 at 11:51 AM, Nick Ager <[hidden email]> wrote:
>>>>>>>>
>>>>>>>>> Hi Giles,
>>>>>>>>>
>>>>>>>>> I have a form with a bunch of checkboxes. I want some of them to be
>>>>>>>>>> disabled depending on wether some other are checked or not.
>>>>>>>>>> I just can't figure out how to make a read-only checkbox (so that it
>>>>>>>>>> would
>>>>>>>>>> still show but would be greyed out).
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Try:
>>>>>>>>>
>>>>>>>>> html checkbox
>>>>>>>>> value: true;
>>>>>>>>> disabled: true;
>>>>>>>>> with: 'a disabled checkbox'
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> #disabled: works for all form elements.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Is there such a thing in seaside (optimally with jquery so they can be
>>>>>>>>>> updated on the fly when the user check/uncheck a box).
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> html checkbox
>>>>>>>>> id: #myDisabledCheckbox;
>>>>>>>>> value: true;
>>>>>>>>> disabled: true;
>>>>>>>>> with: 'a disabled checkbox'.
>>>>>>>>> html checkbox
>>>>>>>>> value: true;
>>>>>>>>> onClick: ((html jQuery: #myDisabledCheckbox) attributeAt: 'checked' put:
>>>>>>>>> (html jQuery this attributeAt: 'checked'));
>>>>>>>>> with: 'mirror the other checkbox'
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> To put this example together I Googled 'jQuery checkbox' - found
>>>>>>>>> http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/ then
>>>>>>>>> translated the result into Seaside jQuery.
>>>>>>>>>
>>>>>>>>> Hope this helps
>>>>>>>>>
>>>>>>>>> Nick
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> seaside mailing list
>>>>>>>>> [hidden email]
>>>>>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Enviado desde mi dispositivo móvil
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> seaside mailing list
>>>>>>> [hidden email]
>>>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>>>
>>>>>>>
>>>>>>> End of seaside Digest, Vol 95, Issue 30
>>>>>>> ***************************************
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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
> _______________________________________________
> 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
|

env vars

Carlos Crosetti-3
In reply to this post by sebastianconcept@gmail.co
How do I query the OS' environment variables values from the Seaside 3.0 one click experience image?
 
Carlos

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

Re: env vars

Diogenes Moreira
Client OS or Server OS..

In server OS you can use OSProccess but if you need an applicattion
configuration variable, I recommend take a look to WAConfiguration
subclass and use the Application conf console.

Best Regars

2010/11/22, Carlos Crosetti <[hidden email]>:
> How do I query the OS' environment variables values from the Seaside 3.0 one
> click experience image?
>
> Carlos

--
Enviado desde mi dispositivo móvil
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside