On 4/17/07, santas <[EMAIL PROTECTED]> wrote:

Thanks for your reply
                    but i think i missed one point here that i am not using
velocity for my front end. I am using jsp with the portlets. And i think i
cant use this #parse( )  here in jsp.

correct.

                    I tryid solution but i don't know whether it is standard
or not.
What i tried to do is whenever i change "Locale" of my application it calls
on class,ok
 now int hat class i added following code


                VelocityEngine Velocity = new VelocityEngine();
                Properties p = new Properties();
                p.setProperty("file.resource.loader.path",
"C:\\Jetspeed-2.0\\webapps\\jetspeed\\decorations\\layout");
                VelocityContext context= new VelocityContext();
                context.put("langname",strLanguage);
                Velocity.init(p);
                Template temp = Velocity.getTemplate("tempheader.vm");
                StringWriter writer = new StringWriter();
                temp.merge(context,writer);
                byte[] test= writer.toString().getBytes();
                FileOutputStream out = new
FileOutputStream("C:\\Jetspeed-2.0\\webapps\\jetspeed\\decorations\\layout\\header.vm");
                out.write(test);
                out.close();


now  i had written on file called "tempheader.vm"
                  #set ($MESSAGES =
$portletConfig.getResourceBundle($renderRequest.Locale))
            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
              <html>
            <head>
           <base href="#BaseHref()">
           <meta http-equiv="Content-type" content="#ContentType()" />
          <meta http-equiv="Content-style-type" content="text/css" />
               #includeJavaScriptForHead()
              #IncludeStylesheets()
                                 #if($langname== "it")

                                                        <meta>italian meta
data here</meta>
                                 #else
                                                         <meta>english meta
data here</meta>
                                 #end
                 <head>


now whatever output i get by using this tempheader.vm template i write it to
another template that is "header.vm"

now it is working fine now but i dont know wether it is standard approch or
not.

neither do i.  ask the Jetspeed list if you are concerned about it.

i trying to seach about how this jetspeed container manages file writing for
large no of request.(how it synchronizes all request that write single file
)

                                    Please can you put some light on this

nope, i don't use Jetspeed.  you would have better luck asking on
their user mailing list, rather than asking on the Velocity list.


Thanks



Nathan Bubna wrote:
>
> This looks like it might be a good situation to use the
> "MultiViewsTool" to find the appropriate header.vm file:
>
> 
http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/view/i18n/MultiViewsTool.html
>
> I haven't used it myself, but my understanding is that you use it to
> find the appropriate template name for a specified locale (or the
> default locale if there is none for the specified locale).  And then
> you use the #parse() or #include() directives to load that
> template/file.
>
> So, assuming that you are using VelocityTools and the MultiViewsTool
> is in the context as $i18n, you would probably do something like:
>
> #parse( $i18n.findLocalizedResource("header.vm", $request.locale) )
>
>
> of course, i don't know if you are using VelocityTools or the
> VelocityViewServlet.  You mentioned portlets.  Are you using a
> specific portlet framework?  You might consider asking them for advice
> on this too.  It could be challenging to set up VelocityTools with
> that framework; i'm not really sure how that would work...
>
> On 4/16/07, santas <[EMAIL PROTECTED]> wrote:
>>
>> Hi
>>     What i want to do is that whenever i change "Locale " of my
>> application
>> depending on that locale i want to change my
>> "header.vm" files contetnt for Meta tag.
>>
>>     On my first page i am having one link that will chage my "Locale " of
>> application now suppose i click on link and now new Locale is "en"  then
>> i
>> want <meta > tag for en to be used by browser.
>>
>>   Whenever i change my Locale one portlet is called and that calls
>> another
>> class to set this locale in session for that user. I tryid to put that in
>> Velocity context but
>>
>> Now i am very much new to this velocity and trying lot many things but
>> getting nothing.
>> And my big confusion is that is this "header.vm" is called before that
>> portlet is called.
>> Can anybody give me proper direction please.
>>
>>
>> Thanks
>>
>>
>> --
>> View this message in context:
>> 
http://www.nabble.com/Changing-Header.vm-file-on-Locale-change-tf3589047.html#a10029907
>> Sent from the Velocity - Dev mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

--
View this message in context: 
http://www.nabble.com/Changing-Header.vm-file-on-Locale-change-tf3589047.html#a10052699
Sent from the Velocity - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to