Hi all, Note: I cc this message to zope-dev because I want to be sure that the DC folks get aware of this, since I think internazionalization support should be a standard Zope feature, so their opinion is *very* important. First, I've just uploaded the vocabulary product to Zope.org, download from "http://www.zope.org/Members/jdavid/vocabulary". Now a brief description of the vocabulary python product. It is really simple, the data structure is a dictionary indexed by strings which contains another dictionary indexed by language which contains the translations, example: {'window': {'en': 'window', 'es': 'ventana', 'ca': 'finestra'}, 'house': {'es': 'casa'}, ... } It also provides a web interface to edit the entries and translations, visit "http://estce.act.uji.es/zope-edu/LLEU/V/manage_workspace" to see it. And more, it has XML support, you can export/import its contents to/from XML files. Just click in the "XML" tab to see it. It's used in this way (if the product instance is called "V"): <dtml-var "V('window')"> The language is determined by the variable "languages" which must be a sequence of languages, for instance it could be a Folder property of type tokens with value "en es ca". First the translation is searched for the first language ('en' in our example), if it's found that translation is returned, if no it tries with the next language, if no translation is found it returns the original string. Hi Shane, First, please excuse me because my yesterday comments were so short, writing good english messages takes time for me. Your proposal is a different approach to the problem, and I think both solutions complement each other. The vocabulary product is more flexible because you can use it from any place (not just DTML Documents) and it also allows to share common translations. The solution you propose is specially useful to translate long texts which are unlikely to be found in more than one place. And since the contents between the "dtml-str" tag could be very dynamic it also opens the door to automatic translators.
Hi folks! I would like to propose an idea that may help to push forward Zope internationalization. This idea sprang from the conversation on the zope-edu-user list.
I don't have a solution for charsets nor date formats, but I do have an idea that would make language translation much more feasible.
I suggest the addition of a tag called <dtml-str>. "str" refers to "string", the term often used when dealing with translation in Windows applications. In DTML documents, we currently have something like:
<dtml-var name>, you have <dtml-var days> days of service remaining.
We could add a <dtml-str> tag to it as follows:
<dtml-str DAYSREMAIN><dtml-var name>, you have <dtml-var days> days of service remaining.</dtml-str>
If the user wants translation, the string would be substituted with something from a small repository. The repository could be stored in the DTML document itself. Somewhere in the document (it doesn't matter where, but the bottom would be preferable) there would be something like the following:
<dtml-translation languages="br; brazil; brasil; port"> <dtml-str DAYSREMAIN><dtml-var name>, deixam <dtml-var days> dias de servico.</dtml-str> </dtml-translation>
When users request translation either through the HTTP_ACCEPT_LANGUAGE header, a cookie, or a part of the URL, the DTML processing mechanism looks through the available languages and, if one of the specified languages is available, replaces the text of <dtml-str> blocks with the corresponding translation.
The management interface for DTML documents would be modified as follows:
- A "default language" text box would be added to the "Edit" page.
No really need for that, if the translation is not found the text returned is the one untranslated, so if you write it in english, then english is the default language.
- A new tab would be added called "translations". Translators would be presented with an easy translation interface that lists all of the <dtml-str> tags and provides a text area for entry of the translation.
Original DTML authors would only need to add <dtml-str> tags in strategic places. Translations would often survive between versions of the original document. The tags would even work in the DTML portion of Zope's management interface.
What's best about it is that it is not a significant change to Zope and might take a week at most for someone to implement.
What do you think?
Shane Hathaway
_______________________________________________ ZIP maillist - ZIP@eevolute.com http://www.eevolute.com/mailman/listinfo/zip