[Zope3-dev] Re: [silva-dev] Re: how to proceed

Stephan Richter stephan.richter@tufts.edu
Fri, 1 Aug 2003 06:45:11 -0400


On Friday 01 August 2003 06:10, Godefroid Chapelle wrote:
> At 11:56 1/08/2003, Joachim Schmitz wrote:
> >     <div class="form-label" i18n:translate="title_msgId">
> >     Title
> >     </div>
>
> I am not sure if we always need to use a message Id. I know there are great
> discussions among the Linux i18n community.
>
> Your thoughts ?

Please do not add this tedious '_msgId'; Even 'title' itself would be sub-
optimal. The right choice for this string is just i18n:translate="". The 
string will be strip()'ed for whitespaces anyways! So the to be translated 
value should be "Title". This is important, because this is what the 
translator will eventually see in his/her POT file.

The only time you should put a string into translate is when you might hit 
some ambiguity. For example if you have the term "Title" appear in your forms 
**and** in a menu (for example), then you might want to make the menu entry 
i18n:translate="Title-Menu". However, even this is sub-optimal, since you 
really should use domains to solve such issues.

A final, very seldom use case is if you have a huge paragraph in the body that 
would be just too long to present to the translator or would be not useful to 
present to the translator. For example:

<p i18n:translate="Greeting">
   This is a text that knows that it is being translated, so it writes a dummy 
   greeting.
</p>

However, I would consider this as a bad template programming technique.

The only true use case that remains is a situation where you want to ensure 
that a specific phrase is used at this place, like a generic error message. 
Then I would suggest doing something like:

<p i18n:translate="Generic-Error-Message">
  This is a generic Error Message.
</p>

This might be extremely useful, since people like to change text in templates, 
and this ensures that your translation is not going to go secretly away. Note 
however, that you should mark such translations for the translator carefully 
by using '-' (dashes) or some other convention to show that the translator is 
supposed to come up with a useful text him/herself. Why am I saying this? My 
girlfriend just reviewed/translated large parts of Evolution, GTK and xchat 
and we often were both blown away by the cryptic translation strings. Reading 
code is not an option for a non-programmer (or not even me as a high-level 
Python developer, who is not familiar with the code base).

BTW, the last use case also justifies the use of something like 
i18n:attributes="value submit-button", which we use heavily in Zope 3.

I hope that helped. If you have further questions, feel free to E-mail me. 
BTW, I cc'ed the Zope3-Dev mailing list, since we are about to I18n'ize the 
entire code base and this information is useful for the Z3 folks too.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training