Author: alartin
Date: 2008-12-23 04:56:10 -0500 (Tue, 23 Dec 2008)
New Revision: 689
Modified:
doc/trunk/reference/zh-CN/modules/example.po
Log:
Modified: doc/trunk/reference/zh-CN/modules/example.po
===================================================================
--- doc/trunk/reference/zh-CN/modules/example.po 2008-12-23 09:48:45 UTC (rev 688)
+++ doc/trunk/reference/zh-CN/modules/example.po 2008-12-23 09:56:10 UTC (rev 689)
@@ -3,11 +3,11 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: master.xml \n"
+"Project-Id-Version: master.xml\n"
"Report-Msgid-Bugs-To:
http://bugs.kde.org\n"
"POT-Creation-Date: 2008-12-19 20:26+0000\n"
-"PO-Revision-Date: 2008-12-19 20:26+0000\n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2008-12-23 17:55+0800\n"
+"Last-Translator: Sean Wu <alartin(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -17,16 +17,13 @@
#: example.xml:4
#, no-c-format
msgid "JSF web application example"
-msgstr ""
+msgstr "JSF Web应用例子"
#. Tag: para
#: example.xml:6
#, no-c-format
-msgid ""
-"Let's illustrate these ideas with a full example. We're going to implement
"
-"user login/logout for an application that uses JSF. First, we'll define a
"
-"Web Bean to hold the username and password entered during login:"
-msgstr ""
+msgid "Let's illustrate these ideas with a full example. We're going to
implement user login/logout for an application that uses JSF. First, we'll define a
Web Bean to hold the username and password entered during login:"
+msgstr "让我们通过一个完整的例子来演示这些想法。我们将是使用JSF来实现一个应用的用户登录/退出功能。首先,我们定一个Web
Bean来持有登录过程中用户输入的用户名和密码:"
#. Tag: programlisting
#: example.xml:11
@@ -46,12 +43,25 @@
" \n"
"}]]>"
msgstr ""
+"<![CDATA[@Named\n"
+"public class Credentials {\n"
+" \n"
+" private String username;\n"
+" private String password;\n"
+" \n"
+" public String getUsername() { return username; }\n"
+" public void setUsername(String username) { this.username = username; }\n"
+" \n"
+" public String getPassword() { return password; }\n"
+" public void setPassword(String password) { this.password = password; }\n"
+" \n"
+"}]]>"
#. Tag: para
#: example.xml:13
#, no-c-format
msgid "This Web Bean is bound to the login prompt in the following JSF form:"
-msgstr ""
+msgstr "这个Web Bean和下面的JSF表单的login绑定:"
#. Tag: programlisting
#: example.xml:15
@@ -64,21 +74,26 @@
" <h:outputLabel
for=\"password\">Password:</h:outputLabel>\n"
" <h:inputText id=\"password\"
value=\"#{credentials.password}\"/>\n"
" </h:panelGrid>\n"
-" <h:commandButton value=\"Login\"
action=\"#{login.login}\" rendered=\"#{!"
-"login.loggedIn}\"/>\n"
-" <h:commandButton value=\"Logout\"
acion=\"#{login.logout}\" rendered=\"#"
-"{login.loggedIn}\"/>\n"
+" <h:commandButton value=\"Login\"
action=\"#{login.login}\"
rendered=\"#{!login.loggedIn}\"/>\n"
+" <h:commandButton value=\"Logout\"
acion=\"#{login.logout}\" rendered=\"#{login.loggedIn}\"/>\n"
"</f:form]]>"
msgstr ""
+"<![CDATA[<f:form>\n"
+" <h:panelGrid columns=\"2\"
rendered=\"#{!login.loggedIn}\">\n"
+" <h:outputLabel
for=\"username\">Username:</h:outputLabel>\n"
+" <h:inputText id=\"username\"
value=\"#{credentials.username}\"/>\n"
+" <h:outputLabel
for=\"password\">Password:</h:outputLabel>\n"
+" <h:inputText id=\"password\"
value=\"#{credentials.password}\"/>\n"
+" </h:panelGrid>\n"
+" <h:commandButton value=\"Login\"
action=\"#{login.login}\"
rendered=\"#{!login.loggedIn}\"/>\n"
+" <h:commandButton value=\"Logout\"
acion=\"#{login.logout}\" rendered=\"#{login.loggedIn}\"/>\n"
+"</f:form]]>"
#. Tag: para
#: example.xml:17
#, no-c-format
-msgid ""
-"The actual work is done by a session scoped Web Bean that maintains "
-"information about the currently logged-in user and exposes the "
-"<literal>User</literal> entity to other Web Beans:"
-msgstr ""
+msgid "The actual work is done by a session scoped Web Bean that maintains
information about the currently logged-in user and exposes the
<literal>User</literal> entity to other Web Beans:"
+msgstr "实际的工作由一个会话范围的Web Bean完成。这个会话范围的Web
Bean维护当前登录用户的信息,并且将<literal>User</literal>实体暴露给其他Web Bean:"
#. Tag: programlisting
#: example.xml:21
@@ -95,8 +110,7 @@
" public void login() {\n"
" \n"
" List<User> results = userDatabase.createQuery(\n"
-" \"select u from User u where u.username=:username and
u.password=:"
-"password\")\n"
+" \"select u from User u where u.username=:username and
u.password=:password\")\n"
" .setParameter(\"username\",
credentials.getUsername())\n"
" .setParameter(\"password\",
credentials.getPassword())\n"
" .getResultList();\n"
@@ -121,12 +135,47 @@
"\n"
"}]]>"
msgstr ""
+"<![CDATA[@SessionScoped @Named\n"
+"public class Login {\n"
+"\n"
+" @Current Credentials credentials;\n"
+" @PersistenceContext EntityManager userDatabase;\n"
+"\n"
+" private User user;\n"
+" \n"
+" public void login() {\n"
+" \n"
+" List<User> results = userDatabase.createQuery(\n"
+" \"select u from User u where u.username=:username and
u.password=:password\")\n"
+" .setParameter(\"username\",
credentials.getUsername())\n"
+" .setParameter(\"password\",
credentials.getPassword())\n"
+" .getResultList();\n"
+" \n"
+" if ( !results.isEmpty() ) {\n"
+" user = results.get(0);\n"
+" }\n"
+" \n"
+" }\n"
+" \n"
+" public void logout() {\n"
+" user = null;\n"
+" }\n"
+" \n"
+" public boolean isLoggedIn() {\n"
+" return user!=null;\n"
+" }\n"
+" \n"
+" @Produces @LoggedIn User getCurrentUser() {\n"
+" return user;\n"
+" }\n"
+"\n"
+"}]]>"
#. Tag: para
#: example.xml:23
#, no-c-format
msgid "Of course, <literal>@LoggedIn</literal> is a binding
annotation:"
-msgstr ""
+msgstr "当然, <literal>@LoggedIn</literal>是一个绑定注释:"
#. Tag: programlisting
#: example.xml:25
@@ -137,12 +186,16 @@
"@BindingType\n"
"public @interface LoggedIn {}]]>"
msgstr ""
+"<![CDATA[@Retention(RUNTIME)\n"
+"@Target({TYPE, METHOD, FIELD})\n"
+"@BindingType\n"
+"public @interface LoggedIn {}]]>"
#. Tag: para
#: example.xml:27
#, no-c-format
msgid "Now, any other Web Bean can easily inject the current user:"
-msgstr ""
+msgstr "现在,任何其他的Web Bean可以轻松地将当前用户注入:"
#. Tag: programlisting
#: example.xml:29
@@ -161,12 +214,22 @@
" \n"
"}]]>"
msgstr ""
+"<![CDATA[public class DocumentEditor {\n"
+"\n"
+" @Current Document document;\n"
+" @LoggedIn User currentUser;\n"
+" @PersistenceContext EntityManager docDatabase;\n"
+" \n"
+" public void save() {\n"
+" document.setCreatedBy(currentUser);\n"
+" docDatabase.persist(document);\n"
+" }\n"
+" \n"
+"}]]>"
#. Tag: para
#: example.xml:31
#, no-c-format
-msgid ""
-"Hopefully, this example gives a flavor of the Web Bean programming model. In
"
-"the next chapter, we'll explore Web Beans dependency injection in greater
"
-"depth."
-msgstr ""
+msgid "Hopefully, this example gives a flavor of the Web Bean programming model. In
the next chapter, we'll explore Web Beans dependency injection in greater
depth."
+msgstr "希望这个例子能够让你尝试了Web Bean的编程模型。在下一章中,我们将更加深入的研究Web Bean的依赖注入。"
+