Author: stliu
Date: 2010-08-23 12:52:23 -0400 (Mon, 23 Aug 2010)
New Revision: 20228
Modified:
validator/trunk/hibernate-validator/pom.xml
validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/annotationprocessor.po
validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/bootstrapping.po
validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/programmaticapi.po
Log:
HV-351 finsihed the translateion
Modified: validator/trunk/hibernate-validator/pom.xml
===================================================================
--- validator/trunk/hibernate-validator/pom.xml 2010-08-23 14:49:35 UTC (rev 20227)
+++ validator/trunk/hibernate-validator/pom.xml 2010-08-23 16:52:23 UTC (rev 20228)
@@ -270,23 +270,23 @@
<directory>${basedir}/src/main/docbook/en-US/images</directory>
</imageResource>
<formats>
+ <!-- <format>
+ <formatName>pdf</formatName>
+
<stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/pdf.xsl</stylesheetResource>
+
<finalName>hibernate_validator_reference.pdf</finalName>
+ </format> -->
<format>
- <formatName>pdf</formatName>
-
<stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/pdf.xsl</stylesheetResource>
-
<finalName>hibernate_validator_reference.pdf</finalName>
- </format>
- <format>
<formatName>html_single</formatName>
<stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-single.xsl
</stylesheetResource>
<finalName>index.html</finalName>
</format>
- <format>
- <formatName>html</formatName>
-
<stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml.xsl
- </stylesheetResource>
- <finalName>index.html</finalName>
- </format>
+ <!-- <format>
+ <formatName>html</formatName>
+
<stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml.xsl
+ </stylesheetResource>
+ <finalName>index.html</finalName>
+ </format> -->
</formats>
<options>
<xincludeSupported>true</xincludeSupported>
Modified:
validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/annotationprocessor.po
===================================================================
---
validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/annotationprocessor.po 2010-08-23
14:49:35 UTC (rev 20227)
+++
validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/annotationprocessor.po 2010-08-23
16:52:23 UTC (rev 20228)
@@ -6,7 +6,7 @@
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To:
http://bugs.kde.org\n"
"POT-Creation-Date: 2010-07-06 14:46+0000\n"
-"PO-Revision-Date: 2010-08-19 10:06+0830\n"
+"PO-Revision-Date: 2010-08-24 00:50+0830\n"
"Last-Translator: Strong Liu <stliu(a)hibernate.org>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@ -17,181 +17,181 @@
#: annotationprocessor.xml:25
#, no-c-format
msgid "Annotation Processor (EXPERIMENTAL)"
-msgstr ""
+msgstr "标注处理器(实验)"
#. Tag: para
#: annotationprocessor.xml:27
#, no-c-format
msgid "Have you ever caught yourself by unintentionally doing things like"
-msgstr ""
+msgstr "你碰到过下面这些让人抓狂的情况么:"
#. Tag: para
#: annotationprocessor.xml:32
#, no-c-format
msgid "annotating Strings with @Min to specify a minimum length (instead of using
@Size)"
-msgstr ""
+msgstr "把@Min赋给一个String来指定其的最小长度(而不是使用@Size)"
#. Tag: para
#: annotationprocessor.xml:37
#, no-c-format
msgid "annotating the setter of a JavaBean property (instead of the getter
method)"
-msgstr ""
+msgstr "对一个JavaBean的setter方法进行标注(而不是getter)"
#. Tag: para
#: annotationprocessor.xml:42
#, no-c-format
msgid "annotating static fields/methods with constraint annotations (which is not
supported)?"
-msgstr ""
+msgstr "对一个静态的变量或者方法进行约束条件标注(这样是不支持滴)"
#. Tag: para
#: annotationprocessor.xml:47
#, no-c-format
msgid "Then the Hibernate Validator Annotation Processor is the right thing for you.
It helps preventing such mistakes by plugging into the build process and raising
compilation errors whenever constraint annotations are incorrectly used."
-msgstr ""
+msgstr "这样的话, 你就应该看看Hibernate Validator 的约束处理器了. 它会被插入到编译过程中, 然后如果发现如果哪个约束标注用错了的话,
则汇报编译错误."
#. Tag: para
#: annotationprocessor.xml:53
#, no-c-format
msgid "A first version of the Hibernate Validator Annotation Processor is part of
Hibernate Validator since release 4.1. It is currently still under development and should
therefore be considered as an experimental feature. Some <link
linkend=\"section-known-issues\">known issues</link> can be found at
the end of this chapter. In case any problems arise when using the processor feel free to
ask for help at the <ulink
url=\"https://forum.hibernate.org/viewforum.php?f=9\">forum&... or
create an issue within<ulink
url=\"http://opensource.atlassian.com/projects/hibernate/browse/HV/c...
JIRA</ulink>."
-msgstr ""
+msgstr "Hibernate Validator 4.1 包含了标注处理器的第一个版本. 它当前正处于开发阶段, 所以应该被看作是实验性质的功能.
在本章的结尾列出了一些<link linkend=\"section-known-issues\">已知的缺陷</link>.
如果在使用这个功能的时候碰到任何问题, 请在我们的<ulink
url=\"https://forum.hibernate.org/viewforum.php?f=9\">论坛<...
url=\"http://opensource.atlassian.com/projects/hibernate/browse/HV/c...
JIRA</ulink>中创建一个缺陷报告."
#. Tag: title
#: annotationprocessor.xml:66
#, no-c-format
msgid "Prerequisites"
-msgstr ""
+msgstr "前提条件"
#. Tag: para
#: annotationprocessor.xml:68
#, no-c-format
msgid "The Hibernate Validator Annotation Processor is based on the \"Pluggable
Annotation Processing API\" as defined by <ulink
url=\"http://jcp.org/en/jsr/detail?id=269\">JSR 269</ulink>. This API
is part of the Java Platform since Java 6. So be sure to use this or a later
version."
-msgstr ""
+msgstr "Hibernate Validator的标注处理器是基于<ulink
url=\"http://jcp.org/en/jsr/detail?id=269\">JSR
269</ulink>所定义的\"可插入式标注处理API\"的. 这个API从Java 6开始已经是Java 平台的一部分了,
所以请确保使用这个或者以后的版本."
#. Tag: title
#: annotationprocessor.xml:76
#, no-c-format
msgid "Features"
-msgstr ""
+msgstr "特性"
#. Tag: para
#: annotationprocessor.xml:78
#, no-c-format
msgid "As of Hibernate Validator 4.1 the Hibernate Validator Annotation Processor
checks that:"
-msgstr ""
+msgstr "Hibernate Validator 4.1中的标注处理器可以检查:"
#. Tag: para
#: annotationprocessor.xml:83
#, no-c-format
msgid "constraint annotations are allowed for the type of the annotated
element"
-msgstr ""
+msgstr "应用了约束标注的属性的类型是否被该约束所支持"
#. Tag: para
#: annotationprocessor.xml:88
#, no-c-format
msgid "JavaBean getter methods are annotated in case of property validation"
-msgstr ""
+msgstr "如果是使用属性模式的话, 那么需要定义在JavaBean的getter上"
#. Tag: para
#: annotationprocessor.xml:93
#, no-c-format
msgid "only non-static fields or properties are annotated with constraint
annotations"
-msgstr ""
+msgstr "只有非静态字段或者方法才能够应用约束条件标注."
#. Tag: para
#: annotationprocessor.xml:98
#, no-c-format
msgid "only non-primitive fields or properties are annotated with @Valid"
-msgstr ""
+msgstr "只有非原始类型的属性或字段才能够应用@Valid标注"
#. Tag: para
#: annotationprocessor.xml:103
#, no-c-format
msgid "only such annotation types are annotated with constraint annotations which
are constraint annotations themselves"
-msgstr ""
+msgstr "only such annotation types are annotated with constraint annotations which
are constraint annotations themselves"
#. Tag: title
#: annotationprocessor.xml:110
#, no-c-format
msgid "Options"
-msgstr ""
+msgstr "配置项"
#. Tag: para
#: annotationprocessor.xml:112
#, no-c-format
msgid "The behavior of the Hibernate Validator Annotation Processor can be
controlled using the <ulink
url=\"http://java.sun.com/javase/6/docs/technotes/tools/windows/java...
options</ulink> listed in table<xref
linkend=\"table_processor_options\"/>:"
-msgstr ""
+msgstr "Hibernate Validator标注处理器的行为可以通过<xref
linkend=\"table_processor_options\"/>中列出的<ulink
url=\"http://java.sun.com/javase/6/docs/technotes/tools/windows/java...
#. Tag: title
#: annotationprocessor.xml:119
#, no-c-format
msgid "Hibernate Validator Annotation Processor options"
-msgstr ""
+msgstr "Hibernate Validator 标注处理器配置项"
#. Tag: entry
#: annotationprocessor.xml:124
#, no-c-format
msgid "Option"
-msgstr ""
+msgstr "配置项"
#. Tag: entry
#: annotationprocessor.xml:126
#, no-c-format
msgid "Explanation"
-msgstr ""
+msgstr "功能"
#. Tag: varname
#: annotationprocessor.xml:132
#, no-c-format
msgid "diagnosticKind"
-msgstr ""
+msgstr "diagnosticKind"
#. Tag: entry
#: annotationprocessor.xml:134
#, no-c-format
msgid "Controls how constraint problems are reported. Must be the string
representation of one of the values from the enum
<classname>javax.tools.Diagnostic.Kind</classname>, e.g.
<classname>WARNING</classname>. A value of
<classname>ERROR</classname> will cause compilation to halt whenever the AP
detects a constraint problem. Defaults to <classname>ERROR</classname>."
-msgstr ""
+msgstr "控制编译错误级别.
必须是枚举类型<classname>javax.tools.Diagnostic.Kind</classname>中的值(字符串形式),
例如<classname>WARNING</classname>.
如果是<classname>ERROR</classname>的话, 那么如果API检测到约束信息应用的错误的话, 会让编译过程终止,
默认是<classname>ERROR</classname>."
#. Tag: varname
#: annotationprocessor.xml:144
#, no-c-format
msgid "verbose"
-msgstr ""
+msgstr "verbose"
#. Tag: entry
#: annotationprocessor.xml:146
#, no-c-format
msgid "Controls whether detailed processing information shall be displayed or not,
useful for debugging purposes. Must be either <varname>true</varname>
or<varname>false</varname>. Defaults to
<varname>false</varname>."
-msgstr ""
+msgstr "控制是否显示详细的处理信息, 对debug有帮助.
它的值只能是<varname>true</varname>或<varname>false</varname>,
默认是<varname>false</varname>."
#. Tag: title
#: annotationprocessor.xml:157
#, no-c-format
msgid "Using the Annotation Processor"
-msgstr ""
+msgstr "使用标注处理器"
#. Tag: para
#: annotationprocessor.xml:159
#, no-c-format
msgid "This section shows in detail how to integrate the Hibernate Validator
Annotation Processor into command line builds (javac, Ant, Maven) as well as IDE-based
builds (Eclipse, IntelliJ IDEA, NetBeans)."
-msgstr ""
+msgstr "本小节详细介绍了如何把Hibernate Validator标注处理器与命令行编译(javac, Ant, Maven)以及IDE (Eclipse,
IntelliJ IDEA, NetBeans)集成."
#. Tag: title
#: annotationprocessor.xml:165
#, no-c-format
msgid "Command line builds"
-msgstr ""
+msgstr "命令行编译"
#. Tag: title
#: annotationprocessor.xml:168
#, no-c-format
msgid "javac"
-msgstr ""
+msgstr "javac"
#. Tag: para
#: annotationprocessor.xml:170
#, no-c-format
msgid "When compiling on the command line using <ulink
url=\"http://java.sun.com/javase/6/docs/technotes/guides/javac/index...;,
specify the following JARs using the \"processorpath\" option:"
-msgstr ""
+msgstr "当使用命令行(<ulink
url=\"http://java.sun.com/javase/6/docs/technotes/guides/javac/index...,
通过\"processorpath\"属性指定下列jar:"
#. Tag: para
#: annotationprocessor.xml:176
@@ -199,7 +199,7 @@
#: annotationprocessor.xml:377
#, no-c-format
msgid "validation-api-&bvVersion;.jar"
-msgstr ""
+msgstr "validation-api-&bvVersion;.jar"
#. Tag: para
#: annotationprocessor.xml:180
@@ -207,19 +207,19 @@
#: annotationprocessor.xml:381
#, no-c-format
msgid "hibernate-validator-annotation-processor-&version;.jar"
-msgstr ""
+msgstr "hibernate-validator-annotation-processor-&version;.jar"
#. Tag: para
#: annotationprocessor.xml:184
#, no-c-format
msgid "The following listing shows an example. The processor will be detected
automatically by the compiler and invoked during compilation."
-msgstr ""
+msgstr "下面显示了一个具体的示例. 这样, 标注处理器就会自动被编译器检测到并且调用."
#. Tag: title
#: annotationprocessor.xml:189
#, no-c-format
msgid "Using the annotation processor with javac"
-msgstr ""
+msgstr "在javac中使用标注处理器"
#. Tag: programlisting
#: annotationprocessor.xml:191
@@ -229,24 +229,27 @@
" -cp /path/to/validation-api-&bvVersion;.jar \\ \n"
" -processorpath
/path/to/validation-api-&bvVersion;.jar:/path/to/hibernate-validator-annotation-processor-&version;.jar"
msgstr ""
+"javac src/main/java/org/hibernate/validator/ap/demo/Car.java \\\n"
+" -cp /path/to/validation-api-&bvVersion;.jar \\ \n"
+" -processorpath
/path/to/validation-api-&bvVersion;.jar:/path/to/hibernate-validator-annotation-processor-&version;.jar"
#. Tag: title
#: annotationprocessor.xml:196
#, no-c-format
msgid "Apache Ant"
-msgstr ""
+msgstr "Apache Ant"
#. Tag: para
#: annotationprocessor.xml:198
#, no-c-format
msgid "Similar to directly working with javac, the annotation processor can be added
as as compiler argument when invoking the <ulink
url=\"http://ant.apache.org/manual/CoreTasks/javac.html\">javac
task</ulink> for <ulink
url=\"http://ant.apache.org/\">Apache
Ant</ulink>:"
-msgstr ""
+msgstr "和直接使用javac差不多, 可以在<ulink
url=\"http://ant.apache.org/\">Apache Ant</ulink>的<ulink
url=\"http://ant.apache.org/manual/CoreTasks/javac.html\">javac
task</ulink>中添加上面例子中的参数:"
#. Tag: title
#: annotationprocessor.xml:205
#, no-c-format
msgid "Using the annotation processor with Ant"
-msgstr ""
+msgstr "在Ant中使用标注处理器"
#. Tag: programlisting
#: annotationprocessor.xml:207
@@ -259,24 +262,30 @@
" <compilerarg
value=\"/path/to/validation-api-&bvVersion;.jar:/path/to/hibernate-validator-annotation-processor-&version;.jar\"/>\n"
"</javac>"
msgstr ""
+"<javac srcdir=\"src/main\"\n"
+" destdir=\"build/classes\"\n"
+"
classpath=\"/path/to/validation-api-&bvVersion;.jar\">\n"
+" <compilerarg value=\"-processorpath\" />\n"
+" <compilerarg
value=\"/path/to/validation-api-&bvVersion;.jar:/path/to/hibernate-validator-annotation-processor-&version;.jar\"/>\n"
+"</javac>"
#. Tag: title
#: annotationprocessor.xml:212
#, no-c-format
msgid "Maven"
-msgstr ""
+msgstr "Maven"
#. Tag: para
#: annotationprocessor.xml:214
#, no-c-format
msgid "There are several options for integrating the annotation processor with
<ulink
url=\"http://maven.apache.org/\">Apache Maven</ulink>.
Generally it is sufficient to add the Hibernate Validator Annotation Processor as
dependency to your project:"
-msgstr ""
+msgstr "对于和<ulink
url=\"http://maven.apache.org/\">Apache
Maven</ulink>集成来说我们有很多选择, 通常, 我们可以把Hibenrate Validator标注处理器作为依赖添加到你的项目当中:"
#. Tag: title
#: annotationprocessor.xml:220
#, no-c-format
msgid "Adding the HV Annotation Processor as dependency"
-msgstr ""
+msgstr "添加HV 标注处理器为依赖"
#. Tag: programlisting
#: annotationprocessor.xml:222
@@ -291,24 +300,32 @@
"</dependency>\n"
"..."
msgstr ""
+"...\n"
+"<dependency>\n"
+" <groupId>org.hibernate</groupId>\n"
+"
<artifactId>hibernate-validator-annotation-processor</artifactId>\n"
+" <version>&version;</version>\n"
+" <scope>compile</scope>\n"
+"</dependency>\n"
+"..."
#. Tag: para
#: annotationprocessor.xml:225
#, no-c-format
msgid "The processor will then be executed automatically by the compiler. This
basically works, but comes with the disadavantage that in some cases messages from the
annotation processor are not displayed (see <ulink
url=\"http://jira.codehaus.org/browse/MCOMPILER-66\">MCOMPIL...
-msgstr ""
+msgstr "这样, 这个处理器就能够自动的被编译器所调用. 虽然基本上能工作,但是还是有一些缺点, 在某些情况下, 标注处理器的输出信息可能不能够被显示出来.
(请参考<ulink
url=\"http://jira.codehaus.org/browse/MCOMPILER-66\">MCOMPIL...
#. Tag: para
#: annotationprocessor.xml:231
#, no-c-format
msgid "Another option is using the <ulink
url=\"http://code.google.com/p/maven-annotation-plugin/\">Maven Annotation
Plugin</ulink>. At the time of this writing the plugin is not yet available in any
of the well-known repositories. Therefore you have to add the project's own repository
to your settings.xml or pom.xml:"
-msgstr ""
+msgstr "另外的一个选择是使用<ulink
url=\"http://code.google.com/p/maven-annotation-plugin/\">Maven Annotation
Plugin</ulink>. 不过在此文档撰写的时候, 这个插件还没有被上传到任何一个广泛被使用的仓库中. 所以,
你需要自己把这个插件自己的仓库添加到你的settings.xml 或 pom.xml中:"
#. Tag: title
#: annotationprocessor.xml:239
#, no-c-format
msgid "Adding the Maven Annotation Plugin repository"
-msgstr ""
+msgstr "添加Maven Annotation Plugin的仓库"
#. Tag: programlisting
#: annotationprocessor.xml:241
@@ -323,18 +340,26 @@
"</pluginRepositories>\n"
"..."
msgstr ""
+"...\n"
+"<pluginRepositories>\n"
+" <pluginRepository>\n"
+" <id>maven-annotation-plugin-repo</id>\n"
+"
<url>http://maven-annotation-plugin.googlecode.com/svn/trunk/mavenrepo</url>\n"
+" </pluginRepository>\n"
+"</pluginRepositories>\n"
+"..."
#. Tag: para
#: annotationprocessor.xml:242
#, no-c-format
msgid "Now disable the standard annotation processing performed by the compiler
plugin and configure the annotation plugin by specifying an execution and adding the
Hibernate Validator Annotation Processor as plugin dependency (that way the AP is not
visible on the project's actual classpath):"
-msgstr ""
+msgstr "现在, 禁用compiler插件所调用的标准的标注处理过程, 然后再通过定义一个execution来配置annotation plugin的运行,
还需要把Hibernate Validator标注处理器作为该插件的依赖添加进去(这样, 此标注处理器就不会被当成你的项目的依赖而出现在类路径中了):"
#. Tag: title
#: annotationprocessor.xml:249
#, no-c-format
msgid "Configuring the Maven Annotation Plugin"
-msgstr ""
+msgstr "配置Maven Annotation Plugin"
#. Tag: programlisting
#: annotationprocessor.xml:251
@@ -373,139 +398,171 @@
"</plugin>\n"
"..."
msgstr ""
+"...\n"
+"<plugin>\n"
+"
<artifactId>maven-compiler-plugin</artifactId>\n"
+" <configuration>\n"
+" <source>1.6</source>\n"
+" <target>1.6</target>\n"
+"
<compilerArgument>-proc:none</compilerArgument>\n"
+" </configuration>\n"
+"</plugin>\n"
+"<plugin>\n"
+" <groupId>org.bsc.maven</groupId>\n"
+"
<artifactId>maven-processor-plugin</artifactId>\n"
+" <version>1.3.4</version>\n"
+" <executions>\n"
+" <execution>\n"
+" <id>process</id>\n"
+" <goals>\n"
+" <goal>process</goal>\n"
+" </goals>\n"
+" <phase>process-sources</phase>\n"
+" </execution>\n"
+" </executions>\n"
+" <dependencies>\n"
+" <dependency>\n"
+" <groupId>org.hibernate</groupId>\n"
+"
<artifactId>hibernate-validator-annotation-processor</artifactId>\n"
+" <version>&version;</version>\n"
+" <scope>compile</scope>\n"
+" </dependency>\n"
+" </dependencies>\n"
+"</plugin>\n"
+"..."
#. Tag: title
#: annotationprocessor.xml:257
#, no-c-format
msgid "IDE builds"
-msgstr ""
+msgstr "IDE集成"
#. Tag: title
#: annotationprocessor.xml:260
#, no-c-format
msgid "Eclipse"
-msgstr ""
+msgstr "Eclipse"
#. Tag: para
#: annotationprocessor.xml:262
#, no-c-format
msgid "Do the following to use the annotation processor within the <ulink
url=\"http://www.eclipse.org/\">Eclipse</ulink> IDE:"
-msgstr ""
+msgstr "请参考以下步骤来在<ulink
url=\"http://www.eclipse.org/\">Eclipse</ulink>中使用标注处理...
#. Tag: para
#: annotationprocessor.xml:267
#: annotationprocessor.xml:368
#, no-c-format
msgid "Right-click your project, choose \"Properties\""
-msgstr ""
+msgstr "右键点击你的项目, 然后选择\"属性\""
#. Tag: para
#: annotationprocessor.xml:271
#, no-c-format
msgid "Go to \"Java Compiler\" and make sure, that \"Compiler
compliance level\" is set to \"1.6\". Otherwise the processor won't be
activated"
-msgstr ""
+msgstr "在\"Java Compiler\"页面确认\"编译级别\"设置的是\"1.6\".
否则的话是无法使用标注处理器的."
#. Tag: para
#: annotationprocessor.xml:277
#, no-c-format
msgid "Go to \"Java Compiler - Annotation Processing\" and choose
\"Enable annotation processing\""
-msgstr ""
+msgstr "到\"Java Compiler\"下面的\"Annotation Processing\" 页面,
然后选择\"启用标注处理\"(译注: 我的电脑是英文版的, 所以真的不知道中文版的eclipse上, 这些翻译成了什么:("
#. Tag: para
#: annotationprocessor.xml:282
#, no-c-format
msgid "Go to \"Java Compiler - Annotation Processing - Factory Path\" and
add the following JARs:"
-msgstr ""
+msgstr "到\"Java Compiler - Annotation Processing - Factory Path\"页面,
然后添加下面的jar文件:"
#. Tag: para
#: annotationprocessor.xml:297
#, no-c-format
msgid "Confirm the workspace rebuild"
-msgstr ""
+msgstr "确认工作空间重新编译"
#. Tag: para
#: annotationprocessor.xml:301
#, no-c-format
msgid "You now should see any annotation problems as regular error markers within
the editor and in the \"Problem\" view:"
-msgstr ""
+msgstr "现在你应该能够看到所有的标注错误都在编辑窗口中显示出了错误标记,也都显示在了\"问题\"视图:"
#. Tag: title
#: annotationprocessor.xml:313
#, no-c-format
msgid "IntelliJ IDEA"
-msgstr ""
+msgstr "IntelliJ IDEA"
#. Tag: para
#: annotationprocessor.xml:315
#, no-c-format
msgid "The following steps must be followed to use the annotation processor within
<ulink
url=\"http://www.jetbrains.com/idea/\">IntelliJ IDEA</ulink>
(version 9 and above):"
-msgstr ""
+msgstr "请参考以下步骤来在<ulink
url=\"http://www.jetbrains.com/idea/\">IntelliJ IDEA</ulink>
(9.0及以上):中使用标注处理器:"
#. Tag: para
#: annotationprocessor.xml:321
#, no-c-format
msgid "Go to \"File\", then \"Settings\","
-msgstr ""
+msgstr "选择 \"File\", 然后 \"Settings\","
#. Tag: para
#: annotationprocessor.xml:325
#, no-c-format
msgid "Expand the node \"Compiler\", then \"Annotation
Processors\""
-msgstr ""
+msgstr "展开\"Compiler\"节点, 然后点击\"Annotation Processors\""
#. Tag: para
#: annotationprocessor.xml:330
#, no-c-format
msgid "Choose \"Enable annotation processing\" and enter the following as
\"Processor path\":
/path/to/validation-api-&bvVersion;.jar:/path/to/hibernate-validator-annotation-processor-&version;.jar"
-msgstr ""
+msgstr "选中 \"Enable annotation processing\" 并且输入下面的内容作为\"Processor
path\":
/path/to/validation-api-&bvVersion;.jar:/path/to/hibernate-validator-annotation-processor-&version;.jar"
#. Tag: para
#: annotationprocessor.xml:336
#, no-c-format
msgid "Add the processor's fully qualified name
<classname>org.hibernate.validator.ap.ConstraintValidationProcessor</classname>
to the \"Annotation Processors\" list"
-msgstr ""
+msgstr
"添加处理器的全路径名称<classname>org.hibernate.validator.ap.ConstraintValidationProcessor</classname>到\"Annotation
Processors\"列表"
#. Tag: para
#: annotationprocessor.xml:342
#, no-c-format
msgid "If applicable add you module to the \"Processed Modules\"
list"
-msgstr ""
+msgstr "如果需要的话, 添加你的模块到\"Processed Modules\"列表"
#. Tag: para
#: annotationprocessor.xml:347
#, no-c-format
msgid "Rebuilding your project then should show any erronous constraint
annotations:"
-msgstr ""
+msgstr "重新编译你的项目, 然后应该能看到关于约束标注的错误信息了:"
#. Tag: title
#: annotationprocessor.xml:359
#, no-c-format
msgid "NetBeans"
-msgstr ""
+msgstr "NetBeans"
#. Tag: para
#: annotationprocessor.xml:361
#, no-c-format
msgid "Starting with version 6.9, also the <ulink
url=\"http://www.netbeans.org/\">NetBeans</ulink> IDE supports using
annotation processors within the IDE build. To do so, do the following:"
-msgstr ""
+msgstr "从6.9这个版本开始, <ulink
url=\"http://www.netbeans.org/\">NetBeans</ulink>也支持标注处理了.
可以通过下面的步骤来启用它:"
#. Tag: para
#: annotationprocessor.xml:372
#, no-c-format
msgid "Go to \"Libraries\", tab \"Processor\", and add the
following two JARs:"
-msgstr ""
+msgstr "选择\"Libraries\"的\"Processor\"选项卡, 然后添加下面两个jar文件:"
#. Tag: para
#: annotationprocessor.xml:387
#, no-c-format
msgid "Go to \"Build - Compiling\", select \"Enable Annotation
Processing\" and \"Enable Annotation Processing in Editor\". Add the
annotation processor by specifying its fully qualified name
<classname>org.hibernate.validator.ap.ConstraintValidationProcessor</classname>"
-msgstr ""
+msgstr "到\"Build - Compiling\"页面选中\"Enable Annotation
Processing\" 和 \"Enable Annotation Processing in Editor\",
并且指定标注处理器的全路径名称<classname>org.hibernate.validator.ap.ConstraintValidationProcessor</classname>."
#. Tag: para
#: annotationprocessor.xml:394
#, no-c-format
msgid "Any constraint annotation problems will then be marked directly within the
editor:"
-msgstr ""
+msgstr "所有的约束标注问题应该都会在编辑器里面直接被标记出来了:"
#. Tag: title
#: annotationprocessor.xml:408
@@ -523,11 +580,11 @@
#: annotationprocessor.xml:414
#, no-c-format
msgid "<ulink
url=\"http://opensource.atlassian.com/projects/hibernate/browse/HV-3...;:
Additional validators registered for a constraint <ulink
url=\"http://docs.jboss.org/hibernate/stable/validator/reference/en/...
XML</ulink> are not evaluated by the annotation processor."
-msgstr ""
+msgstr "<ulink
url=\"http://opensource.atlassian.com/projects/hibernate/browse/HV-3...;:
Additional validators registered for a constraint <ulink
url=\"http://docs.jboss.org/hibernate/stable/validator/reference/en/...
XML</ulink> are not evaluated by the annotation processor."
#. Tag: para
#: annotationprocessor.xml:422
#, no-c-format
msgid "Sometimes custom constraints can't be <ulink
url=\"http://opensource.atlassian.com/projects/hibernate/browse/HV-2...
evaluated</ulink> when using the processor within Eclipse. Cleaning the project can
help in these situations. This seems to be an issue with the Eclipse JSR 269 API
implementation, but further investigation is required here."
-msgstr ""
+msgstr "有时候, 在eclipse里面自定义的约束条件不能够被<ulink
url=\"http://opensource.atlassian.com/projects/hibernate/browse/HV-2...;.
清理这个项目可能会有帮助. 这可能是因为Eclipse中对 JSR 269 API的实现有问题, 但是还需要进一步的研究."
Modified:
validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/bootstrapping.po
===================================================================
---
validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/bootstrapping.po 2010-08-23
14:49:35 UTC (rev 20227)
+++
validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/bootstrapping.po 2010-08-23
16:52:23 UTC (rev 20228)
@@ -6,8 +6,8 @@
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To:
http://bugs.kde.org\n"
"POT-Creation-Date: 2010-07-06 14:46+0000\n"
-"PO-Revision-Date: 2010-07-06 14:46+0000\n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2010-08-23 21:26+0830\n"
+"Last-Translator: Strong Liu <stliu(a)hibernate.org>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -17,69 +17,43 @@
#: bootstrapping.xml:25
#, no-c-format
msgid "Bootstrapping"
-msgstr ""
+msgstr "Bootstrapping"
#. Tag: para
#: bootstrapping.xml:27
#, no-c-format
-msgid ""
-"We already seen in <xref linkend=\"section-validator-instance\"/>
the "
-"easiest way to create a <classname>Validator</classname> instance -
"
-"<methodname>Validation.buildDefaultValidatorFactory</methodname>. In
this "
-"chapter we have a look at the other methods in
<classname>javax.validation."
-"Validation</classname> and how they allow to configure several aspects of
"
-"Bean Validation at bootstrapping time."
-msgstr ""
+msgid "We already seen in <xref
linkend=\"section-validator-instance\"/> the easiest way to create a
<classname>Validator</classname> instance -
<methodname>Validation.buildDefaultValidatorFactory</methodname>. In this
chapter we have a look at the other methods in
<classname>javax.validation.Validation</classname> and how they allow to
configure several aspects of Bean Validation at bootstrapping time."
+msgstr "在<xref linkend=\"section-validator-instance\"/>中我们说道过,
最简单的创建一个<classname>Validator</classname>实例的方法是通过<methodname>Validation.buildDefaultValidatorFactory</methodname>.
在本章中我们会继续介绍<classname>javax.validation.Validation</classname>中的其他方法,
以及如何通过这些方法在Bean Validation初始化的时候对其进行配置的."
#. Tag: para
#: bootstrapping.xml:34
#, no-c-format
-msgid ""
-"The different bootstrapping options allow, amongst other things, to "
-"bootstrap any Bean Validation implementation on the classpath. Generally, an
"
-"available provider is discovered by the <ulink
url=\"http://java.sun.com/"
-"j2se/1.3/docs/guide/jar/jar.html#Service%20Provider\">Java Service
Provider</"
-"ulink> mechanism. A Bean Validation implementation includes the file "
-"<filename>javax.validation.spi.ValidationProvider</filename> in "
-"<filename>META-INF/services</filename>. This file contains the fully
"
-"qualified classname of the <classname>ValidationProvider</classname> of
the "
-"implementation. In the case of Hibernate Validator this is
<classname>org."
-"hibernate.validator.HibernateValidator</classname>."
-msgstr ""
+msgid "The different bootstrapping options allow, amongst other things, to bootstrap
any Bean Validation implementation on the classpath. Generally, an available provider is
discovered by the <ulink
url=\"http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%2...
Service Provider</ulink> mechanism. A Bean Validation implementation includes the
file <filename>javax.validation.spi.ValidationProvider</filename> in
<filename>META-INF/services</filename>. This file contains the fully qualified
classname of the <classname>ValidationProvider</classname> of the
implementation. In the case of Hibernate Validator this is
<classname>org.hibernate.validator.HibernateValidator</classname>."
+msgstr "The different bootstrapping options allow, amongst other things, to
bootstrap any Bean Validation implementation on the classpath. 通常, 一个服务的提供者是能够被<ulink
url=\"http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%2...
Service Provider</ulink>发现的. 对于Bean Validation的实现(服务提供者)来说,
他们的<filename>META-INF/services</filename>目录下需要包含一个名为<filename>javax.validation.spi.ValidationProvider</filename>的文件.
此文件中包含了一个<classname>ValidationProvider</classname>接口的实现类的全路径名称, 具体到Hibernate
Validator来说,
就是<classname>org.hibernate.validator.HibernateValidator</classname>."
#. Tag: para
#: bootstrapping.xml:47
#, no-c-format
-msgid ""
-"If there are more than one Bean Validation implementation providers in the "
-"classpath and
<methodname>Validation.buildDefaultValidatorFactory()</"
-"methodname> is used, there is no guarantee which provider will be chosen. To
"
-"enforce the provider <methodname>Validation.byProvider()</methodname>
should "
-"be used."
-msgstr ""
+msgid "If there are more than one Bean Validation implementation providers in the
classpath and
<methodname>Validation.buildDefaultValidatorFactory()</methodname> is used,
there is no guarantee which provider will be chosen. To enforce the provider
<methodname>Validation.byProvider()</methodname> should be used."
+msgstr "如果当前类路径下存在多个Bean Validation的实现,
那么<methodname>Validation.buildDefaultValidatorFactory()</methodname>并不能保证具体那个实现会被使用.
如果想指定某一个的话, 请使用<methodname>Validation.byProvider()</methodname>."
#. Tag: title
#: bootstrapping.xml:56
#, no-c-format
-msgid ""
-"<classname>Configuration</classname> and
<classname>ValidatorFactory</"
-"classname>"
-msgstr ""
+msgid "<classname>Configuration</classname> and
<classname>ValidatorFactory</classname>"
+msgstr "<classname>Configuration</classname> 和
<classname>ValidatorFactory</classname>"
#. Tag: para
#: bootstrapping.xml:59
#, no-c-format
-msgid ""
-"There are three different methods in the Validation class to create a "
-"Validator instance. The easiest in shown in <xref
linkend=\"example-build-"
-"default-validator-factory\"/>."
-msgstr ""
+msgid "There are three different methods in the Validation class to create a
Validator instance. The easiest in shown in <xref
linkend=\"example-build-default-validator-factory\"/>."
+msgstr "Validation类提供了三种方法来创建一个Validator的实例, <xref
linkend=\"example-build-default-validator-factory\"/>中显示的是最简单的方法."
#. Tag: title
#: bootstrapping.xml:64
#, no-c-format
msgid "Validation.buildDefaultValidatorFactory()"
-msgstr ""
+msgstr "Validation.buildDefaultValidatorFactory()"
#. Tag: programlisting
#: bootstrapping.xml:66
@@ -88,21 +62,20 @@
"ValidatorFactory factory = Validation.buildDefaultValidatorFactory();\n"
"Validator validator = factory.getValidator();"
msgstr ""
+"ValidatorFactory factory = Validation.buildDefaultValidatorFactory();\n"
+"Validator validator = factory.getValidator();"
#. Tag: para
#: bootstrapping.xml:69
#, no-c-format
-msgid ""
-"You can also use the method
<methodname>Validation.byDefaultProvider()</"
-"methodname> which will allow you to configure several aspects of the created
"
-"Validator instance:"
-msgstr ""
+msgid "You can also use the method
<methodname>Validation.byDefaultProvider()</methodname> which will allow you
to configure several aspects of the created Validator instance:"
+msgstr
"你也可以通过<methodname>Validation.byDefaultProvider()</methodname>现获取一个Configuration对象,
这样可以对要创建的Validator进行配置."
#. Tag: title
#: bootstrapping.xml:74
#, no-c-format
msgid "Validation.byDefaultProvider()"
-msgstr ""
+msgstr "Validation.byDefaultProvider()"
#. Tag: programlisting
#: bootstrapping.xml:76
@@ -116,39 +89,37 @@
"ValidatorFactory factory = config.buildValidatorFactory();\n"
"Validator validator = factory.getValidator();"
msgstr ""
+"Configuration<?> config =
Validation.byDefaultProvider().configure();\n"
+"config.messageInterpolator(new MyMessageInterpolator())\n"
+" .traversableResolver( new MyTraversableResolver())\n"
+" .constraintValidatorFactory(new MyConstraintValidatorFactory());\n"
+"\n"
+"ValidatorFactory factory = config.buildValidatorFactory();\n"
+"Validator validator = factory.getValidator();"
#. Tag: para
#: bootstrapping.xml:79
#, no-c-format
-msgid ""
-"We will learn more about <classname>MessageInterpolator</classname>,
"
-"<classname>TraversableResolver</classname> and "
-"<classname>ConstraintValidatorFactory</classname> in the following
sections."
-msgstr ""
+msgid "We will learn more about
<classname>MessageInterpolator</classname>,
<classname>TraversableResolver</classname> and
<classname>ConstraintValidatorFactory</classname> in the following
sections."
+msgstr "<classname>MessageInterpolator</classname>,
<classname>TraversableResolver</classname> 和
<classname>ConstraintValidatorFactory</classname>会在后面详细介绍."
#. Tag: para
#: bootstrapping.xml:84
#, no-c-format
-msgid ""
-"Last but not least you can ask for a Configuration object of a specific Bean
"
-"Validation provider. This is useful if you have more than one Bean "
-"Validation provider in your classpath. In this situation you can make an "
-"explicit choice about which implementation to use. In the case of Hibernate "
-"Validator the <classname>Validator</classname> creation looks
like:"
-msgstr ""
+msgid "Last but not least you can ask for a Configuration object of a specific Bean
Validation provider. This is useful if you have more than one Bean Validation provider in
your classpath. In this situation you can make an explicit choice about which
implementation to use. In the case of Hibernate Validator the
<classname>Validator</classname> creation looks like:"
+msgstr "最后, 你可以指定使用哪个Bean Validation的实现. 如果类路径下存在多个Bean Validation的实现的话,这样就很有必要了.
例如, 如果你想使用Hibernate
Validator来作为内部实现来创建<classname>Validator</classname>的话:"
#. Tag: title
#: bootstrapping.xml:92
#, no-c-format
msgid "Validation.byProvider( HibernateValidator.class )"
-msgstr ""
+msgstr "Validation.byProvider( HibernateValidator.class )"
#. Tag: programlisting
#: bootstrapping.xml:94
#, no-c-format
msgid ""
-"HibernateValidatorConfiguration config = Validation.byProvider"
-"( HibernateValidator.class ).configure();\n"
+"HibernateValidatorConfiguration config = Validation.byProvider(
HibernateValidator.class ).configure();\n"
"config.messageInterpolator(new MyMessageInterpolator())\n"
" .traversableResolver( new MyTraversableResolver())\n"
" .constraintValidatorFactory(new MyConstraintValidatorFactory());\n"
@@ -156,37 +127,37 @@
"ValidatorFactory factory = config.buildValidatorFactory();\n"
"Validator validator = factory.getValidator();"
msgstr ""
+"HibernateValidatorConfiguration config = Validation.byProvider(
HibernateValidator.class ).configure();\n"
+"config.messageInterpolator(new MyMessageInterpolator())\n"
+" .traversableResolver( new MyTraversableResolver())\n"
+" .constraintValidatorFactory(new MyConstraintValidatorFactory());\n"
+"\n"
+"ValidatorFactory factory = config.buildValidatorFactory();\n"
+"Validator validator = factory.getValidator();"
#. Tag: para
#: bootstrapping.xml:98
#, no-c-format
-msgid ""
-"The generated <classname>Validator</classname> instance is thread safe
and "
-"can be cached."
-msgstr ""
+msgid "The generated <classname>Validator</classname> instance is thread
safe and can be cached."
+msgstr "创建出来的<classname>Validator</classname>实例是线程安全的,
所以你可以把它缓存起来."
#. Tag: classname
#: bootstrapping.xml:104
#, no-c-format
msgid "ValidationProviderResolver"
-msgstr ""
+msgstr "ValidationProviderResolver"
#. Tag: para
#: bootstrapping.xml:106
#, no-c-format
-msgid ""
-"In the case that the Java Service Provider mechanism does not work in your "
-"environment or you have a special classloader setup, you are able to provide
"
-"a custom <classname>ValidationProviderResolver</classname>. An example
in an "
-"OSGi environment you could plug your custom provider resolver like seen in "
-"<xref linkend=\"example-provider-resolver\"/>."
-msgstr ""
+msgid "In the case that the Java Service Provider mechanism does not work in your
environment or you have a special classloader setup, you are able to provide a custom
<classname>ValidationProviderResolver</classname>. An example in an OSGi
environment you could plug your custom provider resolver like seen in <xref
linkend=\"example-provider-resolver\"/>."
+msgstr "如果 Java Service Provider机制在你的环境中不能够正常工作, 或者你有特别的classloader设置的话,
你也可以提供一个自定义的<classname>ValidationProviderResolver</classname>.<xref
linkend=\"example-provider-resolver\"/>显示了如何在OSGi环境中插入自定义的provider
resolver."
#. Tag: title
#: bootstrapping.xml:113
#, no-c-format
msgid "Providing a custom ValidationProviderResolver"
-msgstr ""
+msgstr "使用自定义的ValidationProviderResolver"
#. Tag: programlisting
#: bootstrapping.xml:115
@@ -199,20 +170,24 @@
"ValidatorFactory factory = config.buildValidatorFactory();\n"
"Validator validator = factory.getValidator();"
msgstr ""
+"Configuration<?> config = Validation.byDefaultProvider()\n"
+" .providerResolver( new OSGiServiceDiscoverer() )\n"
+" .configure();\n"
+"\n"
+"ValidatorFactory factory = config.buildValidatorFactory();\n"
+"Validator validator = factory.getValidator();"
#. Tag: para
#: bootstrapping.xml:118
#, no-c-format
-msgid ""
-"Your <classname>OSGiServiceDiscoverer</classname> must in this case
"
-"implement the interface
<classname>ValidationProviderResolver</classname>:"
-msgstr ""
+msgid "Your <classname>OSGiServiceDiscoverer</classname> must in this
case implement the interface
<classname>ValidationProviderResolver</classname>:"
+msgstr "在这种情况下,
你的<classname>OSGiServiceDiscoverer</classname>类需要实现<classname>ValidationProviderResolver</classname>接口:"
#. Tag: title
#: bootstrapping.xml:123
#, no-c-format
msgid "ValidationProviderResolver interface"
-msgstr ""
+msgstr "ValidationProviderResolver接口"
#. Tag: programlisting
#: bootstrapping.xml:125
@@ -220,186 +195,150 @@
msgid ""
"public interface ValidationProviderResolver {\n"
" /**\n"
-" * Returns a list of ValidationProviders available in the runtime "
-"environment.\n"
+" * Returns a list of ValidationProviders available in the runtime
environment.\n"
" *\n"
" * @return list of validation providers. \n"
" */\n"
" List<ValidationProvider<?>>
getValidationProviders();\n"
"}"
msgstr ""
+"public interface ValidationProviderResolver {\n"
+" /**\n"
+" * Returns a list of ValidationProviders available in the runtime
environment.\n"
+" *\n"
+" * @return list of validation providers. \n"
+" */\n"
+" List<ValidationProvider<?>>
getValidationProviders();\n"
+"}"
#. Tag: classname
#: bootstrapping.xml:130
#, no-c-format
msgid "MessageInterpolator"
-msgstr ""
+msgstr "MessageInterpolator"
#. Tag: para
#: bootstrapping.xml:132
#, no-c-format
-msgid ""
-"already discussed the default message interpolation algorithm. If you have "
-"special requirements for your message interpolation you can provide a custom
"
-"interpolator using
<methodname>Configuration.messageInterpolator()</"
-"methodname>. This message interpolator will be shared by all validators "
-"generated by the <classname>ValidatorFactory</classname> created from
this "
-"<classname>Configuration</classname>(see <xref
linkend=\"example-message-"
-"interpolator\"/>)."
-msgstr ""
+msgid "already discussed the default message interpolation algorithm. If you have
special requirements for your message interpolation you can provide a custom interpolator
using <methodname>Configuration.messageInterpolator()</methodname>. This
message interpolator will be shared by all validators generated by the
<classname>ValidatorFactory</classname> created from this
<classname>Configuration</classname>(see <xref
linkend=\"example-message-interpolator\"/>)."
+msgstr "已经讨轮过默认的错误消息解析机制. 如果这个默认的实现不能满足你的需求的话,
你还可以通过<methodname>Configuration.messageInterpolator()</methodname>方法来提供你自定义的消息解析器.
这样,
所有通过<classname>Configuration</classname>创建出来的<classname>ValidatorFactory</classname>生成的校验器都会使用此消息解析器(请参考
<xref linkend=\"example-message-interpolator\"/>)."
#. Tag: title
#: bootstrapping.xml:143
#, no-c-format
msgid "Providing a custom MessageInterpolator"
-msgstr ""
+msgstr "自定义的MessageInterpolator"
#. Tag: programlisting
#: bootstrapping.xml:145
#, no-c-format
msgid ""
-"Configuration<?> configuration =
Validation.byDefaultProvider()."
-"configure();\n"
+"Configuration<?> configuration =
Validation.byDefaultProvider().configure();\n"
"ValidatorFactory factory = configuration\n"
-" .messageInterpolator(new ContextualMessageInterpolator(configuration."
-"getDefaultMessageInterpolator()))\n"
+" .messageInterpolator(new
ContextualMessageInterpolator(configuration.getDefaultMessageInterpolator()))\n"
" .buildValidatorFactory();\n"
"\n"
"Validator validator = factory.getValidator();"
msgstr ""
+"Configuration<?> configuration =
Validation.byDefaultProvider().configure();\n"
+"ValidatorFactory factory = configuration\n"
+" .messageInterpolator(new
ContextualMessageInterpolator(configuration.getDefaultMessageInterpolator()))\n"
+" .buildValidatorFactory();\n"
+"\n"
+"Validator validator = factory.getValidator();"
#. Tag: para
#: bootstrapping.xml:149
#, no-c-format
-msgid ""
-"It is recommended that <classname>MessageInterpolator</classname>
"
-"implementations delegate final interpolation to the Bean Validation default "
-"<classname>MessageInterpolator</classname> to ensure standard Bean
"
-"Validation interpolation rules are followed. The default implementation is "
-"accessible through
<methodname>Configuration.getDefaultMessageInterpolator()"
-"</methodname>."
-msgstr ""
+msgid "It is recommended that <classname>MessageInterpolator</classname>
implementations delegate final interpolation to the Bean Validation default
<classname>MessageInterpolator</classname> to ensure standard Bean Validation
interpolation rules are followed. The default implementation is accessible through
<methodname>Configuration.getDefaultMessageInterpolator()</methodname>."
+msgstr "It is recommended that
<classname>MessageInterpolator</classname> implementations delegate final
interpolation to the Bean Validation default
<classname>MessageInterpolator</classname> to ensure standard Bean Validation
interpolation rules are followed. The default implementation is accessible through
<methodname>Configuration.getDefaultMessageInterpolator()</methodname>."
#. Tag: title
#: bootstrapping.xml:158
#, no-c-format
msgid "ResourceBundleLocator"
-msgstr ""
+msgstr "ResourceBundleLocator"
#. Tag: para
#: bootstrapping.xml:160
#, no-c-format
-msgid ""
-"A common use case is the ability to specify your own resource bundles for "
-"message interpolation. The default <classname>MessageInterpolator</"
-"classname> implementation in Hibernate Validator is called "
-"<classname>ResourceBundleMessageInterpolator</classname> and per
default "
-"loads resource bundles via <methodname>ResourceBundle.getBundle</"
-"methodname>. However,
<classname>ResourceBundleMessageInterpolator</"
-"classname> also allows you to specify a custom implementation of "
-"<classname>ResourceBundleLocator</classname> allowing you to provide
your "
-"own resource bundles. <xref
linkend=\"example-resource-bundle-locator\"/> "
-"shows an example. In the example<methodname>
HibernateValidatorConfiguration."
-"getDefaultResourceBundleLocator</methodname> is used to retrieve the default
"
-"<classname>ResourceBundleLocator</classname> which then can be passed
to the "
-"custom implementation in order implement delegation."
-msgstr ""
+msgid "A common use case is the ability to specify your own resource bundles for
message interpolation. The default <classname>MessageInterpolator</classname>
implementation in Hibernate Validator is called
<classname>ResourceBundleMessageInterpolator</classname> and per default loads
resource bundles via <methodname>ResourceBundle.getBundle</methodname>.
However, <classname>ResourceBundleMessageInterpolator</classname> also allows
you to specify a custom implementation of
<classname>ResourceBundleLocator</classname> allowing you to provide your own
resource bundles. <xref linkend=\"example-resource-bundle-locator\"/>
shows an example. In the example<methodname>
HibernateValidatorConfiguration.getDefaultResourceBundleLocator</methodname> is used
to retrieve the default <classname>ResourceBundleLocator</classname> which
then can be passed to the custom implementation in order implement delegation."
+msgstr "一个普遍的需求是你可能需要为错误消息解析指定你自己的resource bundles.
<classname>ResourceBundleMessageInterpolator</classname>是Hibernate
Validator中默认的<classname>MessageInterpolator</classname>的实现,
它默认情况下是通过<methodname>ResourceBundle.getBundle</methodname>来获取resource bundle的.
不过,
<classname>ResourceBundleMessageInterpolator</classname>也支持你指定一个自定义的<classname>ResourceBundleLocator</classname>实现来提供你自己的resource
bundle. <xref linkend=\"example-resource-bundle-locator\"/>提供了一个示例.
在这个例子中, 先通过<methodname>
HibernateValidatorConfiguration.getDefaultResourceBundleLocator</methodname>获取默认的<classname>ResourceBundleLocator</classname>实现,
然后再用你自定义的实现把默认的包装起来, 代理模式."
#. Tag: title
#: bootstrapping.xml:179
#, no-c-format
msgid "Providing a custom ResourceBundleLocator"
-msgstr ""
+msgstr "自定义的ResourceBundleLocator"
#. Tag: programlisting
#: bootstrapping.xml:181
#, no-c-format
msgid ""
-"HibernateValidatorConfiguration configure = Validation.byProvider"
-"(HibernateValidator.class).configure();\n"
+"HibernateValidatorConfiguration configure =
Validation.byProvider(HibernateValidator.class).configure();\n"
"\n"
-"ResourceBundleLocator defaultResourceBundleLocator = configure."
-"getDefaultResourceBundleLocator(); \n"
-"ResourceBundleLocator myResourceBundleLocator = new "
-"MyCustomResourceBundleLocator(defaultResourceBundleLocator);\n"
+"ResourceBundleLocator defaultResourceBundleLocator =
configure.getDefaultResourceBundleLocator(); \n"
+"ResourceBundleLocator myResourceBundleLocator = new
MyCustomResourceBundleLocator(defaultResourceBundleLocator);\n"
"\n"
-"configure.messageInterpolator(new ResourceBundleMessageInterpolator"
-"(myResourceBundleLocator));"
+"configure.messageInterpolator(new
ResourceBundleMessageInterpolator(myResourceBundleLocator));"
msgstr ""
+"HibernateValidatorConfiguration configure =
Validation.byProvider(HibernateValidator.class).configure();\n"
+"\n"
+"ResourceBundleLocator defaultResourceBundleLocator =
configure.getDefaultResourceBundleLocator(); \n"
+"ResourceBundleLocator myResourceBundleLocator = new
MyCustomResourceBundleLocator(defaultResourceBundleLocator);\n"
+"\n"
+"configure.messageInterpolator(new
ResourceBundleMessageInterpolator(myResourceBundleLocator));"
#. Tag: para
#: bootstrapping.xml:184
#, no-c-format
-msgid ""
-"Hibernate Validator provides the following implementation of "
-"<classname>ResourceBundleLocator</classname> - "
-"<classname>PlatformResourceBundleLocator</classname> (the default) and
"
-"<classname>AggregateResourceBundleLocator</classname>. The latter can
be "
-"used to specify a list of resource bundle names which will get loaded and "
-"merged into a single resource bundle. Refer to the JavaDoc documentation for
"
-"more information."
-msgstr ""
+msgid "Hibernate Validator provides the following implementation of
<classname>ResourceBundleLocator</classname> -
<classname>PlatformResourceBundleLocator</classname> (the default) and
<classname>AggregateResourceBundleLocator</classname>. The latter can be used
to specify a list of resource bundle names which will get loaded and merged into a single
resource bundle. Refer to the JavaDoc documentation for more information."
+msgstr "Hibernate
Validator提供了两个<classname>ResourceBundleLocator</classname>的实现 -
<classname>PlatformResourceBundleLocator</classname> (默认) 和
<classname>AggregateResourceBundleLocator</classname>. 后者可以定义一系列的resource
bundle, 然后它会读取这些文件, 并且把它们组合成一个. 更多信息请参考此类的javadoc 文档."
#. Tag: classname
#: bootstrapping.xml:195
#, no-c-format
msgid "TraversableResolver"
-msgstr ""
+msgstr "TraversableResolver"
#. Tag: para
#: bootstrapping.xml:197
#, no-c-format
-msgid ""
-"The usage of the <classname>TraversableResolver</classname> has so far
not "
-"been discussed. The idea is that in some cases, the state of a property "
-"should not be accessed. The most obvious example for that is a lazy loaded "
-"property or association of a Java Persistence provider. Validating this lazy
"
-"property or association would mean that its state would have to be accessed "
-"triggering a load from the database. Bean Validation controls which property
"
-"can and cannot be accessed via the <classname>TraversableResolver</"
-"classname> interface (see <xref
linkend=\"example-traversable-resolver\"/>). "
-"In the example HibernateValidatorConfiguration."
-msgstr ""
+msgid "The usage of the <classname>TraversableResolver</classname> has
so far not been discussed. The idea is that in some cases, the state of a property should
not be accessed. The most obvious example for that is a lazy loaded property or
association of a Java Persistence provider. Validating this lazy property or association
would mean that its state would have to be accessed triggering a load from the database.
Bean Validation controls which property can and cannot be accessed via the
<classname>TraversableResolver</classname> interface (see <xref
linkend=\"example-traversable-resolver\"/>). In the example
HibernateValidatorConfiguration."
+msgstr "到目前位置我们还没有讨论过<classname>TraversableResolver</classname>接口,
它的设计目的是在某些情况下, 我们可能不应该去获取一个属性的状态. 最典型的情况就是一个延迟加载的属性或者与JPA中涉及到关联关系的时候. 当验证这两种情况的属性的时候,
很可能会触发一次对数据库的查询.Bean
Validation正是通过<classname>TraversableResolver</classname>接口来控制能否访问某一个属性的
(<xref linkend=\"example-traversable-resolver\"/>)."
#. Tag: title
#: bootstrapping.xml:209
#, no-c-format
msgid "TraversableResolver interface"
-msgstr ""
+msgstr "TraversableResolver接口"
#. Tag: programlisting
#: bootstrapping.xml:211
#, no-c-format
msgid ""
"/**\n"
-" * Contract determining if a property can be accessed by the Bean Validation
"
-"provider\n"
-" * This contract is called for each property that is being either validated "
-"or cascaded.\n"
+" * Contract determining if a property can be accessed by the Bean Validation
provider\n"
+" * This contract is called for each property that is being either validated or
cascaded.\n"
" *\n"
" * A traversable resolver implementation must be thread-safe.\n"
" *\n"
" */\n"
"public interface TraversableResolver {\n"
" /**\n"
-" * Determine if the Bean Validation provider is allowed to reach the "
-"property state\n"
+" * Determine if the Bean Validation provider is allowed to reach the property
state\n"
" *\n"
-" * @param traversableObject object hosting <code>"
-"traversableProperty</code> or null \n"
+" * @param traversableObject object hosting
<code>traversableProperty</code> or null \n"
" * if validateValue is called\n"
" * @param traversableProperty the traversable property.\n"
" * @param rootBeanType type of the root object passed to the
Validator.\n"
" * @param pathToTraversableObject path from the root object to\n"
" * <code>traversableObject</code>\n"
" * (using the path specification defined by Bean Validator).\n"
-" * @param elementType either <code>FIELD</code> or
<"
-"code>METHOD</code>.\n"
+" * @param elementType either <code>FIELD</code> or
<code>METHOD</code>.\n"
" *\n"
-" * @return <code>true</code> if the Bean Validation
provider "
-"is allowed to\n"
-" * reach the property state,
<code>false</code> "
-"otherwise.\n"
+" * @return <code>true</code> if the Bean Validation
provider is allowed to\n"
+" * reach the property state,
<code>false</code> otherwise.\n"
" */\n"
" boolean isReachable(Object traversableObject,\n"
" Path.Node traversableProperty,\n"
@@ -408,30 +347,23 @@
" ElementType elementType);\n"
"\n"
" /**\n"
-" * Determine if the Bean Validation provider is allowed to cascade "
-"validation on\n"
+" * Determine if the Bean Validation provider is allowed to cascade validation
on\n"
" * the bean instance returned by the property value\n"
" * marked as &lt;code&gt;(a)Valid&lt;/code&gt;.\n"
-" * Note that this method is called only if isReachable returns true for "
-"the same set of\n"
-" * arguments and if the property is marked as
<code>@Valid</"
-"code>\n"
+" * Note that this method is called only if isReachable returns true for the
same set of\n"
+" * arguments and if the property is marked as
<code>@Valid</code>\n"
" *\n"
-" * @param traversableObject object hosting <code>"
-"traversableProperty</code> or null\n"
+" * @param traversableObject object hosting
<code>traversableProperty</code> or null\n"
" * if validateValue is called\n"
" * @param traversableProperty the traversable property.\n"
" * @param rootBeanType type of the root object passed to the
Validator.\n"
" * @param pathToTraversableObject path from the root object to\n"
" * <code>traversableObject</code>\n"
" * (using the path specification defined by Bean Validator).\n"
-" * @param elementType either <code>FIELD</code> or
<"
-"code>METHOD</code>.\n"
+" * @param elementType either <code>FIELD</code> or
<code>METHOD</code>.\n"
" *\n"
-" * @return <code>true</code> if the Bean Validation
provider "
-"is allowed to\n"
-" * cascade validation, <code>false</code>
"
-"otherwise.\n"
+" * @return <code>true</code> if the Bean Validation
provider is allowed to\n"
+" * cascade validation, <code>false</code>
otherwise.\n"
" */\n"
" boolean isCascadable(Object traversableObject,\n"
" Path.Node traversableProperty,\n"
@@ -440,95 +372,138 @@
" ElementType elementType);\n"
"}"
msgstr ""
+"/**\n"
+" * Contract determining if a property can be accessed by the Bean Validation
provider\n"
+" * This contract is called for each property that is being either validated or
cascaded.\n"
+" *\n"
+" * A traversable resolver implementation must be thread-safe.\n"
+" *\n"
+" */\n"
+"public interface TraversableResolver {\n"
+" /**\n"
+" * Determine if the Bean Validation provider is allowed to reach the property
state\n"
+" *\n"
+" * @param traversableObject object hosting
<code>traversableProperty</code> or null \n"
+" * if validateValue is called\n"
+" * @param traversableProperty the traversable property.\n"
+" * @param rootBeanType type of the root object passed to the
Validator.\n"
+" * @param pathToTraversableObject path from the root object to\n"
+" * <code>traversableObject</code>\n"
+" * (using the path specification defined by Bean Validator).\n"
+" * @param elementType either <code>FIELD</code> or
<code>METHOD</code>.\n"
+" *\n"
+" * @return <code>true</code> if the Bean Validation
provider is allowed to\n"
+" * reach the property state,
<code>false</code> otherwise.\n"
+" */\n"
+" boolean isReachable(Object traversableObject,\n"
+" Path.Node traversableProperty,\n"
+" Class<?> rootBeanType,\n"
+" Path pathToTraversableObject,\n"
+" ElementType elementType);\n"
+"\n"
+" /**\n"
+" * Determine if the Bean Validation provider is allowed to cascade validation
on\n"
+" * the bean instance returned by the property value\n"
+" * marked as &lt;code&gt;(a)Valid&lt;/code&gt;.\n"
+" * Note that this method is called only if isReachable returns true for the
same set of\n"
+" * arguments and if the property is marked as
<code>@Valid</code>\n"
+" *\n"
+" * @param traversableObject object hosting
<code>traversableProperty</code> or null\n"
+" * if validateValue is called\n"
+" * @param traversableProperty the traversable property.\n"
+" * @param rootBeanType type of the root object passed to the
Validator.\n"
+" * @param pathToTraversableObject path from the root object to\n"
+" * <code>traversableObject</code>\n"
+" * (using the path specification defined by Bean Validator).\n"
+" * @param elementType either <code>FIELD</code> or
<code>METHOD</code>.\n"
+" *\n"
+" * @return <code>true</code> if the Bean Validation
provider is allowed to\n"
+" * cascade validation, <code>false</code>
otherwise.\n"
+" */\n"
+" boolean isCascadable(Object traversableObject,\n"
+" Path.Node traversableProperty,\n"
+" Class<?> rootBeanType,\n"
+" Path pathToTraversableObject,\n"
+" ElementType elementType);\n"
+"}"
#. Tag: para
#: bootstrapping.xml:214
#, no-c-format
-msgid ""
-"Hibernate Validator provides two
<classname>TraversableResolver</classname>s "
-"out of the box which will be enabled automatically depending on your "
-"environment. The first is the
<classname>DefaultTraversableResolver</"
-"classname> which will always return true for
<methodname>isReachable()</"
-"methodname> and i<methodname>sTraversable()</methodname>. The second
is the "
-"<classname>JPATraversableResolver</classname> which gets enabled when
"
-"Hibernate Validator gets used in combination with JPA 2. In case you have to
"
-"provide your own resolver you can do so again using the "
-"<classname>Configuration</classname> object as seen in <xref
linkend="
-"\"example-traversable-resolver-config\"/>."
-msgstr ""
+msgid "Hibernate Validator provides two
<classname>TraversableResolver</classname>s out of the box which will be
enabled automatically depending on your environment. The first is the
<classname>DefaultTraversableResolver</classname> which will always return
true for <methodname>isReachable()</methodname> and
i<methodname>sTraversable()</methodname>. The second is the
<classname>JPATraversableResolver</classname> which gets enabled when
Hibernate Validator gets used in combination with JPA 2. In case you have to provide your
own resolver you can do so again using the
<classname>Configuration</classname> object as seen in <xref
linkend=\"example-traversable-resolver-config\"/>."
+msgstr "Hibernate
Validator包含了两个<classname>TraversableResolver</classname>接口的实现,
并且会根据你的环境来决定自动判断使用哪个实现. 首先是<classname>DefaultTraversableResolver</classname>,
它的<methodname>isReachable()</methodname>和<methodname>isTraversable()</methodname>总是返回true.
而另外一个, <classname>JPATraversableResolver</classname>, 会在把Hibernate Validator
和JPA2一起使用的时候被启用. 如果你想提供自己的实现, 可以参照<xref
linkend=\"example-traversable-resolver-config\"/>."
#. Tag: title
#: bootstrapping.xml:227
#, no-c-format
msgid "Providing a custom TraversableResolver"
-msgstr ""
+msgstr "自定义的TraversableResolver"
#. Tag: programlisting
#: bootstrapping.xml:229
#, no-c-format
msgid ""
-"Configuration<?> configuration =
Validation.byDefaultProvider()."
-"configure();\n"
+"Configuration<?> configuration =
Validation.byDefaultProvider().configure();\n"
"ValidatorFactory factory = configuration\n"
" .traversableResolver(new MyTraversableResolver())\n"
" .buildValidatorFactory();\n"
"\n"
"Validator validator = factory.getValidator();"
msgstr ""
+"Configuration<?> configuration =
Validation.byDefaultProvider().configure();\n"
+"ValidatorFactory factory = configuration\n"
+" .traversableResolver(new MyTraversableResolver())\n"
+" .buildValidatorFactory();\n"
+"\n"
+"Validator validator = factory.getValidator();"
#. Tag: classname
#: bootstrapping.xml:234
#, no-c-format
msgid "ConstraintValidatorFactory"
-msgstr ""
+msgstr "ConstraintValidatorFactory"
#. Tag: para
#: bootstrapping.xml:236
#, no-c-format
-msgid ""
-"Last but not least, there is one more configuration option to discuss, the "
-"<classname>ConstraintValidatorFactory</classname>. The default "
-"<classname>ConstraintValidatorFactory</classname> provided by Hibernate
"
-"Validator requires a public no-arg constructor to instantiate "
-"<classname>ConstraintValidator</classname> instances (see <xref
linkend="
-"\"section-constraint-validator\"/>). Using a custom "
-"<classname>ConstraintValidatorFactory</classname> offers for example
the "
-"possibility to use dependency injection in constraint implementations. The "
-"configuration of the custom factory is once more via the "
-"<classname>Configuration</classname> (<xref
linkend=\"example-constraint-"
-"validator-factory\"/>)."
-msgstr ""
+msgid "Last but not least, there is one more configuration option to discuss, the
<classname>ConstraintValidatorFactory</classname>. The default
<classname>ConstraintValidatorFactory</classname> provided by Hibernate
Validator requires a public no-arg constructor to instantiate
<classname>ConstraintValidator</classname> instances (see <xref
linkend=\"section-constraint-validator\"/>). Using a custom
<classname>ConstraintValidatorFactory</classname> offers for example the
possibility to use dependency injection in constraint implementations. The configuration
of the custom factory is once more via the
<classname>Configuration</classname> (<xref
linkend=\"example-constraint-validator-factory\"/>)."
+msgstr "最后, 还有个配置项得提一下,
那就是<classname>ConstraintValidatorFactory</classname>类. Hibernate
Validator中默认的<classname>ConstraintValidatorFactory</classname>需要一个无参的构造方法来初始化<classname>ConstraintValidator</classname>的实例(参考<xref
linkend=\"section-constraint-validator\"/>).
对于自定义的<classname>ConstraintValidatorFactory</classname>实现来说, 例如,
你可以让其支持对约束条件的依赖注入等功能.
配置使用这个自定义的<classname>ConstraintValidatorFactory</classname>的方法还是老样子(<xref
linkend=\"example-constraint-validator-factory\"/>)."
#. Tag: title
#: bootstrapping.xml:249
#, no-c-format
msgid "Providing a custom ConstraintValidatorFactory"
-msgstr ""
+msgstr "自定义的ConstraintValidatorFactory"
#. Tag: programlisting
#: bootstrapping.xml:251
#, no-c-format
msgid ""
-"Configuration<?> configuration =
Validation.byDefaultProvider()."
-"configure();\n"
+"Configuration<?> configuration =
Validation.byDefaultProvider().configure();\n"
"ValidatorFactory factory = configuration\n"
" .constraintValidatorFactory(new IOCConstraintValidatorFactory())\n"
" .buildValidatorFactory();\n"
"\n"
"Validator validator = factory.getValidator();"
msgstr ""
+"Configuration<?> configuration =
Validation.byDefaultProvider().configure();\n"
+"ValidatorFactory factory = configuration\n"
+" .constraintValidatorFactory(new IOCConstraintValidatorFactory())\n"
+" .buildValidatorFactory();\n"
+"\n"
+"Validator validator = factory.getValidator();"
#. Tag: para
#: bootstrapping.xml:254
#, no-c-format
msgid "The interface you have to implement is:"
-msgstr ""
+msgstr "你需要实现此接口:"
#. Tag: title
#: bootstrapping.xml:257
#, no-c-format
msgid "ConstraintValidatorFactory interface"
-msgstr ""
+msgstr "ConstraintValidatorFactory接口"
#. Tag: programlisting
#: bootstrapping.xml:259
@@ -540,25 +515,27 @@
" *\n"
" * @return A constraint validator instance of the specified class.\n"
" */\n"
-" <T extends ConstraintValidator<?,?>> T
getInstance(Class<"
-"T> key);\n"
+" <T extends ConstraintValidator<?,?>> T
getInstance(Class<T> key);\n"
"}"
msgstr ""
+"public interface ConstraintValidatorFactory {\n"
+" /**\n"
+" * @param key The class of the constraint validator to instantiate.\n"
+" *\n"
+" * @return A constraint validator instance of the specified class.\n"
+" */\n"
+" <T extends ConstraintValidator<?,?>> T
getInstance(Class<T> key);\n"
+"}"
#. Tag: para
#: bootstrapping.xml:263
#, no-c-format
-msgid ""
-"Any constraint implementation relying on "
-"<classname>ConstraintValidatorFactory</classname> behaviors specific to
an "
-"implementation (dependency injection, no no-arg constructor and so on) are "
-"not considered portable."
-msgstr ""
+msgid "Any constraint implementation relying on
<classname>ConstraintValidatorFactory</classname> behaviors specific to an
implementation (dependency injection, no no-arg constructor and so on) are not considered
portable."
+msgstr
"如果一个约束条件的实现需要依赖<classname>ConstraintValidatorFactory</classname>的某个特定的行为(例如依赖注入或者没有无参的构造方法等)
都可能导致不可移植."
#. Tag: para
#: bootstrapping.xml:270
#, no-c-format
-msgid ""
-"ConstraintValidatorFactory should not cache instances as the state of each "
-"instance can be altered in the initialize method."
-msgstr ""
+msgid "ConstraintValidatorFactory should not cache instances as the state of each
instance can be altered in the initialize method."
+msgstr "ConstraintValidatorFactory不应该缓存其创建的实例, 因为每个实例都可能在其的初始化方法中被修改."
+
Modified:
validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/programmaticapi.po
===================================================================
---
validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/programmaticapi.po 2010-08-23
14:49:35 UTC (rev 20227)
+++
validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/programmaticapi.po 2010-08-23
16:52:23 UTC (rev 20228)
@@ -6,48 +6,37 @@
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To:
http://bugs.kde.org\n"
"POT-Creation-Date: 2010-07-06 14:46+0000\n"
-"PO-Revision-Date: 2010-07-06 14:46+0000\n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2010-08-23 23:32+0830\n"
+"Last-Translator: Strong Liu <stliu(a)hibernate.org>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. Tag: title
-#: programmaticapi.xml:25 programmaticapi.xml:48
+#: programmaticapi.xml:25
+#: programmaticapi.xml:48
#, no-c-format
msgid "Programmatic constraint definition"
-msgstr ""
+msgstr "编程方式应用约束条件"
#. Tag: para
#: programmaticapi.xml:28
#, no-c-format
-msgid ""
-"Use of the features described in the following sections is not portable "
-"between Bean Validation providers/implementations."
-msgstr ""
+msgid "Use of the features described in the following sections is not portable
between Bean Validation providers/implementations."
+msgstr "下面的特性是不可移植的."
#. Tag: para
#: programmaticapi.xml:32
#, no-c-format
-msgid ""
-"Hibernate Validator allows to configure constraints not only via annotations
"
-"and xml, but also via a programmatic API. This API can be used exclusively "
-"or in combination with annotations and xml. If used in combination "
-"programmatic constraints are additive to otherwise configured constraints."
-msgstr ""
+msgid "Hibernate Validator allows to configure constraints not only via annotations
and xml, but also via a programmatic API. This API can be used exclusively or in
combination with annotations and xml. If used in combination programmatic constraints are
additive to otherwise configured constraints."
+msgstr "Hibernate Validator不仅支持通过标注(annotation) 和xml的方式来给实体定义约束条件, 你也可以通过编程的方式来实现.
这套API即可以覆盖另外两种方式定义的约束条件, 也可以和它们结合在一起使用, 如果是后者的话, 那么它所定义的约束条件会被附加到另外两种方式所定义的约束后面."
#. Tag: para
#: programmaticapi.xml:38
#, no-c-format
-msgid ""
-"The programmatic API is centered around the
<classname>ConstraintMapping</"
-"classname> class which can be found together with its supporting classes in
"
-"the <package>org.hibernate.validator.cfg</package> package. "
-"<classname>ConstraintMapping</classname> is the entry point to a fluent
API "
-"allowing the definition of constraints. <xref lang=\"\"
linkend=\"example-"
-"constraint-mapping\"/> shows how the API can be used."
-msgstr ""
+msgid "The programmatic API is centered around the
<classname>ConstraintMapping</classname> class which can be found together
with its supporting classes in the
<package>org.hibernate.validator.cfg</package> package.
<classname>ConstraintMapping</classname> is the entry point to a fluent API
allowing the definition of constraints. <xref lang=\"\"
linkend=\"example-constraint-mapping\"/> shows how the API can be
used."
+msgstr
"这套API是以<package>org.hibernate.validator.cfg</package>下面的<classname>ConstraintMapping</classname>为中心点,
此包中还包含一些关联的类. <classname>ConstraintMapping</classname>是实现此功能的入口点. <xref
lang=\"\"
linkend=\"example-constraint-mapping\"/>介绍了如何使用此API."
#. Tag: programlisting
#: programmaticapi.xml:50
@@ -69,30 +58,33 @@
" .property( \"rentalStation\", METHOD)\n"
" .constraint( NotNullDef.class );"
msgstr ""
+"ConstraintMapping mapping = new ConstraintMapping();\n"
+"mapping.type( Car.class )\n"
+" .property( \"manufacturer\", FIELD )\n"
+" .constraint( NotNullDef.class )\n"
+" .property( \"licensePlate\", FIELD )\n"
+" .constraint( NotNullDef.class )\n"
+" .constraint( SizeDef.class )\n"
+" .min( 2 )\n"
+" .max( 14 )\n"
+" .property( \"seatCount\", FIELD )\n"
+" .constraint( MinDef.class )\n"
+" .value ( 2 )\n"
+".type( RentalCar.class )\n"
+" .property( \"rentalStation\", METHOD)\n"
+" .constraint( NotNullDef.class );"
#. Tag: para
#: programmaticapi.xml:53
#, no-c-format
-msgid ""
-"As you can see you can configure constraints on multiple classes and "
-"properties using method chaining. The constraint definition classes "
-"<classname>NotNullDef</classname>,
<classname>SizeDef</classname> and "
-"<classname>MinDef</classname> are helper classes which allow to
configure "
-"constraint parameters in a type-safe fashion. Definition classes exists for "
-"all built-in constraints in the
<classname>org.hibernate.validator.cfg.defs</"
-"classname> package. For a custom constraint you can either create your own
"
-"definition class extending <classname>ConstraintDef</classname> or you
can "
-"use <classname>GenericConstraintDef</classname> as seen in <xref
linkend="
-"\"example-generic-constraint-mapping\"/>."
-msgstr ""
+msgid "As you can see you can configure constraints on multiple classes and
properties using method chaining. The constraint definition classes
<classname>NotNullDef</classname>, <classname>SizeDef</classname>
and <classname>MinDef</classname> are helper classes which allow to configure
constraint parameters in a type-safe fashion. Definition classes exists for all built-in
constraints in the <classname>org.hibernate.validator.cfg.defs</classname>
package. For a custom constraint you can either create your own definition class extending
<classname>ConstraintDef</classname> or you can use
<classname>GenericConstraintDef</classname> as seen in <xref
linkend=\"example-generic-constraint-mapping\"/>."
+msgstr "正如你所看到的, 通过链式API的设计, 你可以给多个实体和属性设置约束条件.
上面所用到的<classname>NotNullDef</classname>,
<classname>SizeDef</classname> 等 <classname>MinDef</classname>
只是每个约束条件定义(annotation)所对应的约束定义类, 这样的设计是为了类型安全.
<classname>org.hibernate.validator.cfg.defs</classname>下包含有每个内置的约束条件对应的约束定义类.
对于自定义的约束条件来说, 你可以通过继承<classname>ConstraintDef</classname>来创建你自己的约束定义类,
或者你可以使用<classname>GenericConstraintDef</classname>, 请参考<xref
linkend=\"example-generic-constraint-mapping\"/>."
#. Tag: title
#: programmaticapi.xml:66
#, no-c-format
-msgid ""
-"Programmatic constraint definition using
<classname>GenericConstraintDef</"
-"classname>"
-msgstr ""
+msgid "Programmatic constraint definition using
<classname>GenericConstraintDef</classname>"
+msgstr "通过<classname>GenericConstraintDef</classname>实现约束定义类"
#. Tag: programlisting
#: programmaticapi.xml:69
@@ -105,20 +97,24 @@
" .constraintType( CheckCase.class )\n"
" .param( \"value\", CaseMode.UPPER );"
msgstr ""
+"ConstraintMapping mapping = new ConstraintMapping();\n"
+"mapping.type( Car.class )\n"
+" .property( \"licensePlate\", FIELD )\n"
+" .constraint( GenericConstraintDef.class )\n"
+" .constraintType( CheckCase.class )\n"
+" .param( \"value\", CaseMode.UPPER );"
#. Tag: para
#: programmaticapi.xml:72
#, no-c-format
-msgid ""
-"Last but not least, you can also define cascading constraints as well as the
"
-"default group sequence of an entity."
-msgstr ""
+msgid "Last but not least, you can also define cascading constraints as well as the
default group sequence of an entity."
+msgstr "最后, 你也可是通过API的方式来实现对一个实体重定义默认组序列和级联约束条件定义."
#. Tag: title
#: programmaticapi.xml:76
#, no-c-format
msgid "Cascading constraints and group redefinition"
-msgstr ""
+msgstr "级联约束和默认组序列定义"
#. Tag: programlisting
#: programmaticapi.xml:78
@@ -130,23 +126,23 @@
".type( RentalCar.class)\n"
" .defaultGroupSequence( RentalCar.class, CarChecks.class );"
msgstr ""
+"ConstraintMapping mapping = new ConstraintMapping();\n"
+"mapping.type( Car.class )\n"
+" .valid( \"driver\", FIELD )\n"
+".type( RentalCar.class)\n"
+" .defaultGroupSequence( RentalCar.class, CarChecks.class );"
#. Tag: para
#: programmaticapi.xml:81
#, no-c-format
-msgid ""
-"Once you have your <classname>ConstraintMapping</classname> you will
have to "
-"pass it to the configuration. Since the programmatic configuration is not "
-"part of the official Bean Validation specification you will have to get hold
"
-"of the Hibernate Validator specific configuration instance. See <xref "
-"linkend=\"example-hibernate-specific-config\"/>."
-msgstr ""
+msgid "Once you have your <classname>ConstraintMapping</classname> you
will have to pass it to the configuration. Since the programmatic configuration is not
part of the official Bean Validation specification you will have to get hold of the
Hibernate Validator specific configuration instance. See <xref
linkend=\"example-hibernate-specific-config\"/>."
+msgstr "一旦你创建(和配置)好了<classname>ConstraintMapping</classname>,
你需要把它传递进configuration, 从而创建validator. 因为这个编程方式定义约束的特性不是Bean Validation规范的一部分,
所以你只能通过获取内部的Hibernate Validator的configuration对象来实现. 请参考<xref
linkend=\"example-hibernate-specific-config\"/>."
#. Tag: title
#: programmaticapi.xml:88
#, no-c-format
msgid "Creating a Hibernate Validator specific configuration"
-msgstr ""
+msgstr "创建Hibernate Validator特有的属性"
#. Tag: programlisting
#: programmaticapi.xml:90
@@ -155,9 +151,16 @@
"ConstraintMapping mapping = new ConstraintMapping();\n"
"// configure mapping instance\n"
"\n"
-"HibernateValidatorConfiguration config = Validation.byProvider"
-"( HibernateValidator.class ).configure();\n"
+"HibernateValidatorConfiguration config = Validation.byProvider(
HibernateValidator.class ).configure();\n"
"config.addMapping( mapping );\n"
"ValidatorFactory factory = config.buildValidatorFactory();\n"
"Validator validator = factory.getValidator();"
msgstr ""
+"ConstraintMapping mapping = new ConstraintMapping();\n"
+"// configure mapping instance\n"
+"\n"
+"HibernateValidatorConfiguration config = Validation.byProvider(
HibernateValidator.class ).configure();\n"
+"config.addMapping( mapping );\n"
+"ValidatorFactory factory = config.buildValidatorFactory();\n"
+"Validator validator = factory.getValidator();"
+