|
(Same message as the last one. When you read "lnk" tag, I mean an "a" tag, like the one present in XHTML.)
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?: <lnk title="Click here to go to the main section" href="#main">Go back</lnk>.
There, you cannot use a msg tag for localization inside an attribute (<lnk title="<msg>Click here...</msg>">...), 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>
<lnk title="* {{The best link, reported by %1% and %2%}Philip,Frank}. *">The Link</lnk>
- 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>
<lnk title="* El mejor enlace, notificado por Philip y Frank. *">The Link</lnk>
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
|