Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from iron9light/i18n
Support i18n and add translations for simplified Chinese
- Loading branch information
Showing
35 changed files
with
1,470 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,22 @@ | |||
seq(webSettings :_*) | |||
|
|||
organization := "Lift" | |||
|
|||
name := "seventhings" | |||
|
|||
version := "0.1" | |||
|
|||
scalaVersion := "2.9.1" | |||
|
|||
libraryDependencies ++= { | |||
val liftVersion = "2.4" | |||
Seq( | |||
"net.liftweb" %% "lift-webkit" % liftVersion, | |||
"net.liftweb" %% "lift-wizard" % liftVersion, | |||
"org.mortbay.jetty" % "jetty" % "6.1.22" % "container; test", | |||
"junit" % "junit" % "4.10" % "test", | |||
"ch.qos.logback" % "logback-classic" % "1.0.6", | |||
"org.specs2" %% "specs2" % "1.11" % "test", | |||
"com.h2database" % "h2" % "1.3.167" | |||
) | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,9 +1 @@ | |||
#Project properties | sbt.version=0.11.3 | ||
#Fri Apr 23 11:24:20 PDT 2010 | |||
project.organization=Lift | |||
project.name=seventhings | |||
sbt.version=0.7.4 | |||
project.version=0.1 | |||
def.scala.version=2.7.7 | |||
build.scala.versions=2.8.1 | |||
project.initialize=false |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,12 @@ | |||
resolvers += "Web plugin repo" at "http://siasia.github.com/maven2" | |||
|
|||
libraryDependencies <+= sbtVersion(v => v match { | |||
case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8" | |||
case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10" | |||
case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11" | |||
case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1" | |||
}) | |||
|
|||
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1") | |||
|
|||
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1 +1 @@ | |||
java -Xmx512M -Xss2M -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launcher.jar "$@" | java -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -jar `dirname $0`/sbt-launch.jar "$@" |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,2 +1,2 @@ | |||
set SCRIPT_DIR=%~dp0 | set SCRIPT_DIR=%~dp0 | ||
java -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M -jar "%SCRIPT_DIR%\sbt-launcher.jar" %* | java -Xmx512M -jar "%SCRIPT_DIR%sbt-launch.jar" %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
# Index | |||
Home = \u9996\u9875 | |||
Lazy\ Loading = \u5EF6\u8FDF\u52A0\u8F7D | |||
Parallel\ Rendering = \u5E76\u884C\u6E32\u67D3 | |||
# Wiring = | |||
Designer\ Friendly\ Templates = \u8BBE\u8BA1\u53CB\u597D\u7684\u6A21\u677F\u7CFB\u7EDF | |||
Wizard = \u5411\u5BFC\u7EC4\u4EF6 | |||
Security = \u5B89\u5168\u6027 | |||
|
|||
# Chat | |||
Welcome = \u6B22\u8FCE | |||
|
|||
# Wizard | |||
First\ Name = \u59D3\u540D | |||
Name\ Too\ Short = \u540D\u5B57\u592A\u77ED\u4E86 | |||
Name\ Too\ Long = \u540D\u5B57\u592A\u957F\u4E86 | |||
Age = \u5E74\u9F84 | |||
Too\ young = \u5E74\u9F84\u592A\u5C0F\u4E86 | |||
You\ should\ be\ dead = \u4F60\u662F\u795E\u4ED9\u5417 | |||
Mom\ or\ Dad's\ name = \u5988\u5988\u6216\u7238\u7238\u7684\u540D\u5B57 | |||
Pet's\ name = \u5BA0\u7269\u7684\u540D\u5B57 | |||
Thank\ you\ for\ registering\ your\ pet = \u611F\u8C22\u60A8\u6CE8\u518C\u60A8\u7684\u5BA0\u7269 | |||
your\ age = \u60A8\u7684\u5E74\u9F84 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
# Index | |||
Home = \u9996\u9801 | |||
Lazy\ Loading = \u5EF6\u9072\u52A0\u8F09 | |||
Parallel\ Rendering = \u4E26\u884C\u6E32\u67D3 | |||
# Wiring = | |||
Designer\ Friendly\ Templates = \u8A2D\u8A08\u53CB\u597D\u7684\u6A21\u677F\u7CFB\u7D71 | |||
Wizard = \u56AE\u5C0E\u7D44\u4EF6 | |||
Security = \u5B89\u5168\u6027 | |||
|
|||
# Chat | |||
Welcome = \u6B61\u8FCE | |||
|
|||
# Wizard | |||
First\ Name = \u59D3\u540D | |||
Name\ Too\ Short = \u540D\u5B57\u592A\u77ED\u4E86 | |||
Name\ Too\ Long = \u540D\u5B57\u592A\u9577\u4E86 | |||
Age = \u5E74\u9F61 | |||
Too\ young = \u5E74\u9F61\u592A\u5C0F\u4E86 | |||
You\ should\ be\ dead = \u4F60\u662F\u795E\u4ED9\u55CE | |||
Mom\ or\ Dad's\ name = \u5ABD\u5ABD\u6216\u7238\u7238\u7684\u540D\u5B57 | |||
Pet's\ name = \u5BF5\u7269\u7684\u540D\u5B57 | |||
Thank\ you\ for\ registering\ your\ pet = \u611F\u8B1D\u60A8\u8A3B\u518A\u60A8\u7684\u5BF5\u7269 | |||
your\ age = \u60A8\u7684\u5E74\u9F61 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,113 @@ | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta content="text/html; charset=UTF-8" http-equiv="content-type"> | |||
<title>Comet</title> | |||
</head> | |||
<body class="lift:content_id=main"> | |||
<div id="main" class="lift:surround?with=default;at=content"> | |||
<p> | |||
<big> | |||
<big> | |||
Lift的一个关键功能就是对Comet(服务器推送)和相关连的Ajax的支持。 | |||
本页包含了一个多人聊天室应用,当任何人发送聊天消息时,会以Comet(服务器推送)更新浏览器。 | |||
用户可以通过页面的输入框发送一行信息到聊天室,信息会以异步请求的方式发送到服务器(页面在请求的时候不会重新加载)。 | |||
</big> | |||
</big> | |||
</p> | |||
|
|||
<div style="margin: 12px; border: 2px solid purple"> | |||
<ul class="lift:comet?type=Chat"> | |||
<li>Line 1</li> | |||
<li class="clearable">Line 2</li> | |||
<li class="clearable">Line 3</li> | |||
</ul> | |||
|
|||
<form class="lift:Form.ajax"> | |||
<input class="lift:ChatIn" id="chat_in"> | |||
<input type="submit" value="Chat"> | |||
</form> | |||
</div> | |||
|
|||
<big> | |||
<big> | |||
让我们看看应用的Comet(服务器推送聊天内容列表)部分的标记代码: | |||
</big> | |||
</big> | |||
<pre class="lift:ShowCode?name=/comet.html;start=ul+;end=form">view code</pre> | |||
|
|||
<div> | |||
<big> | |||
<big> | |||
我们只是简单的标记<ul>标签为一个snippet调用,用来载入名为<tt>Chat</tt>的Comet组件。 | |||
让我们看看<tt>Chat</tt>组件。 | |||
</big> | |||
</big> | |||
</div> | |||
|
|||
<pre class="lift:ShowCode?name=/net/liftweb/seventhings/comet/Chat.scala;start=**;end=**">view code</pre> | |||
|
|||
|
|||
<div> | |||
<big> | |||
<big> | |||
再次证明,对于其他框架来说很难或者根本不可能的事情,对于Lift来说小菜一碟。 | |||
开发人员不用管浏览器是如何轮询(poll)最新的变化。 | |||
Lift默认使用long polling和合并多个comet组件到一个单独的long poll,当web socket标准化以后,Lift将会自动支持web socket而不影响你写的代码。 | |||
开发人员只用管“什么时候服务器端发生变化了,就更新组件”,Lift来完成剩下的工作。 | |||
</big> | |||
</big> | |||
</div> | |||
|
|||
<br> | |||
|
|||
<div> | |||
<big> | |||
<big> | |||
请注意,你可以试试用<a href="http://en.wikipedia.org/wiki/Cross-site_scripting">cross site scripting</a>攻击来攻击本网站(例如,在聊天输入框输入<tt><script>alert('我黑了你的机器')</script></tt>)。 | |||
你会发现在开发者没有做任何事情的情况下,Lift正确的转码了你输入的东西。 | |||
</big> | |||
</big> | |||
</div> | |||
|
|||
<br> | |||
|
|||
<div> | |||
<big> | |||
<big> | |||
让我们来看看关于Ajax输入表单的标记代码: | |||
</big> | |||
</big> | |||
</div> | |||
|
|||
<pre class="lift:ShowCode?name=/comet.html;start=form;end=div">view code</pre> | |||
|
|||
<div> | |||
<big> | |||
<big> | |||
我们用<tt>Form.ajax</tt> snippet来指示这个<tt>form</tt>是一个Ajax表单。 | |||
文本输入触发<tt>ChatIn</tt> snippet。 | |||
来看看这个snippet: | |||
</big> | |||
</big> | |||
</div> | |||
|
|||
<pre class="lift:ShowCode?name=/net/liftweb/seventhings/snippet/ChatIn.scala;start=**">view code</pre> | |||
|
|||
<div> | |||
<big> | |||
<big> | |||
再次表明,我们不许要任何深入研究。 | |||
Lift负责行为(发送输入的<tt>String</tt>到<tt>ChatServer</tt>。)的关联。 | |||
我们没有设置routes或任何其他东西。 | |||
甚至这段代码可以抵抗replay攻击,因为这个自动生成的routes是动态、随机和不可预测的。 | |||
当你想用标准的REST访问来完成任务的时候,Lift提供<a href="http://www.assembla.com/wiki/show/liftweb/REST_Web_Services">非常棒的REST支持</a>。 | |||
并且Lift支持数据或者HTML的Comet,所以你可也用Lift作为<a href="http://frothy.liftweb.net/capp">Cappuccino</a>、SproutCore、ExtJS等应用的服务端,并获得全面的Comet支持。 | |||
</big> | |||
</big> | |||
</div> | |||
|
|||
|
|||
</div> | |||
</body> | |||
</html> |
Oops, something went wrong.