Will,

>What I would like to do is, depending on the language code, direct the
>template to load from a different directory.  For example,  if I have
>one screen "Sample".  I would like to put the templates in:
>
>/en/Sample.vm
>/es/Sample.vm
>/cn/Sample.vm, etc...

I needed something similar for Layouts, I took the dynamic loading of the
ScheduledJobsLoader class and modified that so it could load a Skin Object
instead. I did it so I could specify a Printable skin, that had a layout
without any navigation for printing. I use an extended VelocityScreen to
test for skin being in the URL, for example;

  myapp/servlet/myapp/skin/Printable/template/Index.vm

The Loader checks for an Object in the modules/skins/ path named
Printable.class, which has a getLayout() method, then  putting the relvant
Skin Object into the context for that request. The downside is every
template has;
 
#if($skin)
    $!data.setLayoutTemplate($!skin.getLayout())
#end

it also isnt very extensible in the velocity template. But it does allow
what skin gets there, to be handled in VelocityScreen's doBuildTemplate(),
the other upside is any class that extends the Skin object can be dumped in
the /modules/skins path and the Loader will look for it, if 'skin' appears
in the URL.

You may be able to set a Language Object in the same manner that checks the
URL for /language/en, places the relevant Language Object in the context and
then have some sort of test condition in the velocity template that directs
where to find the template for that language.

Hope I explained that well enough. Just an idea though.




Cameron Riley
[EMAIL PROTECTED]



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to