problems with i18n transformer in cocoon 2.0.2 - is this a bug?I've just
checked the source from the 2.0.3 branch from CVS and the correct line is
already there:
StringBuffer pathToChild = new
StringBuffer(pathToParent).append('/').append(child.getNodeName());
Couldn't find in logs if it was incorrect before the 2.0.2 version, but
there is no differences in that line between 2.0.2 and 2.0.3.
I've also checked i18n sample with 'cache-at-startup' option and it also
works fine (2.1-dev version). As there is no difference in 2.0.3 and 2.1
versions of XMLResourceBundle then something's wrong at your site.
Regards,
Konstantin
- Original Message -
From: Brian Buckley
To: [EMAIL PROTECTED]
Sent: Wednesday, May 29, 2002 2:20 PM
Subject: problems with i18n transformer in cocoon 2.0.2 - is this a bug?
cocoon version: 2.0.2
servlet engine: tomcat 4.0.3
OS: windows 2000
JDK: 1.4.0
I am trying to add internationalisation to my site by using i18n. After a
day fruitlessly trying to figure out where I am going wrong I added some
debug printlns to the I18nTransformer source. My setup is as follows:
sitemap: ***
messages
translations
true <- I added this
to make debugging easier as the cache is a simple hash table
.
.
*** dictionary: **
in $TOMCAT_HOME/webapps/myapp/translations
/messages.xml
/messages_en.xml
/...etc,etc
*** messages contain: *
Go to Secure Login
Welcome
... etc, etc
** xsp: **
login.redirect
Now. At the browser I am getting the 'login.welcome' and 'login.redirect'
keys untranslated. My debug statements showed that the string passed into
XMLResourceBundle.getString(String key) was
"/catalogue/message[@key='login.welcome']", but the XMLResourceBundle cache
contained the key "/message[@key='login.welcome']". Clearly a mismatch. So
I looked at the code:
I18nTransformer.getString() method prepends the key to be passed to the
XMLResourceBundle.getString() with I18N_CATALOGUE_PREFIX.
I18N_CATALOGUE_PREFIX is the string constant "/catalogue/message".
XMLResourceBundle.cacheAll(Node parent, String pathToParent) is initially
entered with a pathToParent of "" from init(). The pathToChild StringBuffer
takes this as the initial buffer value in the line:
StringBuffer pathToChild = new
StringBuffer(pathToParent).append(child.getNodeName());
If I change the initial call to cacheAll with a pathToParent of "/", and
change the above line to
StringBuffer pathToChild = new
StringBuffer(pathToParent).append(parent.getNodeName()).append('/').append(c
hild.getNodeName());
I reproduce the expected key in the cache hashtable, and everything works.
Is this a bug in cocoon 2.0.2 or is there an alternative solution to this
without changing cocoon source code?
Thanks,
Brian Buckley.
-
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>