Re: Newbie question: How do I use localization with deferred parsing?
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
At 11:00 AM 8/14/2003 +0200, you wrote:
>Thanks a lot!
>
>That got me a bit further but now I get a compile error. I have the files
>
>LocalizationExample.java
>LocalizationExample.html
>LocalizationExample.properties
>LocalizationExample_da.properties
>
>When I run the localize task-def on the project, it (as expected) generates
>the files
>
>LocalizationExample_da.html
>LocalizationExampleHTML.java
>LocalizationExampleHTML_da.java
>
>The problem is that LocalizationExampleHTML_da attempts to implement (!)
>LocalizationExampleHTML which is a class. So, javac balks. The .xmlc files
>generated contains
>
>-implements LocalizationExampleHTML
>
>which seems wrong. What am I missing?
All this seems right to me. What is the compile error you are
getting? The <Localize> taskdef generates some .xmlc files. Take a look
at their contents. You should seem something like...
**LocalizationExample.xmlc**
-generate both
**LocalizationExample_da.xmlc***
-implements com.mypackage.xmlc.LocalizationExampleHTML
BTW, your XMLC files are being compile to a particular package, right? Not
the default one. If your classes don't have a package, then that may be
causing the error.
Also note that if you want to use deferred parsing, make sure to add the
following to your options.xmlc file...
-for-deferred-parsing
And then look where your generated .java files are and you should notice
some generated .xmlc files. These are separate from those generated by the
<Localize> taskdef. The will be named something like
LocalizationExampleHTML.xmlc and LocalizationExampleHTML_en.xmlc. These
files will be in XML format. Copy these files to the location where your
class files are compiled, such as.... classes/com/mypackage/xmlc/.
Jake
>TIA
>Jacob
>
>
>On Wednesday 13 August 2003 23:31, Jacob Kjome wrote:
> > DefaultDOMLoader uses deferred parsing by default so you don't need to
> > specify anything about the deferred parsing factory specifically. Just
> > make sure you copy all the generated .html and .xmlc files that match up
> > with your localized XMLC DOM classes to the same package as those DOM
> > classes. Continue using DefaultDOMLoader like normal.
> >
> > Note that, optionally, if you want to specify resource directories for the
> > deferred parsing factory, these can be specified in the web.xml with the
> > same options as XMLCContext takes. You will have to apply the same
> > scripting in the object repository assember to set this up, though....
> >
> > <!-- Set the default dom factory for the global instance of the default dom
> > loader -->
> > <object name="$this">
> > <method name="getServletContext" return="$sc"/>
> > </object>
> > <object name="$df"
> > class="org.enhydra.barracuda.core.util.dom.XMLCDeferredParsingDOMFactory">
> > <!-- set the servlet context so that the dom factory can read
> > web.xml context params -->
> > <method name="setServletContext" arg1="$sc" />
> > </object>
> > <object class="org.enhydra.barracuda.core.util.dom.DefaultDOMLoader">
> > <method name="getGlobalInstance" return="$dl" />
> > </object>
> > <object name="$dl">
> > <method name="setDefaultDOMFactory" arg1="$df" />
> > </object>
> >
> >
> > Jake
> >
> > At 02:56 PM 8/13/2003 +0200, you wrote:
> > >Hi,
> > >
> > >I'm investigating the localization facilities in Barracuda and need some
> > >help.
> > >How do I combine deferred parsing (XMLC re-load) with localization?
> > >
> > >I have both things running nicely but cannot seem to find the right way to
> > >combine them.
> > >
> > >The localization example (HelloWorld4) in the Component Model Tutorial
> > > uses the DefaultDOMLoader class to indicate the desired Locale when
> > > creating the XMLC page object. However, the deferred parsing hints given
> > > on the News and Status page tells me to use something along the lines of
> > >
> > >...
> > >
> > >if (xmlcFactory == null)
> > >{
> > > xmlcFactory = new XMLCDeferredParsingFactory(
> > > new DocumentLoaderImpl(),
> > > this.getClass().getClassLoader(),
> > > new StreamXMLCLogger()
> > > );
> > >}
> > >
> > > SimpleExampleHTML page =
> > > (SimpleExampleHTML)xmlcFactory.create(SimpleExampleHTML.class);
> > >
> > >How do I pass in the Locale in this case?
> > >
> > >TIA,
> > >Jacob
> > >
> > >_______________________________________________
> > >Barracuda mailing list
> > >[email protected]
> > >http://barracudamvc.org/lists/listinfo/barracuda
> >
> > _______________________________________________
> > Barracuda mailing list
> > [email protected]
> > http://barracudamvc.org/lists/listinfo/barracuda
>
>_______________________________________________
>Barracuda mailing list
>[email protected]
>http://barracudamvc.org/lists/listinfo/barracuda