Sign In/My Account | View Cart  
advertisement

Article:
 XSLT Reflection
Subject: About Localization. How to improve it?
Date: 2005-03-27 09:41:40
From: knocte

Hello Jirka. Firstly, congratulations for your great article.


I arrived to this stuff looking for localization methods using XSLT. I liked yours, but I think it doesn't suit to my needs. Do you know any other method which would be a bit more evolved?


The thing is that I would like to find (or implement by myself) a method like yours, but with the following additional features:


a) Ability to insert inline invariant terms into localized strings. Example: "Welcome to %1, we hope you have a good experience in our site."


b) Default language present on the primary non-translated template. You will be familiar with this concept if you have used Gettext. The "key" for each localized string is the string itself in the default language. This can be thought as being a disadvantage or an advantage. For example, instead of using <h1><msg:Welcome/></h1>, the approach would be something like <h1><msg>Welcome to the site</msg></h1>.


c) Finally, I have to say that in my experience of working with XML+XSLT conversion to extract usually output with XHTML format, I have found out that sometimes we need to translate strings that are inside attributes of tag elements. I mean, how could you translate this example with your technique?: Go back.


There, you cannot use a msg tag for localization inside an attribute (), because it would be an illegal XML document.



I am thinking on my own localization implementation using XSLT and it should be, so as to fit my three requisites, something like this:


- Part of the primary stylesheet:


<h1>{{You have to admit that %1% is your friend}John}.</h1>
The Link



- Dictionary XML for Spanish language:


<dictionary lang="es">
<expression key="You have to admit that %1% is your friend">Tienes que admitir que %1% es tu amigo</expression>
<expression key="The best link, reported by %1% and %2%">El mejor enlace, notificado por %1% y %2%</expression>
</dictionary>



- And the final hypothetical result, product of applying the XSLT transformation using the "es" dictionary, could be:


<h1>Tienes que admitir que John es tu amigo.</h1>
The Link



Do you think this type of XSLT transformation can be implemented? Would you implement it this way? Do you think there are any drawbacks about this kind of implementation? Could you think of any improvement or any additional interesting requisite for this localization system?


Thanks in advance.


Regards,


knocte


Previous Message Previous Message   Next Message Next Message


Titles Only Titles Only Newest First
  • About Localization. How to improve it?
    2005-03-27 09:44:02 knocte [Reply]

    Sorry, some elements haven't appeared in the post because they have been rendered in HTML. That's because this posting mechanism doesn't have a PREVIEW feature!


    I will try to fix the message and post it again as another reply.


Sponsored By: