cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthieu Sozeau <>
Subject [PATCH] new I18n transformer and XMLResourceBundle implementation
Date Sat, 13 Apr 2002 22:25:29 GMT
Hi cocooners,

	I first wrote in cocoon-user for features request about the I18nTransformer (mainly for markup
in i:text and i:params) and were asked to make a patch. So I've done it.

	I rewrote almost all off I18NTrans. except date and other formatting code. I used another
implementation of XMLResourceBundle which indexes MirrorRecorders instead of Strings. MirrorRecorders
basically conserve events ({start/end}Element and characters) and resend them later to a defined
contentHandler. I use it to create the translated messages and parse i:text and params. I
first thought XMLFragment would do the work, but i really only needed to store events. I also
have an interface EventRecorder for MirrorRecorder. Just a convenience for subclasses (StartEventRecorder,

Substitution is applied when sending the first recorded "i:text" events. It uses the same
notation as before "every{0} you {1}", but you can also insert markup inside parameters or
directly in the "i:text" (useful for links). Date and numbers are allowed in params.

I also added in-place translations or 'locale' tests. It looks like:
	<i:translate type="inplace">
		<other>This color doesn't exists in your language!</other>	
As usual, markup inside <locale>'s is allowed. You can change the tag for the default
translation using <default-other></> in the sitemap. I plan to add attributes
for locale tags, something like:
	<en country="GB"...

I send the whole new files and some tests. I haven't made a diff 'cause that's not clear it'll
be useful for you to actually test and comment on it (i don't think either that it's ready
for integration).

"Black holes are where God divided by zero." - Steven Wright

View raw message