don't know what the initial question was, but tiles
has support for multiple languages as well.

Sandeep
--- flare <[EMAIL PROTECTED]> wrote:
> I've coded this time ago.. 
> 
> --- cut here ----- template
> 
> <%@ page import="app.*" %>
> <%@ taglib uri='/WEB-INF/struts-template.tld'
> prefix='template' %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld"
> prefix="bean" %>
> <%! String output,link,ext; %>
> 
> <bean:header id="lang" name="Accept-Language" />
> 
> <% 
>
link=StringUtils.pathFilter(request.getParameter("link"));
>     if (link==null || link.equals(""))
>      link="index";
> 
>    ext=StringUtils.matchLang("it,en",lang,"it");
>    output="../page/" + link + ext + ".jsp";
> %>
> 
> <template:insert template='chapterTemplate.jsp'>
>   <template:put name='title' content='<%=link%>'
> direct='true' />
>   <template:put name='header'
> content='../page/header.jsp' />
>   <template:put name='left'
> content='../page/left.jsp' />
>   <template:put name='content' content='<%=output%>'
> />
>   <template:put name='right'
> content='../page/right.jsp' />
>   <template:put name='footer'
> content='../page/footer.html' />
> </template:insert>
> 
> 
> 
> --- cut here --- support routines
> 
>         public static final String pathFilter(String
> string) {
>         if (string == null || string.length() == 0 )
> {
>             return string;
>         }
>         char [] sArray = string.toCharArray();
>         StringBuffer buf = new
> StringBuffer(sArray.length);
>         char ch;
>         for (int i=0; i<sArray.length; i++) {
>             ch = sArray[i];
>             if(ch == '.'||ch=='/'||ch=='\\') 
>              continue;
>             else {
>                 buf.append(ch);
>             }
>         }
>         return buf.toString();
>     }
> 
>     /** data la lingua sul server e quella via
> browser restituisce una
>      *  estensione accettabile nel formato _lang es
> _it 
>      *  @param servlet la sequenza di linque
> supportate (es: it,en,de)
>      *  @param browser la sequenza di lingue
> preferite dall'utente 
>      *  @param def  se lang=default restituisce ""
>      *  @return la stringa nel formato _lang o "" se
> default (lingua 
> di default)
>      **/
>     public static final String matchLang(String
> servlet, String 
> browser, String def)
>     {
>          String br,se;
>          StringTokenizer st1 = new
> StringTokenizer(servlet,",");
>          StringTokenizer st2 = new
> StringTokenizer(browser,",");
>          
>          while(st2.hasMoreTokens()) {
>           br=(String)st2.nextToken().substring(0,2);
>           while(st1.hasMoreTokens()) {
>           
> se=(String)st1.nextToken().substring(0,2);
>            if (br.equals(se))
>              if (br.equals(def))
>               return "";
>              else return "_"+se;  
>           }
>          }
>          return "";
>     }
> 
> 
> --- cut here
> in the template just set the available languages and
> the preferred 
> ones, then use this kind of links in your pages:
> general.jsp?link=pippo
> 
> and pippo_xx.jsp (where xx is the foreign language)
> will be called, 
> if the browser language is the default or the
> language is not 
> supported pippo.jsp will be used
> 
> Just an idea 
> 
>  Flare
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

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

Reply via email to