Seaside-Gettext

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

Seaside-Gettext

Johan Brichau-2
Hi,

I am using Seaside-GetText and noticed that the 'pot' template exporter was not picking up the strings to which #seasideTranslated is sent.
This message is handy for translating attributes, while the #translate: message is targeting the inner text of a markup node. For example:

html jQuery this editable
        ...
        submit: 'ok' seasideTranslated;
        cancel: 'cancel' seasideTranslated;
        ...

So, I went ahead and added support to the appropriate method (see code below). Is there any change of seeing this in the distributed package?
And if I can help to do that, let me know.

cheers,
Johan
----

translatedArguments
        "self new translatedArguments"
        | searcher currentClass result innerMatchHandler matchHandler1 matchHandler2 |
        currentClass := WAValueHolder with: nil.
        result := GROrderedMultiMap new.
        innerMatchHandler := [ :node :literal |
                        | key |
                        key := MethodReference
                                class: currentClass contents
                                selector: node methodNode selector.
                        result at: key add: literal value ].
        matchHandler1 := [ :node :answer |
                | firstArgument |
                firstArgument := node arguments first.
                firstArgument isLiteral ifTrue: [innerMatchHandler value: node value: firstArgument]].
        matchHandler2 := [ :node :answer |
                node receiver isLiteral ifTrue: [innerMatchHandler value: node value: node receiver]].
        searcher := RBParseTreeSearcher new
                matches: '`@object translate: `#string' do: matchHandler1;
                matches: '`@object translate: `#string to: `@arg' do: matchHandler1;
                matches: '`#string seasideTranslated' do: matchHandler2;
                matches: '`#string seasideTranslatedTo: `@arg' do: matchHandler2;
                yourself.
        BrowserEnvironment new classesAndSelectorsDo: [ :class :selector |
                (searcher canMatchMethod: class >> selector) ifTrue: [
                | tree |
                (tree := class parseTreeFor: selector) notNil ifTrue: [
                        currentClass contents: class.
                        searcher executeTree: tree ] ] ].
        ^ Array streamContents: [ :stream |
                result keysDo: [ :key |
                        stream nextPut: key -> (result allAt: key) ] ]_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: Seaside-Gettext

Philippe Marschall
2011/5/21 Johan Brichau <[hidden email]>:

> Hi,
>
> I am using Seaside-GetText and noticed that the 'pot' template exporter was not picking up the strings to which #seasideTranslated is sent.
> This message is handy for translating attributes, while the #translate: message is targeting the inner text of a markup node. For example:
>
> html jQuery this editable
>        ...
>        submit: 'ok' seasideTranslated;
>        cancel: 'cancel' seasideTranslated;
>        ...
>
> So, I went ahead and added support to the appropriate method (see code below). Is there any change of seeing this in the distributed package?
> And if I can help to do that, let me know.

Done, let me know if it works for you. I also integrated the change
from Panu Suominen (lazy translated strings) and wrote a small bit of
documentation [1]. Thanks for the fix.

 [1] http://code.google.com/p/seaside/wiki/Gettext

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

Re: Seaside-Gettext

Johan Brichau-2
Great. thanks!
ps: I had bad inspiration for variable naming ;-)

On 21 May 2011, at 17:19, Philippe Marschall wrote:

> 2011/5/21 Johan Brichau <[hidden email]>:
>> Hi,
>>
>> I am using Seaside-GetText and noticed that the 'pot' template exporter was not picking up the strings to which #seasideTranslated is sent.
>> This message is handy for translating attributes, while the #translate: message is targeting the inner text of a markup node. For example:
>>
>> html jQuery this editable
>>        ...
>>        submit: 'ok' seasideTranslated;
>>        cancel: 'cancel' seasideTranslated;
>>        ...
>>
>> So, I went ahead and added support to the appropriate method (see code below). Is there any change of seeing this in the distributed package?
>> And if I can help to do that, let me know.
>
> Done, let me know if it works for you. I also integrated the change
> from Panu Suominen (lazy translated strings) and wrote a small bit of
> documentation [1]. Thanks for the fix.
>
> [1] http://code.google.com/p/seaside/wiki/Gettext
>
> Cheers
> Philippe
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev

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

Re: Seaside-Gettext

Philippe Marschall
2011/5/21 Johan Brichau <[hidden email]>:
> Great. thanks!
> ps: I had bad inspiration for variable naming ;-)

"There are only two hard things in Computer Science: cache
invalidation and naming things"

Cheers
Philippe
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev