Mike, tks for your excellent suggestions. My comments are inline
On Thu, 2009-10-29 at 16:33 -0700, Mike Samuel wrote:
> Results {0} of {1}
> which allows for translation which change the order of substitutions.
My solution would be grab the entire string "Results 0 of 1" and leave
it to translators to rearrange. Anything truly dynamic will be generated
by javascript code, where I will output a localized string or numerical
digit using a separate function.
> I've seen similar schemes used with HTML, where
> Tip: You can change your timezone and other <a
> href="settings#tz">settings</a>.
> is produced by the substitution string
> Tip: You can change your timezone and other {0}settings{1}.
I don't quite understand your tip here. can you elaborate?
> You need to be careful to normalize HTML special characters in the
> translation string, and sanity check the relative order of start and
> end tag substitutions, but contract translators seem to be able to
> deal with it.
I don't quite understand what you mean. Which special characters? do you
mean like & ?
> > For example:
> >
> > <p> Translate <strong>me</strong>!</p>
> >
> > Doing this with ruby on rails or django, you would use a server-side
> > template that puts code inline with the markup:
>
> So you don't need to worry about redoing styles to make them work RTL?
> Or is Urdu used at all in Nepal -- please excuse my ignorance, but
> Nepal borders the Bangladesh side of India, right?
Nepal does border India but they write in Devnagari characters, the same
as Hindi, and read from LeftToRight.
That said, I need to support RTL locales. My first thought was to change
the dir attribute in the html to rtl <html dir=rtl>. If that doesn't
work I would do it more precisely on individual elements.
> > I could use something like Google Gears to simulate as server-side
> > gettext mechanism but that would again tie me to a specific plugin.
>
> To make sure I understand, you have an HTML page, without any server
> backend, and you want to localize it?
Yes. No server back-end at all. None whatsoever
> I'm not sure what you're trying to accomplish with marking.
> (1) You want to mark strings so that you can extract a translation
> bundle to send off to a contract translator?
Yes, I want to use it to extract a string and place it in pootle
translation system where it can be handled by volunteer translators
> (2) You want to mark strings so that you can make sure that a whole
> semantic bundle (whether a phrase or multiple sentences) is translated
> together
Yes
> (3) You want to identify markup that need to be replaced to produce a
> translated version of a page?
Yes
> Why not just use mark a string for translation by using a class?
> <p class=message>This needs to be translated</p>
Because <p data-_> ...</p> is
1) shorter
2) more semantically meaningful, won't lead to clashes w/ other
potential class names
3) can be extended to represent the relevant context and add comments
> Do you need to deal with short ambiguous phrases, such as the English
> word "free" which has multiple senses each that corresponds to a
> different word in most other Indo-European languages?
Yes!
> > For those unfamiliar with GNU gettext, "_" is used as shortcut for the
> > gettext("string") command
>
> I'm infamiliar with it, but I think precedent and familiar APIs count
> for a lot.
I am trying to extend the current paradigm of gettext so that it
accommodates inline html. It is perhaps the dominant API for
translations excepting whatever Microsoft uses.
> So the comment is a note to translators? Or does it help in
> specifying the sense of the word?
it is a note to translators to help them understand usage of the word.
--
Bryan W. Berry
Senior Engineer
OLE Nepal,
http://www.olenepal.org