[Lift] Re: About the localization with lift:loc !

2009-11-04 Thread yk

Neil,

1. I've copied life-core_en_US.properties from lift-webkit.jar to src/
main/resources/i18n like u did n renamed to life-
core_ms_MY.properties.
2. I've changed the login=Login (BM) for in file life-
core_ms_MY.properties for testing
3. I am able to test localization on the fly successfully (for e.g.
http://localhost:8080/?locale=ms_MY)

here is the code that is working for me:

def localeCalculator(request : Box[HTTPRequest]): Locale =
  request.flatMap(
_.param(locale) match {
  case Nil = Full(Locale.getDefault())
  case myLocale :: _ = {
// println(myLocale)
Full(new Locale(myLocale))
  }
}
  ).openOr(Locale.getDefault())

LiftRules.localeCalculator = localeCalculator _

Not the best of thing but enough to get localization going at this
point.

On Oct 26, 10:34 pm, Neil.Lv anim...@gmail.com wrote:
   I feel the information of this page is less for me,

   but Thanks all the same !   :)

 Cheers,
   Neil

 On Oct 26, 9:12 pm, Timothy Perrett timo...@getintheloop.eu wrote:

  The browser already knows the locale, you have it backward! Your  
  localeCalculator is so that the browser can get lift to return the  
  right content.

  Take a look at:

 http://scala-tools.org/mvnsites/liftweb-1.1-M6/lift-webkit/scaladocs/...

  I would start with just getting lift to explicitly set locale based on  
  a query string or something... it will help you understand how the  
  mechanism works.

  Cheers, Tim

  On 26 Oct 2009, at 12:34, Neil.Lv wrote:

    ...

    Where is the locale to be set that the browser can know the
   locale ?

    Thanks very much!

   Cheers,
    Neil

   On Oct 26, 7:50 pm, Timothy Perrett timo...@getintheloop.eu wrote:
  setLocalewas a method created by me, specific to my application - it
   does not exist in Lift... hence why I removed it in my simplified
   example.

   Cheers, Tim

   On 26 Oct 2009, at 11:45, Neil.Lv wrote:

   I have a silly question ,  where is thesetLocalemethod ?

   I don't know where the package located.

   src\main\scala\bootstrap\liftweb\Boot.scala:63: error: not found:
   valuesetLocale
    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=loginLog 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 

[Lift] Foreign Key Constraints in PostgreSQL through MappedLongForeignKey fields?

2009-10-23 Thread yk

I was running the models of One-To-Many example from WiKi (http://
wiki.github.com/dpp/liftweb/how-to-work-with-one-to-many-
relationships) against PostgreSQL hoping to see a foreign key
constraint on the Book table. I got an index instead.

Is there a way to get schemifier to acknowledge the foreign key
constraints?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Lift] Re: Question about the Getting Started Guide

2009-09-30 Thread yk

Right on there, Indrajit. I was playing with liftweb examples from
http://github.com/dpp/liftweb/tree/dpp_wip_actorize and ran into
similar hiccup.

