[Lift] Re: About the localization with lift:loc !
yk, But if only one person change the language ( to ms_MY). Then the other users of the website will also see the page as ms_MY language not the default language en_US. I test in my computer it will affect the other browsers. So... Cheers, Neil On Nov 10, 3:16 pm, YING-KWANG TU ying.kwang...@gmail.com wrote: Neil, In my Boot.scala: def localeCalculator(request : Box[HTTPRequest]): Locale = request.flatMap( _.param(locale) match { case Nil = Full(Locale.getDefault()) case myLocale :: _ = { def iLocale = new Locale(myLocale.substring(0, 2), myLocale.substring(3, 5)) Locale.setDefault(iLocale) *// this is where I set the default locale to the new one* Full(iLocale) } } ).openOr(Locale.getDefault()) LiftRules.localeCalculator = localeCalculator _ On Tue, Nov 10, 2009 at 3:10 PM, Neil.Lv anim...@gmail.com wrote: yk, About the setLocale method in the demo ( http://219.94.110.243 ) 1:) First, I open the Firefox and type this link, i see the menu label is English. 2:) Second, I open the IE or other browser to view this page, and click the ms_MY link to change the language, it works fine. 3:) Then I refresh the index page in the Firefox (First step), the menu label is not English now, it's ms_MY. 4:) Is there the set locale is global for whole website or only in my computer ? Cheers, Neil def iLocale = new Locale(myLocale) Locale.setDefault(iLocale) Full(iLocale) ... On Nov 10, 1:58 pm, Neil.Lv anim...@gmail.com wrote: Maybe it's a bug with lift:loc locid=/ It's so confused. Cheers, Neil On Nov 10, 12:11 pm, YING-KWANG TU ying.kwang...@gmail.com wrote: By adding a println line in my localeCalculator churned the following output: en_US en_us en_us en_us en_us INFO - Service request (GET) / took 53 Milliseconds en_us ms_my ms_my ms_my ms_my INFO - Service request (GET) / took 37 Milliseconds ms_my th_th th_th th_th th_th INFO - Service request (GET) / took 37 Milliseconds It almost seems like it is java.util.Locale... Mysteriously, adding symlinks helps. For e.g. lift-core_en_us.properties - lift-core_en_US.properties On Tue, Nov 10, 2009 at 9:58 AM, YING-KWANG TU ying.kwang...@gmail.comwrote: Tim, You can browse tohttp://219.94.110.243forthetest site running on Ubuntu Server 9.10. There is a down-loadable test project which you can test out. Before this discussion thread on UTF-8 or ISO8859-1, 1. localization is running great on windows+maven2.2.1+liftweb1.1-M7 2. lift:loc locid=/ yet to work for both platform 3. on linux, even S.??() not working at all. Cheers, yk On Sat, Nov 7, 2009 at 8:29 PM, Timothy Perrett timo...@getintheloop.euwrote: You should always be working with UTF-8 files for properties / localisation - I think the encoding reported by jetty is something different (that it reads from the system)... ensure your props files are UTF-8 and go from there. Cheers, Tim On Nov 7, 12:48 am, yk ying.kwang...@gmail.com wrote: Hi Tim, I've developed n tested localization on windows and it worked perfectly. however, localization of the same project placed on ubuntu server 9.10 did not. WinXP --- jdk1.6 maven 2.2.1 lifeweb 1.1-M7 encoding=cp1252 (as reported by mvn jetty:run) Ubuntu 9.10 server --- openjdk OR sun-jdk6 maven 2.2.1 liftweb 1.1-M7 encoding=UTF-8 (as reported by mvn jetty:run) I can't quite point my finger on why it worked on windows but not on linux. Do i have to convert all files that need to be deployed to UTF-8 encoding? Thank you in advance. Cheers, yk 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: setLocale was a method created by me, specific to my application -
[Lift] Re: About the localization with lift:loc !
Don't call Locale.setDefault - that is a global configuration for the JVM I would urge you to re-read my article -in it you'll see how I take a note of the requested locale, and then hold that in a cookie for later reference or use on a future visit. Study the locale calculator carefully - there has been a breaking API change since it was written, but with a slight modification it will work fine. Moreover, ISO country codes are in the format en_US, not en_us... Lift is leveraging some base java localization and you have to stick to the rules :-) I'll try to reply in more detail later. Cheers, Tim Sent from my iPhone On 10 Nov 2009, at 08:19, Neil.Lv anim...@gmail.com wrote: Maybe the Locale.setDefault(iLocale) method's scope is the whole website not for the single user ? Cheers, Neil On Nov 10, 4:16 pm, Neil.Lv anim...@gmail.com wrote: yk, But if only one person change the language ( to ms_MY). Then the other users of the website will also see the page as ms_MY language not the default language en_US. I test in my computer it will affect the other browsers. So... Cheers, Neil On Nov 10, 3:16 pm, YING-KWANG TU ying.kwang...@gmail.com wrote: Neil, In my Boot.scala: def localeCalculator(request : Box[HTTPRequest]): Locale = request.flatMap( _.param(locale) match { case Nil = Full(Locale.getDefault()) case myLocale :: _ = { def iLocale = new Locale(myLocale.substring(0, 2), myLocale.substring(3, 5)) Locale.setDefault(iLocale) *// this is where I set the default locale to the new one* --~--~-~--~~~---~--~~ 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: About the localization with lift:loc !
Thanks Tim, we're looking forward to your detail reply! :) Cheers, Neil On Nov 10, 4:40 pm, Timothy Perrett timo...@getintheloop.eu wrote: Don't call Locale.setDefault - that is a global configuration for the JVM I would urge you to re-read my article -in it you'll see how I take a note of the requested locale, and then hold that in a cookie for later reference or use on a future visit. Study the locale calculator carefully - there has been a breaking API change since it was written, but with a slight modification it will work fine. Moreover, ISO country codes are in the format en_US, not en_us... Lift is leveraging some base java localization and you have to stick to the rules :-) I'll try to reply in more detail later. Cheers, Tim Sent from my iPhone On 10 Nov 2009, at 08:19, Neil.Lv anim...@gmail.com wrote: Maybe the Locale.setDefault(iLocale) method's scope is the whole website not for the single user ? Cheers, Neil On Nov 10, 4:16 pm, Neil.Lv anim...@gmail.com wrote: yk, But if only one person change the language ( to ms_MY). Then the other users of the website will also see the page as ms_MY language not the default language en_US. I test in my computer it will affect the other browsers. So... Cheers, Neil On Nov 10, 3:16 pm, YING-KWANG TU ying.kwang...@gmail.com wrote: Neil, In my Boot.scala: def localeCalculator(request : Box[HTTPRequest]): Locale = request.flatMap( _.param(locale) match { case Nil = Full(Locale.getDefault()) case myLocale :: _ = { def iLocale = new Locale(myLocale.substring(0, 2), myLocale.substring(3, 5)) Locale.setDefault(iLocale) *// this is where I set the default locale to the new one* --~--~-~--~~~---~--~~ 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: About the localization with lift:loc !
Yeah, it get the same result . So I'm very confused with the lift:loc ... Is anyone know this problem ? Thanks for help. :) Cheers, Neil On Nov 9, 2:53 pm, YING-KWANG TU ying.kwang...@gmail.com wrote: Neil, Considering that we are both using the lift-core_xx_XX in our bundle. 1. S.??(works seamlessly) However, I am having same issue with you on: lift:loc locid=loginDefault Value/lift:loc OR lift:loc loc_id=loginDefault Value/lift:loc OR lift:loclogin/lift:loc I am not sure if it has to do with the bundle name we are using but no, we can't get lift:loc/ to work. On Sat, Nov 7, 2009 at 9:46 PM, Neil.Lv anim...@gmail.com wrote: yk, I use the code that you write. 1:) I use this link to test the i18n http://localhost:8080/?locale=ms_MY S.??(login) = it works well ! 2:) But this code in the html page, it always doesn't work too, just show the Default value lift:loc locid=loginDefault value/lift:loc Thanks very much! Cheers, Neil On Nov 7, 8:29 pm, Timothy Perrett timo...@getintheloop.eu wrote: You should always be working with UTF-8 files for properties / localisation - I think the encoding reported by jetty is something different (that it reads from the system)... ensure your props files are UTF-8 and go from there. Cheers, Tim On Nov 7, 12:48 am, yk ying.kwang...@gmail.com wrote: Hi Tim, I've developed n tested localization on windows and it worked perfectly. however, localization of the same project placed on ubuntu server 9.10 did not. WinXP --- jdk1.6 maven 2.2.1 lifeweb 1.1-M7 encoding=cp1252 (as reported by mvn jetty:run) Ubuntu 9.10 server --- openjdk OR sun-jdk6 maven 2.2.1 liftweb 1.1-M7 encoding=UTF-8 (as reported by mvn jetty:run) I can't quite point my finger on why it worked on windows but not on linux. Do i have to convert all files that need to be deployed to UTF-8 encoding? Thank you in advance. Cheers, yk 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: setLocale was 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 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=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?
[Lift] Re: About the localization with lift:loc !
Tim, You can browse to http://219.94.110.243 for the test site running on Ubuntu Server 9.10. There is a down-loadable test project which you can test out. Before this discussion thread on UTF-8 or ISO8859-1, 1. localization is running great on windows+maven2.2.1+liftweb1.1-M7 2. lift:loc locid=/ yet to work for both platform 3. on linux, even S.??() not working at all. Cheers, yk On Sat, Nov 7, 2009 at 8:29 PM, Timothy Perrett timo...@getintheloop.euwrote: You should always be working with UTF-8 files for properties / localisation - I think the encoding reported by jetty is something different (that it reads from the system)... ensure your props files are UTF-8 and go from there. Cheers, Tim On Nov 7, 12:48 am, yk ying.kwang...@gmail.com wrote: Hi Tim, I've developed n tested localization on windows and it worked perfectly. however, localization of the same project placed on ubuntu server 9.10 did not. WinXP --- jdk1.6 maven 2.2.1 lifeweb 1.1-M7 encoding=cp1252 (as reported by mvn jetty:run) Ubuntu 9.10 server --- openjdk OR sun-jdk6 maven 2.2.1 liftweb 1.1-M7 encoding=UTF-8 (as reported by mvn jetty:run) I can't quite point my finger on why it worked on windows but not on linux. Do i have to convert all files that need to be deployed to UTF-8 encoding? Thank you in advance. Cheers, yk 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: setLocale was 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 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=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
[Lift] Re: About the localization with lift:loc !
By adding a println line in my localeCalculator churned the following output: en_US en_us en_us en_us en_us INFO - Service request (GET) / took 53 Milliseconds en_us ms_my ms_my ms_my ms_my INFO - Service request (GET) / took 37 Milliseconds ms_my th_th th_th th_th th_th INFO - Service request (GET) / took 37 Milliseconds It almost seems like it is java.util.Locale... Mysteriously, adding symlinks helps. For e.g. lift-core_en_us.properties - lift-core_en_US.properties On Tue, Nov 10, 2009 at 9:58 AM, YING-KWANG TU ying.kwang...@gmail.comwrote: Tim, You can browse to http://219.94.110.243 for the test site running on Ubuntu Server 9.10. There is a down-loadable test project which you can test out. Before this discussion thread on UTF-8 or ISO8859-1, 1. localization is running great on windows+maven2.2.1+liftweb1.1-M7 2. lift:loc locid=/ yet to work for both platform 3. on linux, even S.??() not working at all. Cheers, yk On Sat, Nov 7, 2009 at 8:29 PM, Timothy Perrett timo...@getintheloop.euwrote: You should always be working with UTF-8 files for properties / localisation - I think the encoding reported by jetty is something different (that it reads from the system)... ensure your props files are UTF-8 and go from there. Cheers, Tim On Nov 7, 12:48 am, yk ying.kwang...@gmail.com wrote: Hi Tim, I've developed n tested localization on windows and it worked perfectly. however, localization of the same project placed on ubuntu server 9.10 did not. WinXP --- jdk1.6 maven 2.2.1 lifeweb 1.1-M7 encoding=cp1252 (as reported by mvn jetty:run) Ubuntu 9.10 server --- openjdk OR sun-jdk6 maven 2.2.1 liftweb 1.1-M7 encoding=UTF-8 (as reported by mvn jetty:run) I can't quite point my finger on why it worked on windows but not on linux. Do i have to convert all files that need to be deployed to UTF-8 encoding? Thank you in advance. Cheers, yk 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: setLocale was 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 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=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
[Lift] Re: About the localization with lift:loc !
Maybe it's a bug with lift:loc locid=/ It's so confused. Cheers, Neil On Nov 10, 12:11 pm, YING-KWANG TU ying.kwang...@gmail.com wrote: By adding a println line in my localeCalculator churned the following output: en_US en_us en_us en_us en_us INFO - Service request (GET) / took 53 Milliseconds en_us ms_my ms_my ms_my ms_my INFO - Service request (GET) / took 37 Milliseconds ms_my th_th th_th th_th th_th INFO - Service request (GET) / took 37 Milliseconds It almost seems like it is java.util.Locale... Mysteriously, adding symlinks helps. For e.g. lift-core_en_us.properties - lift-core_en_US.properties On Tue, Nov 10, 2009 at 9:58 AM, YING-KWANG TU ying.kwang...@gmail.comwrote: Tim, You can browse tohttp://219.94.110.243for the test site running on Ubuntu Server 9.10. There is a down-loadable test project which you can test out. Before this discussion thread on UTF-8 or ISO8859-1, 1. localization is running great on windows+maven2.2.1+liftweb1.1-M7 2. lift:loc locid=/ yet to work for both platform 3. on linux, even S.??() not working at all. Cheers, yk On Sat, Nov 7, 2009 at 8:29 PM, Timothy Perrett timo...@getintheloop.euwrote: You should always be working with UTF-8 files for properties / localisation - I think the encoding reported by jetty is something different (that it reads from the system)... ensure your props files are UTF-8 and go from there. Cheers, Tim On Nov 7, 12:48 am, yk ying.kwang...@gmail.com wrote: Hi Tim, I've developed n tested localization on windows and it worked perfectly. however, localization of the same project placed on ubuntu server 9.10 did not. WinXP --- jdk1.6 maven 2.2.1 lifeweb 1.1-M7 encoding=cp1252 (as reported by mvn jetty:run) Ubuntu 9.10 server --- openjdk OR sun-jdk6 maven 2.2.1 liftweb 1.1-M7 encoding=UTF-8 (as reported by mvn jetty:run) I can't quite point my finger on why it worked on windows but not on linux. Do i have to convert all files that need to be deployed to UTF-8 encoding? Thank you in advance. Cheers, yk 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: setLocale was 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 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=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
[Lift] Re: About the localization with lift:loc !
Neil, Considering that we are both using the lift-core_xx_XX in our bundle. 1. S.??(works seamlessly) However, I am having same issue with you on: lift:loc locid=loginDefault Value/lift:loc OR lift:loc loc_id=loginDefault Value/lift:loc OR lift:loclogin/lift:loc I am not sure if it has to do with the bundle name we are using but no, we can't get lift:loc/ to work. On Sat, Nov 7, 2009 at 9:46 PM, Neil.Lv anim...@gmail.com wrote: yk, I use the code that you write. 1:) I use this link to test the i18n http://localhost:8080/?locale=ms_MY S.??(login) = it works well ! 2:) But this code in the html page, it always doesn't work too, just show the Default value lift:loc locid=loginDefault value/lift:loc Thanks very much! Cheers, Neil On Nov 7, 8:29 pm, Timothy Perrett timo...@getintheloop.eu wrote: You should always be working with UTF-8 files for properties / localisation - I think the encoding reported by jetty is something different (that it reads from the system)... ensure your props files are UTF-8 and go from there. Cheers, Tim On Nov 7, 12:48 am, yk ying.kwang...@gmail.com wrote: Hi Tim, I've developed n tested localization on windows and it worked perfectly. however, localization of the same project placed on ubuntu server 9.10 did not. WinXP --- jdk1.6 maven 2.2.1 lifeweb 1.1-M7 encoding=cp1252 (as reported by mvn jetty:run) Ubuntu 9.10 server --- openjdk OR sun-jdk6 maven 2.2.1 liftweb 1.1-M7 encoding=UTF-8 (as reported by mvn jetty:run) I can't quite point my finger on why it worked on windows but not on linux. Do i have to convert all files that need to be deployed to UTF-8 encoding? Thank you in advance. Cheers, yk 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: setLocale was 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 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=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
[Lift] Re: About the localization with lift:loc !
You should always be working with UTF-8 files for properties / localisation - I think the encoding reported by jetty is something different (that it reads from the system)... ensure your props files are UTF-8 and go from there. Cheers, Tim On Nov 7, 12:48 am, yk ying.kwang...@gmail.com wrote: Hi Tim, I've developed n tested localization on windows and it worked perfectly. however, localization of the same project placed on ubuntu server 9.10 did not. WinXP --- jdk1.6 maven 2.2.1 lifeweb 1.1-M7 encoding=cp1252 (as reported by mvn jetty:run) Ubuntu 9.10 server --- openjdk OR sun-jdk6 maven 2.2.1 liftweb 1.1-M7 encoding=UTF-8 (as reported by mvn jetty:run) I can't quite point my finger on why it worked on windows but not on linux. Do i have to convert all files that need to be deployed to UTF-8 encoding? Thank you in advance. Cheers, yk 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: setLocale was 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 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=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 default (copy from lift-core_en_US.properties) 2:) ### index.html lift:surround
[Lift] Re: About the localization with lift:loc !
yk, I use the code that you write. 1:) I use this link to test the i18n http://localhost:8080/?locale=ms_MY S.??(login) = it works well ! 2:) But this code in the html page, it always doesn't work too, just show the Default value lift:loc locid=loginDefault value/lift:loc Thanks very much! Cheers, Neil On Nov 7, 8:29 pm, Timothy Perrett timo...@getintheloop.eu wrote: You should always be working with UTF-8 files for properties / localisation - I think the encoding reported by jetty is something different (that it reads from the system)... ensure your props files are UTF-8 and go from there. Cheers, Tim On Nov 7, 12:48 am, yk ying.kwang...@gmail.com wrote: Hi Tim, I've developed n tested localization on windows and it worked perfectly. however, localization of the same project placed on ubuntu server 9.10 did not. WinXP --- jdk1.6 maven 2.2.1 lifeweb 1.1-M7 encoding=cp1252 (as reported by mvn jetty:run) Ubuntu 9.10 server --- openjdk OR sun-jdk6 maven 2.2.1 liftweb 1.1-M7 encoding=UTF-8 (as reported by mvn jetty:run) I can't quite point my finger on why it worked on windows but not on linux. Do i have to convert all files that need to be deployed to UTF-8 encoding? Thank you in advance. Cheers, yk 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: setLocale was 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 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=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
[Lift] Re: About the localization with lift:loc !
Timothy Perrett timo...@getintheloop.eu writes: You should always be working with UTF-8 files for properties / localisation - I think the encoding reported by jetty is something different (that it reads from the system)... ensure your props files are UTF-8 and go from there. Careful now :-) Property files that are to be read by java's Properties class should be in iso-8859-1 encoding and converted with native2ascii. http://java.sun.com/javase/6/docs/api/java/util/Properties.html#load%28java.io.InputStream%29 XML property files can be in UTF-8 though /Jeppe --~--~-~--~~~---~--~~ 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: About the localization with lift:loc !
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] Re: About the localization with lift:loc !
Neil, 1. I've tried creating life-core_th_TH.utf-8 by copying from life-core_en_US.properties file. 2. Open the th_TH file in notepad and overwritten as UTF-8 3. I've copied some thai characters from the internet and replaced login=ที่อยู่ปัจจุบัน and saved. 3. native2ascii comes with java, so I open cmd, change directory to src/main/resources/i18n 4. at prompt, native2ascii -encoding UTF-8 life-core_th_TH.utf-8 life-core_th_TH.properties Voilà! On Thu, Nov 5, 2009 at 7:56 AM, yk ying.kwang...@gmail.com wrote: 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
[Lift] Re: About the localization with lift:loc !
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.inLog in/lift:loc lift:loc id=log.inLog 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.inLog 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 -~--~~~~--~~--~--~---
[Lift] Re: About the localization with lift:loc !
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=loginLog in 111/lift:loc lift:loc locid=loginLog 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.inLog in/lift:loc lift:loc id=log.inLog 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.inLog 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 -~--~~~~--~~--~--~---
[Lift] Re: About the localization with lift:loc !
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=loginLog in 111/lift:loc lift:loc locid=loginLog 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.inLog in/lift:loc lift:loc id=log.inLog 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.inLog 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 -~--~~~~--~~--~--~---
[Lift] Re: About the localization with lift:loc !
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=loginLog in 111/lift:loc lift:loc locid=loginLog 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.inLog in/lift:loc lift:loc id=log.inLog 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.inLog 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 -~--~~~~--~~--~--~---
[Lift] Re: About the localization with lift:loc !
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 default (copy from lift-core_en_US.properties) 2:) ### index.html lift:surround with=default at=content lift:loc id=loginLog in 111/lift:loc lift:loc locid=loginLog 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.inLog in/lift:loc lift:loc id=log.inLog 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.inLog 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 -~--~~~~--~~--~--~---
[Lift] Re: About the localization with lift:loc !
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 default (copy from lift-core_en_US.properties) 2:) ### index.html lift:surround with=default at=content lift:loc id=loginLog in 111/lift:loc lift:loc locid=loginLog 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.inLog in/lift:loc lift:loc id=log.inLog 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.inLog 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
[Lift] Re: About the localization with lift:loc !
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=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 default (copy from lift-core_en_US.properties) 2:) ### index.html lift:surround with=default at=content lift:loc id=loginLog in 111/lift:loc lift:loc locid=loginLog 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.inLog in/lift:loc lift:loc id=log.inLog 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.inLog in/lift:loc ### This information
[Lift] Re: About the localization with lift:loc !
setLocale was 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 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=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 default (copy from lift-core_en_US.properties) 2:) ### index.html lift:surround with=default at=content lift:loc id=loginLog in 111/lift:loc lift:loc locid=loginLog 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.inLog in/lift:loc lift:loc id=log.inLog 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
[Lift] Re: About the localization with lift:loc !
... 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: setLocale was 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 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=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 default (copy from lift-core_en_US.properties) 2:) ### index.html lift:surround with=default at=content lift:loc id=loginLog in 111/lift:loc lift:loc locid=loginLog 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.inLog in/lift:loc lift:loc id=log.inLog 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
[Lift] Re: About the localization with lift:loc !
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/net/liftweb/http/provider/HTTPRequest.html 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: setLocale was 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 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=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 default (copy from lift-core_en_US.properties) 2:) ### index.html lift:surround with=default at=content lift:loc id=loginLog in 111/lift:loc lift:loc locid=loginLog 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.inLog in/lift:loc lift:loc id=log.inLog 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
[Lift] Re: About the localization with lift:loc !
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: setLocale was 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 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=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 default (copy from lift-core_en_US.properties) 2:) ### index.html lift:surround with=default at=content lift:loc id=loginLog in 111/lift:loc lift:loc locid=loginLog 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.inLog in/lift:loc lift:loc id=log.inLog in/lift:loc ### Cheers, Neil On Oct 25, 6:27 pm, Timothy Perrett
[Lift] Re: About the localization with lift:loc !
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.inLog 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 -~--~~~~--~~--~--~---
[Lift] Re: About the localization with lift:loc !
Yeah, it's saved as U8-UNIX encoding by the Ultraedit. My IE's default language is zh_CN, but i get the same garbled in the browser. Like this in the browser. ### 555å Ž ### 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.inLog 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 -~--~~~~--~~--~--~---
[Lift] Re: About the localization with lift:loc !
David Pollak feeder.of.the.be...@gmail.com writes: Please make sure your lift-core_zh_CN.properties was saved as UTF-8 Unless, lift does it's own property loading, property files need to be in ISO-8859: When saving properties to a stream or loading them from a stream, the ISO 8859-1 character encoding is used. For characters that cannot be directly represented in this encoding, Unicode escapes are used; however, only a single 'u' character is allowed in an escape sequence. The native2ascii tool can be used to convert property files to and from other character encodings. http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html /Jeppe --~--~-~--~~~---~--~~ 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: About the localization with lift:loc !
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.inLog 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 -~--~~~~--~~--~--~---
[Lift] Re: About the localization with lift:loc !
in the /index.html ### both of them are not work ! lift:loc locid=log.inLog in/lift:loc lift:loc id=log.inLog 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.inLog 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 -~--~~~~--~~--~--~---
[Lift] Re: About the localization with lift:loc !
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.inLog in/lift:loc ### This information from: http://blog.getintheloop.eu/2009/7/26/how-to-extensive-localization-with-the-liftweb-framework Cheers, Neil -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://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 -~--~~~~--~~--~--~---