# Language zh-CN translations for PACKAGE package.
# Automatically generated, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2012-05-09 09:42+0000\n"
"PO-Revision-Date: 2010-07-07 03:33+0830\n"
"Last-Translator: Strong Liu <stliu@hibernate.org>\n"
"Language-Team: none\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. Tag: title
#: gettingstarted.xml:24
#, no-c-format
msgid "Getting started"
msgstr "开始入门"

#. Tag: para
#: gettingstarted.xml:26
#, no-c-format
msgid ""
"This chapter will show you how to get started with Hibernate Validator, the "
"reference implementation (RI) of Bean Validation. For the following "
"quickstart you need:"
msgstr ""
"本章将会告诉你如何使用Hibernate Validator, 在开始之前,你需要准备好下面的环境:"

#. Tag: para
#: gettingstarted.xml:32
#, fuzzy, no-c-format
msgid "A JDK &gt;= 6"
msgstr "A JDK &gt;= 5"

#. Tag: ulink
#: gettingstarted.xml:36
#, no-c-format
msgid "Apache Maven"
msgstr "Apache Maven"

#. Tag: para
#: gettingstarted.xml:40
#, no-c-format
msgid "An Internet connection (Maven has to download all required libraries)"
msgstr "网络连接 ( Maven需要通过互联网下载所需的类库)"

#. Tag: para
#: gettingstarted.xml:45
#, fuzzy, no-c-format
msgid ""
"A properly configured remote repository. Add the following to your "
"<filename>settings.xml</filename>: <example id=\"example-jboss-maven-url\"> "
"<title>Configuring the JBoss Maven repository</title> <programlisting>&lt;"
"repositories&gt;\n"
"    &lt;repository&gt;\n"
"        &lt;id&gt;jboss-public-repository-group&lt;/id&gt;\n"
"        &lt;url&gt;https://repository.jboss.org/nexus/content/groups/public-"
"jboss&lt;/url&gt;\n"
"        &lt;releases&gt;\n"
"          &lt;enabled&gt;true&lt;/enabled&gt;\n"
"        &lt;/releases&gt;\n"
"        &lt;snapshots&gt;\n"
"          &lt;enabled&gt;true&lt;/enabled&gt;\n"
"        &lt;/snapshots&gt;\n"
"     &lt;/repository&gt;\n"
"&lt;/repositories&gt;        </programlisting> </example>More information "
"about <filename>settings.xml</filename> can be found in the <ulink url="
"\"http://maven.apache.org/ref/2.0.8/maven-settings/settings.html\">Maven "
"Local Settings Model</ulink>."
msgstr ""
"配置远端maven仓库. 添加下面的内容到你的<filename>settings.xml</filename>中:"
"<example> <title>Configuring the JBoss Maven repository in "
"<filename>settings.xml</filename></title> <programlisting>&lt;"
"repositories&gt;\n"
"    &lt;repository&gt;\n"
"        &lt;id&gt;jboss&lt;/id&gt;\n"
"        &lt;url&gt;http://repository.jboss.com/maven2&lt;/url&gt;\n"
"        &lt;releases&gt;\n"
"            &lt;enabled&gt;true&lt;/enabled&gt;\n"
"        &lt;/releases&gt;\n"
"        &lt;snapshots&gt;\n"
"            &lt;enabled&gt;false&lt;/enabled&gt;\n"
"        &lt;/snapshots&gt;\n"
"    &lt;/repository&gt;\n"
"&lt;/repositories&gt;</programlisting> </example>更多关于<filename>settings."
"xml</filename> 的信息请参考<ulink url=\"http://maven.apache.org/ref/2.0.8/"
"maven-settings/settings.html\">Maven Local Settings Model</ulink>."

#. Tag: title
#: gettingstarted.xml:58
#, no-c-format
msgid "Project set up"
msgstr ""

#. Tag: para
#: gettingstarted.xml:60
#, no-c-format
msgid ""
"In order to use Hibernate Validator within an existing Maven project, simply "
"add the following dependency to your <filename>pom.xml</filename>:"
msgstr ""

