[Sugar-devel] reading and writing translatable strings

Felipe López Toledo zer.subzero at gmail.com
Sun Jul 12 12:57:17 EDT 2009


@Bryan:
>I am wondering if it will be feasible performance-wise to write in all
>the strings each time the page loads. I guess the only way to find out
>is to experiment.
It depends of the amount of text, let me test it. Since all the
process is done in the client I think it depends of 2 things:

1. the amount of time to load (from Internet) the source elements
(html, js, images, po)

2. the time to process the js

about po2json,
the same source from Gettext, nice!

@Lucian:
Yes, we have a predefined list:
h*, title, label and so on

@Jonas Smedegaard
good!, we'll try it



On 12/07/2009, Bryan Berry <bryan at olenepal.org> wrote:
> I am not searching, i am using a predefined list partly for the reason
> you suggest ;)
>
> On Sun, 2009-07-12 at 12:22 +0100, Lucian Branescu wrote:
>> Searching strings inside all HTML elements could be very slow. I
>> suggest if you search inside html elements, stick to a predefined list
>> of them (like a "translate" class).
>>
>> 2009/7/12 Bryan Berry <bryan at olenepal.org>:
>> > Subzero,
>> >
>> > I have figured out how to read the strings from an html file, at least
>> > somewhat:
>> >
>> > utils/narwhal/bin/narwhal source.html output.pot
>> >
>> > generates a .pot file from the strings in one html file
>> >
>> > I haven't automated grabbing the strings from a .js file because it
>> > seems fairly straightforward.
>> >
>> > Reading back in the strings from the po might present a problem. I
>> > gather that we will have to convert the po file to a .json file
>> >
>> > I guess we can use the perl module po2json for now
>> > (http://jsgettext.berlios.de/doc/html/po2json.html) Later we may want to
>> > consider doing this w/ python or narwhal (command-line js), since
>> > neither u nor I know perl.
>> >
>> > but we still have to match the strings w/ the target html.
>> >
>> > It was dead easy to grab the strings using a css selector $('h1, h2, h3,
>> > title, ...')
>> >
>> > but to write back the strings we need to match the msgid string to the
>> > actual element html. Can we create a jQuery css or XPath selector that
>> > selects based on element html?  something like
>> >
>> > $('*[html="The <big>Highest</big> score is"]').   ???
>> >
>> > I am wondering if it will be feasible performance-wise to write in all
>> > the strings each time the page loads. I guess the only way to find out
>> > is to experiment.
>> >
>> > We could possibly pre-create localized html pages using narwhal. We
>> > could use the package_po.json to generate index_ne_NP.html or
>> > index_he.html from the command-line.
>> >
>> >
>> > --
>> > Bryan W. Berry
>> > Technology Director
>> > OLE Nepal, http://www.olenepal.org
>> >
>> > _______________________________________________
>> > Sugar-devel mailing list
>> > Sugar-devel at lists.sugarlabs.org
>> > http://lists.sugarlabs.org/listinfo/sugar-devel
>> >
> --
> Bryan W. Berry
> Technology Director
> OLE Nepal, http://www.olenepal.org
>
>


More information about the Sugar-devel mailing list