From: Matthew B. <mat...@co...> - 2005-07-13 15:04:46
|
Alistair Young wrote: > can you describe what you've done Mathew? There may not be a problem at > all. I may have localised some #defines - it's difficult to tell them > apart from Facility calls that should be localised, such as "Enter web > site" Localised some #defines? > Before you start hacking the code, can you make sure it's not a #define > that's been localised? I havn't commited it back to CVS because you know more about this but I couldn't get the templates to compile. This patch to XmlTemplate adds <localise> as a valid part of an expression (expressions are used in a <call>). >> Index: src/org/bodington/servlet/template/XmlTemplate.java >> =================================================================== >> RCS file: /cvsroot/bodington/bodington/src/org/bodington/servlet/ >> template/XmlTemplate.java,v >> retrieving revision 1.39 >> diff -u -r1.39 XmlTemplate.java >> --- src/org/bodington/servlet/template/XmlTemplate.java 6 Jul 2005 >> 17:11:03 -0000 1.39 >> +++ src/org/bodington/servlet/template/XmlTemplate.java 13 Jul >> 2005 14:22:47 -0000 >> @@ -102,7 +102,8 @@ >> "literal", >> "variable", >> "assign", >> - "call" >> + "call", >> + "localise" >> }; >> >> private static final String[] htmlfragment_tag_names= >> @@ -963,6 +964,12 @@ >> private void compileLocaliserCall(Element e) { >> writer.println("writer.println(res.getString(\"" + >> e.getAttribute("id") + "\"));" ); >> } >> + >> + private Class compileLocaliser( Element e) >> + { >> + writer.print( "res.getString(\"" + e.getAttribute("id") + >> "\")"); >> + return String.class; >> + } >> >> private void compileInputCall(Element e) { >> NamedNodeMap attrs = e.getAttributes(); >> @@ -1108,6 +1115,8 @@ >> return compileAssign( element ); >> else if ( "call".equals( element.getTagName() ) ) >> return compileCall( element ); >> + else if ( "localise".equals( element.getTagName() ) ) >> + return compileLocaliser(element); >> >> throw new ServletException( "Template bytecode compilation >> error: unknown expression." ); >> } This shows how the templates will have to change with my patch. >> Index: tomcatadd/webapps/bodington/templates/style_default/default/ >> applettop.html >> <parameters> >> <variable name="request"/> >> <variable name="writer"/> >> - <literal type="String"><localise id="page.title.text" /></ literal> >> + <localise id="page.title.text"/> >> </parameters> -- +--Matthew Buckett-----------------------------------------+ | VLE Developer, Learning Technologies Group | | Tel: +44 (0) 1865 283660 http://www.oucs.ox.ac.uk/ | +------------Computing Services, University of Oxford------+ |