#. Tag: title
#: gettingstarted.xml:63
#, no-c-format
msgid "Maven dependency of Hibernate Validator"
msgstr ""

#. Tag: programlisting
#: gettingstarted.xml:65
#, no-c-format
msgid ""
"&lt;dependency&gt;\n"
"    &lt;groupId&gt;org.hibernate&lt;/groupId&gt;\n"
"    &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;\n"
"    &lt;version&gt;&version;&lt;/version&gt;\n"
"&lt;/dependency&gt;"
msgstr ""

#. Tag: para
#: gettingstarted.xml:68
#, fuzzy, no-c-format
msgid ""
"Alternatively, you can start by creating a sample project using Hibernate "
"Validator's Quickstart Maven archetype as follows:"
msgstr "使用Maven archetype插件来创建一个新的Maven 项目"

#. Tag: title
#: gettingstarted.xml:72
#, no-c-format
msgid ""
"Using Maven's archetype plugin to create a sample project using Hibernate "
"Validator"
msgstr "使用Maven archetype 插件来创建一个简单的基于Hibernate Validator的项目"

#. Tag: programlisting
#: gettingstarted.xml:75
#, fuzzy, no-c-format
msgid ""
"mvn archetype:generate -DarchetypeGroupId=org.hibernate \\\n"
"                       -DarchetypeArtifactId=hibernate-validator-quickstart-"
"archetype \\\n"
"                       -DarchetypeVersion=&version; \\\n"
"                       -DarchetypeRepository=http://repository.jboss.org/"
"nexus/content/groups/public-jboss/ \\\n"
"                       -DgroupId=com.mycompany \\\n"
"                       -DartifactId=hv-quickstart"
msgstr ""
"mvn archetype:create -DarchetypeGroupId=org.hibernate \\\n"
"                     -DarchetypeArtifactId=hibernate-validator-quickstart-"
"archetype \\\n"
"                     -DarchetypeVersion=&version; \\\n"
"                     -DgroupId=com.mycompany \n"
"                     -DartifactId=hv-quickstart"

#. Tag: para
#: gettingstarted.xml:78
#, no-c-format
msgid ""
"Maven will create your project in the directory hv-quickstart. Change into "
"this directory and run:"
msgstr "Maven 将会把你的项目创建在hv-quickstart目录中. 进入这个目录并且执行:"

#. Tag: programlisting
#: gettingstarted.xml:81
#, no-c-format
msgid "mvn test"
msgstr "mvn test"

#. Tag: para
#: gettingstarted.xml:81
#, fuzzy, no-c-format
msgid ""
"Maven will compile the example code and run the implemented unit tests. "
"Let's have a look at the actual code in the next section."
msgstr ""
"这样, Maven会编译示例代码并且运行单元测试, 接下来,让我们看看生成的代码."

#. Tag: para
#: gettingstarted.xml:86
#, no-c-format
msgid ""
"For the purposes of logging, Hibernate Validator uses the JBoss Logging API. "
"This is an abstraction layer which supports several known logging solutions "
"(e.g. log4j or the logging framework provided by the JDK) as implementation. "
"Just add your preferred logging library to the classpath and all log "
"requests from Hibernate Validator will automatically be delegated to that "
"logging provider."
msgstr ""

#. Tag: para
#: gettingstarted.xml:93
#, no-c-format
msgid ""
"Alternatively, you can explicitely specify a provider using the system "
"property <varname>org.jboss.logging.provider</varname>. Supported values "
"currently are <varname>jboss</varname>, <varname>jdk</varname>, "
"<varname>log4j</varname> and <varname>slf4j</varname>."
msgstr ""

#. Tag: title
#: gettingstarted.xml:101
#, no-c-format
msgid "Applying constraints"
msgstr "添加约束"

#. Tag: para
#: gettingstarted.xml:103
#, no-c-format
msgid ""
"Open the project in the IDE of your choice and have a look at the class "
"<classname>Car</classname>:"
msgstr "在你喜欢的IDE中打开这个项目中的<classname>Car</classname>类:"

