localization

1 view
Skip to first unread message

Safronovich Victor

unread,
Apr 26, 2008, 5:20:29 AM4/26/08
to post...@googlegroups.com
Здравствуйте, posterity and Jonas.

I`m continuos translating Posterity. There are 2 problems.

1. Flash messages don`t translated. When I added a _ to flash
function ( e.g. flash(_('Tag added')) ), The message extracted by
Babel, but after adding a tag, I receive a UnicodeDecodeError, because
paste.cookies.dict WSGI parameter contains not ascii characters.

Another way is to extract flash function by Babel and translate flash
message in template(added gettext in temlate), but i don`t know how
to extract extra functions by Babel :(. But the first way IMHO is more
cleared.

2. value attribute of the input tag with type="submit" don`t
translated. When I added `include_attrs = value` to Babel config,
extracted all the value attribute, even the value attribute of the
input type="text". How can I extract the value attribute only from
input type="submit" tag?

--
С уважением,
Safronovich Victor

Jonas Borgström

unread,
Apr 27, 2008, 12:47:25 PM4/27/08
to post...@googlegroups.com
Safronovich Victor wrote:
>
> Здравствуйте, posterity and Jonas.
>
> I`m continuos translating Posterity. There are 2 problems.
>
> 1. Flash messages don`t translated. When I added a _ to flash
> function ( e.g. flash(_('Tag added')) ), The message extracted by
> Babel, but after adding a tag, I receive a UnicodeDecodeError, because
> paste.cookies.dict WSGI parameter contains not ascii characters.
>
> Another way is to extract flash function by Babel and translate flash
> message in template(added gettext in temlate), but i don`t know how
> to extract extra functions by Babel :(. But the first way IMHO is more
> cleared.

You're right, all strings passed to the flash function should be
translated using the _() function. I maked all existing flash messages
and fixed the encoding issue in
http://posterity.edgewall.org/changeset/207

> 2. value attribute of the input tag with type="submit" don`t
> translated. When I added `include_attrs = value` to Babel config,
> extracted all the value attribute, even the value attribute of the
> input type="text". How can I extract the value attribute only from
> input type="submit" tag?

As far as I know this is a limitation genshi message extraction code. So
until that is fixed we need to use explicit gettext calls in the
templates.

http://posterity.edgewall.org/changeset/206.

/ Jonas

Safronovich Victor

unread,
Apr 27, 2008, 12:59:31 PM4/27/08
to post...@googlegroups.com
Hello, "Posterity" group and Jonas.

> You're right, all strings passed to the flash function should be
> translated using the _() function. I maked all existing flash messages
> and fixed the encoding issue in
> http://posterity.edgewall.org/changeset/207

Ok, I will translate new messages against trunk.

>> 2. value attribute of the input tag with type="submit" don`t
>> translated. When I added `include_attrs = value` to Babel config,
>> extracted all the value attribute, even the value attribute of the
>> input type="text". How can I extract the value attribute only from
>> input type="submit" tag?

> As far as I know this is a limitation genshi message extraction code. So
> until that is fixed we need to use explicit gettext calls in the
> templates.

Jonas, How do you thing is it a good idea to use XPath selectors to
extract text for translation from tags and attributes? for example

[genshi: **/templates/**.html]
#may be mistakes in XPath variables
#name 'exclude' and 'include' is used for backward compatibility.
exclude = //script|//style
include = /html/body/*[@alt]|/html/body/*[@title]|/html/body/*[@summary]|
/html/body/*/input[@type=submit][@value]

May be create ticket in Genshi trac about this.

--
Regards,
Safronovich Victor

Jonas Borgström

unread,
Apr 27, 2008, 2:08:55 PM4/27/08
to post...@googlegroups.com
Safronovich Victor wrote:
>> As far as I know this is a limitation genshi message extraction code. So
>> until that is fixed we need to use explicit gettext calls in the
>> templates.
> Jonas, How do you thing is it a good idea to use XPath selectors to
> extract text for translation from tags and attributes? for example
>
> [genshi: **/templates/**.html]
> #may be mistakes in XPath variables
> #name 'exclude' and 'include' is used for backward compatibility.
> exclude = //script|//style
> include = /html/body/*[@alt]|/html/body/*[@title]|/html/body/*[@summary]|
> /html/body/*/input[@type=submit][@value]
>
> May be create ticket in Genshi trac about this.

Yes that sounds like a good ideas, go ahead.

/ Jonas

Reply all
Reply to author
Forward
0 new messages