On Sep 30, 1:49 pm, Indrajit Raychaudhuri indraj...@gmail.com wrote:
 Jack,

 maven-jetty-plugin belongs to the group org.mortbay.jetty, not
 org.apache.maven.plugins. This makes me suspect that your jetty plugin
 isn't configured properly.

 A minimal jetty plugin configuration would look like this:

        plugin
          groupIdorg.mortbay.jetty/groupId
          artifactIdmaven-jetty-plugin/artifactId
          configuration
            contextPath//contextPath
          /configuration
        /plugin

 Could you please ensure this config under build - plugin section in
 your pom.xml and retry?

 Cheers, Indrajit

 On 30/09/09 10:09 AM, jlist9 wrote:



  I just tried it on another computer and got exactly the same error when
  running (below). I think something is broken. I checked the mvn output
  in the first run to create helloworld project and didn't see any mentioning
  of jetty...

  D:\Java\liftweb\workmvn jetty:run
  [INFO] Scanning for projects...
  [INFO] Searching repository for plugin with prefix: 'jetty'.
  [INFO] artifact org.apache.maven.plugins:maven-jetty-plugin: checking
  for updates from central
  [INFO] 
  
  [ERROR] BUILD ERROR
  [INFO] 
  
  [INFO] The plugin 'org.apache.maven.plugins:maven-jetty-plugin' does
  not exist or no valid version c
  ould be found
  [INFO] 
  
  [INFO] For more information, run Maven with the -e switch
  [INFO] 
  
  [INFO] Total time:  1 second
  [INFO] Finished at: Tue Sep 29 21:16:31 PDT 2009
  [INFO] Final Memory: 1M/4M
  [INFO] 
  

  On Tue, Sep 29, 2009 at 8:59 PM, Naftoli Gugenheimnaftoli...@gmail.com  
  wrote:

  I had such an issue when it was confused about which version of Jetty. Is 
  there any more detail? Try running with error details enabled (mvn -help 
  should tell you how).

  -
  jlist9jli...@gmail.com  wrote:

  Yes, I have a network connection. Maven downloaded some other
  components and the end result was BUILD SUCCESSFUL...

  On Tue, Sep 29, 2009 at 8:29 PM, Naftoli Gugenheimnaftoli...@gmail.com  
  wrote:

  Do you have a network connection? The idea of maven is that it
  downloads whatever it's missing.

  On Tue, Sep 29, 2009 at 9:11 PM, jlist9jli...@gmail.com  wrote:

  Hi,

  I'm new to Lift. I'm trying to follow the getting started guide to
  build the first simple
  demo.helloworld project. At the end of Maven command output I see
  BUILD SUCCESSFUL.
  However, when I run mvn jetty:run, I get error:

  The plugin 'org.apache.maven.plugins:maven-jetty-plugin' does not
  exist or no valid version could be found

  I wonder if I need to manually install jetty? If so, is there any
  configuration instructions?

  Thanks
  Jack

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Lift] Seeking for Simple Sample .scala and .html that mimics CRUDify/Seam-Gen

2009-09-28 Thread yk

I have had plowing through the internet for two weeks now, for a
simple tutorial that can point me in the right direction to catch on
the Lift/Scala bandwagon.

I am a CodeCharge studio coder and have had exposed to seam-gen codes
deploying on JBoss AS at the rookie level.

I had tried RoR and have liked the instant gratification joy but not
the performance issue(s) that I stumbled across on the internet.

At this junction, I had went through examples of Starting with Lift,
Exploring Lift, and the tutorial from IBM involving Comet. I had also
went through the OneToMany tutorial on Wiki (along with source code)
and the ManyToMany (UserMon) example from one of the posting.

I believe Scala/Lift will be the probable solution for the portal I am
building and wish for some additional help.

I am shamelessly asking for a bunch of sample codes (Both snippets and
html) of the OneToMany tutorial (the one involving Author and Book)
that mimics CRUDify/Seam-Gen generated code with clear add/remove/
update/delete defs so a noob like myself can understand better =S

Thank you in advance.
yk

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Lift] Re: Seeking for Simple Sample .scala and .html that mimics CRUDify/Seam-Gen

2009-09-28 Thread yk

Dont mind my previous message. I've finally located
net.liftweb.example package from git.

The Simple example is exactly what I am looking for.

Cheers

On Sep 28, 8:45 pm, yk ying.kwang...@gmail.com wrote:
 I have had plowing through the internet for two weeks now, for a
 simple tutorial that can point me in the right direction to catch on
 the Lift/Scala bandwagon.

 I am a CodeCharge studio coder and have had exposed toseam-gen codes
 deploying on JBoss AS at the rookie level.

 I had tried RoR and have liked the instant gratification joy but not
 the performance issue(s) that I stumbled across on the internet.

 At this junction, I had went through examples of Starting with Lift,
 Exploring Lift, and the tutorial from IBM involving Comet. I had also
 went through the OneToMany tutorial on Wiki (along with source code)
 and the ManyToMany (UserMon) example from one of the posting.

 I believe Scala/Lift will be the probable solution for the portal I am
 building and wish for some additional help.

 I am shamelessly asking for a bunch of sample codes (Both snippets and
 html) of the OneToMany tutorial (the one involving Author and Book)
 that mimics CRUDify/Seam-Gen generated code with clear add/remove/
 update/delete defs so a noob like myself can understand better =S

 Thank you in advance.
     yk

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---