#. Tag: title
#: gettingstarted.xml:107
#, no-c-format
msgid "Class Car annotated with constraints"
msgstr "带约束性标注(annotated with constraints)的Car 类"

#. Tag: programlisting
#: gettingstarted.xml:109
#, no-c-format
msgid ""
"package com.mycompany;\n"
"\n"
"import javax.validation.constraints.Min;\n"
"import javax.validation.constraints.NotNull;\n"
"import javax.validation.constraints.Size;\n"
"\n"
"public class Car {\n"
"\n"
"    @NotNull\n"
"    private String manufacturer;\n"
"\n"
"    @NotNull\n"
"    @Size(min = 2, max = 14)\n"
"    private String licensePlate;\n"
"\n"
"    @Min(2)\n"
"    private int seatCount;\n"
"    \n"
"    public Car(String manufacturer, String licencePlate, int seatCount) {\n"
"        this.manufacturer = manufacturer;\n"
"        this.licensePlate = licencePlate;\n"
"        this.seatCount = seatCount;\n"
"    }\n"
"\n"
"    //getters and setters ...\n"
"}"
msgstr ""
"package com.mycompany;\n"
"\n"
"import javax.validation.constraints.Min;\n"
"import javax.validation.constraints.NotNull;\n"
"import javax.validation.constraints.Size;\n"
"\n"
"public class Car {\n"
"\n"
"    @NotNull\n"
"    private String manufacturer;\n"
"\n"
"    @NotNull\n"
"    @Size(min = 2, max = 14)\n"
"    private String licensePlate;\n"
"\n"
"    @Min(2)\n"
"    private int seatCount;\n"
"    \n"
"    public Car(String manufacturer, String licencePlate, int seatCount) {\n"
"        this.manufacturer = manufacturer;\n"
"        this.licensePlate = licencePlate;\n"
"        this.seatCount = seatCount;\n"
"    }\n"
"\n"
"    //getters and setters ...\n"
"}"

#. Tag: para
#: gettingstarted.xml:112
#, no-c-format
msgid ""
"<classname>@NotNull</classname>, <classname>@Size</classname> and "
"<classname>@Min</classname> are so-called constraint annotations, that we "
"use to declare constraints, which shall be applied to the fields of a "
"<classname>Car</classname> instance:"
msgstr ""
"<classname>@NotNull</classname>, <classname>@Size</classname> and "
"<classname>@Min</classname>就是上面所属的约束性标注( constraint "
"annotations), 我们就是使用它们来声明约束, 例如在<classname>Car</classname>的"
"字段中我们可以看到:"

#. Tag: para
#: gettingstarted.xml:119
#, no-c-format
msgid "<property>manufacturer</property> shall never be null"
msgstr "<property>manufacturer</property>永远不能为null"

#. Tag: para
#: gettingstarted.xml:123
#, no-c-format
msgid ""
"<property>licensePlate</property> shall never be null and must be between 2 "
"and 14 characters long"
msgstr ""
"<property>licensePlate</property>永远不能为null,并且它的值字符串的长度要在2到"
"14之间"

#. Tag: para
#: gettingstarted.xml:128
#, no-c-format
msgid "<property>seatCount</property> shall be at least 2."
msgstr "<property>seatCount</property>的值要不能小于2"

#. Tag: title
#: gettingstarted.xml:134
#, no-c-format
msgid "Validating constraints"
msgstr "校验约束"

#. Tag: para
#: gettingstarted.xml:136
#, no-c-format
msgid ""
"To perform a validation of these constraints, we use a <classname>Validator</"
"classname> instance. Let's have a look at the <classname>CarTest</classname> "
"class:"
msgstr ""
"我们需要使用<classname>Validator</classname>来对上面的那些约束进行校验. 让我"
"们来看看<classname>CarTest</classname>这个类:"

#. Tag: title
#: gettingstarted.xml:141
#, no-c-format
msgid "Class CarTest showing validation examples"
msgstr "在CarTest中使用校验"

