I have a silly question ,  where is the setLocale method ?

I don't know where the package located.

src\main\scala\bootstrap\liftweb\Boot.scala:63: error: not found:
value setLocale
   setLocale(selectedLocale)

:)

Cheers,
  Neil

On Oct 26, 5:50 pm, Timothy Perrett <timo...@getintheloop.eu> wrote:
> Yes, your template code is right - your just seeing the default value  
> because you have not told lift what resources to use when it gets the  
> locale header from the browser.
>
> tryo() is like try/catch however, it will catch exceptions and returns  
> Box[T]
>
> I would really suggest starting with something a lot simpler than the  
> one i detailed that uses cookies and all sorts. Perhaps something like:
>
> def localeCalculator(request : Box[HTTPRequest]): Locale =
>    request.flatMap(r => {
>    tryo(r.locale) match {
>      // your match here
>    }
>
> }).openOr(java.util.Locale.getDefault())
>
> Hope that helps
>
> Cheers, Tim
>
> On 26 Oct 2009, at 09:21, Neil.Lv wrote:
>
>
>
> >  <lift:loc locid="login">Log in 222</lift:loc>
> >  That means this code is correctly, the problem is that the browser
> > doesn't know the locale?
>
> >  So we need to calculate the locale in the Boot.scala file ?
>
> > Cheers,
> >  Neil
>
> > On Oct 26, 5:09 pm, "Neil.Lv" <anim...@gmail.com> wrote:
> >> tryo(r.getParameter("locale")) match {
> >>    case Full(null) => workOutLocale
> >>    case Empty => workOutLocale
> >>    case Failure(_,_,_) => workOutLocale
> >>    case Full(selectedLocale) => {
> >>      setLocale(selectedLocale)
> >>      selectedLocale
> >>    }
> >>  }
>
> >>  In this code ,  what's the tryo ? is try ?
> >>  tryo () match {}
>
> >>  What's the changes about the HTTP container providers?
>
> >>  Thanks very much!
>
> >> Cheers,
> >>  Neil
>
> >> On Oct 26, 4:44 pm, Timothy Perrett <timo...@getintheloop.eu> wrote:
>
> >>> Hmm - you posted a link to my article at the begining of this  
> >>> thread;
> >>> in that article I explain lifts locale calculator. Without this,  
> >>> Lift
> >>> has no idea how you want to handle different locales. By default,  
> >>> the
> >>> following is used:
>
> >>>  var localeCalculator: Box[HTTPRequest] => Locale =
> >>> defaultLocaleCalculator _
>
> >>>  def defaultLocaleCalculator(request: Box[HTTPRequest]) =
> >>>  request.flatMap(_.locale).openOr(Locale.getDefault())
>
> >>> As you can see, that will get only the locale of your JVM, not the
> >>> browser. You will need to write the appropriate locale calculator;  
> >>> the
> >>> one in my article is a little out of date as there was a breaking
> >>> change not so long ago to the HTTP container providers but it should
> >>> give you enough to go on.
>
> >>> Does that help?
>
> >>> Cheers, Tim
>
> >>> On Oct 26, 8:35 am, "Neil.Lv" <anim...@gmail.com> wrote:
>
> >>>> 1:)   I create a file in the i18n folder
> >>>> /src/main/resources/i18n/lift-core_zh_CN.properties
> >>>> .....
> >>>> login = \u767b\u5f55
> >>>> logout = \u9000\u51fa
> >>>> log.in = \u767b\u5f55
> >>>> log.out = \u9000\u51fa
> >>>> sign.up = \u6ce8\u518c
> >>>> logged.in = \u5df2\u7ecf\u767b\u5f55
> >>>> ......
> >>>> the others are default (copy from lift-core_en_US.properties)
>
> >>>> 2:)
> >>>> ### index.html
> >>>> <lift:surround with="default" at="content">
> >>>>  <lift:loc id="login">Log in 111</lift:loc>
> >>>>  <lift:loc locid="login">Log in 222</lift:loc>
> >>>> </lift:surround>
>
> >>>> The lift:loc doesn't work that it should read the i18n string  
> >>>> from the
> >>>> lift-core_zh_CN.properties and show the chinese chars, (login =  
> >>>> \u767b
> >>>> \u5f55)
>
> >>>> but it always shows the default string (Log in 111, Log in 222).
>
> >>>> Has anything will be config ?
>
> >>>> Cheers,
> >>>>  Neil
>
> >>>> On Oct 26, 4:17 pm, Timothy Perrett <timo...@getintheloop.eu>  
> >>>> wrote:
>
> >>>>> Neil,
>
> >>>>> Can you zip and send me an example? It's quite likley your missing
> >>>>> something and without seeing the code it's difficult to say.
>
> >>>>> Cheers, Tim
>
> >>>>> Sent from my iPhone
>
> >>>>> On 26 Oct 2009, at 03:54, "Neil.Lv" <anim...@gmail.com> wrote:
>
> >>>>>> in the /index.html
> >>>>>> ###  both of them are not work !
> >>>>>> <lift:loc locid="log.in">Log in</lift:loc>
> >>>>>> <lift:loc id="log.in">Log in</lift:loc>
> >>>>>> ###
>
> >>>>>> Cheers,
> >>>>>> Neil
>
> >>>>>> On Oct 25, 6:27 pm, Timothy Perrett <timo...@getintheloop.eu>  
> >>>>>> wrote:
> >>>>>>> Neil,
>
> >>>>>>> This is normal practice with java localisation - the best  
> >>>>>>> thing is do
> >>>>>>> write all your strings then use native2ascii or similar  
> >>>>>>> tooling to
> >>>>>>> convert it into the unicode representation.
>
> >>>>>>> Glad you found my article helpful.
>
> >>>>>>> Cheers, Tim
>
> >>>>>>> On Oct 25, 5:02 am, "Neil.Lv" <anim...@gmail.com> wrote:
>
> >>>>>>>>  if i use this code and it works correctly !
>
> >>>>>>>> Code:
> >>>>>>>> ###
> >>>>>>>>   login = \u52a8\u4f5c
> >>>>>>>> ###
>
> >>>>>>>> But it's so difficult to write code !
>
> >>>>>>>> I don't know what happens with it .
>
> >>>>>>>> Cheers,
> >>>>>>>> Neil
>
> >>>>>>>> On Oct 25, 7:19 am, David Pollak  
> >>>>>>>> <feeder.of.the.be...@gmail.com>
> >>>>>>>> wrote:
>
> >>>>>>>>> Please make sure your lift-core_zh_CN.properties was saved  
> >>>>>>>>> as UTF-8
>
> >>>>>>>>> On Sat, Oct 24, 2009 at 11:31 AM, Neil.Lv <anim...@gmail.com>
> >>>>>>>>> wrote:
>
> >>>>>>>>>> Hi all,
>
> >>>>>>>>>> I create a props file in the resources folder  /src/main/
> >>>>>>>>>> resources/
> >>>>>>>>>> i18n/lift-core_zh_CN.properties
>
> >>>>>>>>>> And i changed the "log.in" text value.
>
> >>>>>>>>>> Now i use this code in my index.html page, and it doesn't
> >>>>>>>>>> corretly.
> >>>>>>>>>> (garbled)
>
> >>>>>>>>>> ### it doesn't work
> >>>>>>>>>>   <lift:loc locid="log.in">Log in</lift:loc>
> >>>>>>>>>> ###
>
> >>>>>>>>>> This information from:
>
> >>>>>>>>>>http://blog.getintheloop.eu/2009/7/26/how-to-extensive-localization-w
> >>>>>>>>>> ...
>
> >>>>>>>>>> Cheers,
> >>>>>>>>>> Neil
>
> >>>>>>>>> --
> >>>>>>>>> Lift, the simply functional web frameworkhttp://liftweb.net
> >>>>>>>>> Beginning Scalahttp://www.apress.com/book/view/1430219890
> >>>>>>>>> Follow me:http://twitter.com/dpp
> >>>>>>>>> Surf the harmonics
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to