#. Tag: programlisting
#: gettingstarted.xml:143
#, no-c-format
msgid ""
"package com.mycompany;\n"
"\n"
"import static org.junit.Assert.*;\n"
"\n"
"import java.util.Set;\n"
"\n"
"import javax.validation.ConstraintViolation;\n"
"import javax.validation.Validation;\n"
"import javax.validation.Validator;\n"
"import javax.validation.ValidatorFactory;\n"
"\n"
"import org.junit.BeforeClass;\n"
"import org.junit.Test;\n"
"\n"
"public class CarTest {\n"
"\n"
"    private static Validator validator;\n"
"\n"
"    @BeforeClass\n"
"    public static void setUp() {\n"
"        ValidatorFactory factory = Validation.buildDefaultValidatorFactory"
"();\n"
"        validator = factory.getValidator();\n"
"    }\n"
"\n"
"    @Test\n"
"    public void manufacturerIsNull() {\n"
"        Car car = new Car(null, \"DD-AB-123\", 4);\n"
"\n"
"        Set&lt;ConstraintViolation&lt;Car&gt;&gt; constraintViolations =\n"
"            validator.validate(car);\n"
"\n"
"        assertEquals(1, constraintViolations.size());\n"
"        assertEquals(\"may not be null\", constraintViolations.iterator()."
"next().getMessage());\n"
"    }\n"
"\n"
"    @Test\n"
"    public void licensePlateTooShort() {\n"
"        Car car = new Car(\"Morris\", \"D\", 4);\n"
"\n"
"        Set&lt;ConstraintViolation&lt;Car&gt;&gt; constraintViolations = \n"
"            validator.validate(car);\n"
"\n"
"        assertEquals(1, constraintViolations.size());\n"
"        assertEquals(\"size must be between 2 and 14\", constraintViolations."
"iterator().next().getMessage());\n"
"    }\n"
"    \n"
"    @Test\n"
"    public void seatCountTooLow() {\n"
"        Car car = new Car(\"Morris\", \"DD-AB-123\", 1);\n"
"\n"
"        Set&lt;ConstraintViolation&lt;Car&gt;&gt; constraintViolations =\n"
"            validator.validate(car);\n"
"\n"
"        assertEquals(1, constraintViolations.size());\n"
"        assertEquals(\"must be greater than or equal to 2\", "
"constraintViolations.iterator().next().getMessage());\n"
"    }\n"
"\n"
"    @Test\n"
"    public void carIsValid() {\n"
"        Car car = new Car(\"Morris\", \"DD-AB-123\", 2);\n"
"\n"
"        Set&lt;ConstraintViolation&lt;Car&gt;&gt; constraintViolations =\n"
"            validator.validate(car);\n"
"\n"
"        assertEquals(0, constraintViolations.size());\n"
"    }\n"
"}"
msgstr ""
"package com.mycompany;\n"
"\n"
"import static org.junit.Assert.*;\n"
"\n"
"import java.util.Set;\n"
"\n"
"import javax.validation.ConstraintViolation;\n"
"import javax.validation.Validation;\n"
"import javax.validation.Validator;\n"
"import javax.validation.ValidatorFactory;\n"
"\n"
"import org.junit.BeforeClass;\n"
"import org.junit.Test;\n"
"\n"
"public class CarTest {\n"
"\n"
"    private static Validator validator;\n"
"\n"
"    @BeforeClass\n"
"    public static void setUp() {\n"
"        ValidatorFactory factory = Validation.buildDefaultValidatorFactory"
"();\n"
"        validator = factory.getValidator();\n"
"    }\n"
"\n"
"    @Test\n"
"    public void manufacturerIsNull() {\n"
"        Car car = new Car(null, \"DD-AB-123\", 4);\n"
"\n"
"        Set&lt;ConstraintViolation&lt;Car&gt;&gt; constraintViolations =\n"
"            validator.validate(car);\n"
"\n"
"        assertEquals(1, constraintViolations.size());\n"
"        assertEquals(\"may not be null\", constraintViolations.iterator()."
"next().getMessage());\n"
"    }\n"
"\n"
"    @Test\n"
"    public void licensePlateTooShort() {\n"
"        Car car = new Car(\"Morris\", \"D\", 4);\n"
"\n"
"        Set&lt;ConstraintViolation&lt;Car&gt;&gt; constraintViolations = \n"
"            validator.validate(car);\n"
"\n"
"        assertEquals(1, constraintViolations.size());\n"
"        assertEquals(\"size must be between 2 and 14\", constraintViolations."
"iterator().next().getMessage());\n"
"    }\n"
"    \n"
"    @Test\n"
"    public void seatCountTooLow() {\n"
"        Car car = new Car(\"Morris\", \"DD-AB-123\", 1);\n"
"\n"
"        Set&lt;ConstraintViolation&lt;Car&gt;&gt; constraintViolations =\n"
"            validator.validate(car);\n"
"\n"
"        assertEquals(1, constraintViolations.size());\n"
"        assertEquals(\"must be greater than or equal to 2\", "
"constraintViolations.iterator().next().getMessage());\n"
"    }\n"
"\n"
"    @Test\n"
"    public void carIsValid() {\n"
"        Car car = new Car(\"Morris\", \"DD-AB-123\", 2);\n"
"\n"
"        Set&lt;ConstraintViolation&lt;Car&gt;&gt; constraintViolations =\n"
"            validator.validate(car);\n"
"\n"
"        assertEquals(0, constraintViolations.size());\n"
"    }\n"
"}"

#. Tag: para
#: gettingstarted.xml:146
#, no-c-format
msgid ""
"In the <methodname>setUp()</methodname> method we get a "
"<classname>Validator</classname> instance from the "
"<classname>ValidatorFactory</classname>. A <classname>Validator</classname> "
"instance is thread-safe and may be reused multiple times. For this reason we "
"store it as field of our test class. We can use the <classname>Validator</"
"classname> now to validate the different car instances in the test methods."
msgstr ""
"在<methodname>setUp()</methodname>方法中,我们通过"
"<classname>ValidatorFactory</classname>得到了一个<classname>Validator</"
"classname>的实例. <classname>Validator</classname>是线程安全的,并且可以重复使"
"用, 所以我们把它保存成一个类变量. 现在我们可以在test方法中使用这个validator的"
"实例来校验不同的car实例了."

#. Tag: para
#: gettingstarted.xml:154
#, no-c-format
msgid ""
"The <methodname>validate()</methodname> method returns a set of "
"<classname>ConstraintViolation</classname> instances, which we can iterate "
"in order to see which validation errors occurred. The first three test "
"methods show some expected constraint violations:"
msgstr ""
"<methodname>validate()</methodname>方法会返回一个set的"
"<classname>ConstraintViolation</classname>的实例的集合, 我们可以通过遍历它来"
"查看有哪些验证错误. 前面三个测试用例显示了一些预期的校验约束:"

#. Tag: para
#: gettingstarted.xml:161
#, no-c-format
msgid ""
"The <classname>@NotNull</classname> constraint on manufacturer is violated "
"in <methodname>manufacturerIsNull()</methodname>"
msgstr ""
"在<methodname>manufacturerIsNull()</methodname>中可以看到manufacturer违反了"
"<classname>@NotNull</classname>约束"

#. Tag: para
#: gettingstarted.xml:166
#, no-c-format
msgid ""
"The <classname>@Size</classname> constraint on licensePlate is violated in "
"<methodname>licensePlateTooShort()</methodname>"
msgstr ""
"<methodname>licensePlateTooShort()</methodname>中的licensePlate违反了"
"<classname>@Size</classname>约束"

#. Tag: para
#: gettingstarted.xml:171
#, no-c-format
msgid ""
"The <classname>@Min</classname> constraint on seatCount is violated in "
"<methodname>seatCountTooLow()</methodname>"
msgstr ""
"而<methodname>seatCountTooLow()</methodname>中则导致seatCount违反了"
"<classname>@Min</classname>约束"

#. Tag: para
#: gettingstarted.xml:176
#, no-c-format
msgid ""
"If the object validates successfully, <methodname>validate()</methodname> "
"returns an empty set."
msgstr ""
" 如果一个对象没有校验出问题的话,那么<methodname>validate()</methodname> 会返"
"回一个空的set对象."

#. Tag: para
#: gettingstarted.xml:179
#, no-c-format
msgid ""
"Note that we only use classes from the package <package>javax.validation</"
"package> from the Bean Validation API. As we don't reference any classes of "
"the RI directly, it would be no problem to switch to another implementation "
"of the API, should that need arise."
msgstr ""
"注意,我们只使用了Bean Validation API中的package <package>javax.validation</"
"package>中的类, 并没有直接调用参考实现中的任何类,所以, 没有任何问题如果切换到"
"其他的实现."

#. Tag: title
#: gettingstarted.xml:187
#, no-c-format
msgid "Where to go next?"
msgstr "更进一步"

#. Tag: para
#: gettingstarted.xml:189
#, fuzzy, no-c-format
msgid ""
"That concludes our 5 minute tour through the world of Hibernate Validator. "
"Continue exploring the code examples or look at further examples referenced "
"in <xref linkend=\"validator-further-reading\"/>. To deepen your "
"understanding of Hibernate Validator just continue reading <xref linkend="
"\"validator-usingvalidator\"/>. In case your application has specific "
"validation requirements have a look at <xref linkend=\"validator-"
"customconstraints\"/>."
msgstr ""
"在本章中, 您了解了一个基于Hibernate Validator的简单例子. 更多的示例请参考 "
"<xref linkend=\"chapter-further-reading\"/>. 如果想进一步了解Hibenate "
"Validator, 请继续阅读<xref linkend=\"validator-usingvalidator\"/>.  如果您的"
"应用程序有特殊的校验需求,请参考 <xref linkend=\"validator-customconstraints"
"\"/>."

#, fuzzy
#~ msgid ""
#~ "Hibernate Validator uses JAXB for XML parsing. JAXB is part of the Java "
#~ "Class Library since Java 6 which means that if you run Hibernate "
#~ "Validator with Java 5 you will have to add additional JAXB dependencies. "
#~ "Using Maven you have to add the following dependencies:"
#~ "<programlisting>&lt;dependency&gt;\n"
#~ "    &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;\n"
#~ "    &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;\n"
#~ "    &lt;version&gt;2.2&lt;/version&gt;\n"
#~ "&lt;/dependency&gt;\n"
#~ "&lt;dependency&gt;\n"
#~ "    &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;\n"
#~ "    &lt;artifactId&gt;jaxb-impl&lt;/artifactId&gt;\n"
#~ "    &lt;version&gt;2.1.12&lt;/version&gt;\n"
#~ "&lt;/dependency&gt;\n"
#~ "</programlisting> if you are using the SourceForge package you find the "
#~ "necessary libraries in the <filename>lib/jdk5</filename> directory. In "
#~ "case you are not using the XML configuration you can also disable it "
#~ "explicitly by calling <methodname>Configuration.ignoreXmlConfiguration()</"
#~ "methodname> during <classname>ValidationFactory</classname> creation. In "
#~ "this case the JAXB dependencies are not needed."
#~ msgstr ""
#~ "Hibernate Validator 使用JAXB 来解析XML. JAXB 已经被集成进Java 6了, 所以,如"
#~ "果你要在Java 5上使用Hibernate Validator的话, 那么,还需要添加额外的JAXB的依"
#~ "赖. 如果你使用Maven的话,你可以把下面的内容添加到pom当中:"
#~ "<programlisting>&lt;dependency&gt;\n"
#~ "    &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;\n"
#~ "    &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;\n"
#~ "    &lt;version&gt;2.2&lt;/version&gt;\n"
#~ "&lt;/dependency&gt;\n"
#~ "&lt;dependency&gt;\n"
#~ "    &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;\n"
#~ "    &lt;artifactId&gt;jaxb-impl&lt;/artifactId&gt;\n"
#~ "    &lt;version&gt;2.1.12&lt;/version&gt;\n"
#~ "&lt;/dependency&gt;\n"
#~ "</programlisting>"

#~ msgid "Setting up a new Maven project"
#~ msgstr "第一个Maven项目"
