svn commit: r1814364 - in /maven/plugins/trunk/maven-pdf-plugin/src: it/descriptor/ it/descriptor/src/ it/descriptor/src/site/ it/descriptor/src/site/fr/ it/descriptor/src/site/fr/xdoc/ it/descriptor/src/site/xdoc/ main/java/org/apache/maven/plugins/pdf/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1814364 - in /maven/plugins/trunk/maven-pdf-plugin/src: it/descriptor/ it/descriptor/src/ it/descriptor/src/site/ it/descriptor/src/site/fr/ it/descriptor/src/site/fr/xdoc/ it/descriptor/src/site/xdoc/ main/java/org/apache/maven/plugins/pdf/

hboutemy
Author: hboutemy
Date: Sun Nov  5 17:38:22 2017
New Revision: 1814364

URL: http://svn.apache.org/viewvc?rev=1814364&view=rev
Log:
[MPDF-47] use localized doc descriptor when available
Submitted by: Tim Rademacher
Applied with some modification and an additional IT

Added:
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/pom.xml   (with props)
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/foo.xml   (with props)
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/help.xml   (with props)
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/pdf.xml   (with props)
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/pdf_fr.xml   (with props)
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/foo.xml   (with props)
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/help.xml   (with props)
    maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/verify.groovy
Modified:
    maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java
    maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java

Added: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/pom.xml?rev=1814364&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/pom.xml (added)
+++ maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/pom.xml Sun Nov  5 17:38:22 2017
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.pdf</groupId>
+  <artifactId>descriptor</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <name>PDF with Descriptor Test</name>
+  <description>
+    Tests a multi-locales PDF generation with descriptors.
+  </description>
+
+  <organization>
+    <name>The Apache Software Foundation</name>
+    <url>http://www.apache.org/</url>
+  </organization>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.4.1</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pdf-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <locales>en,fr</locales>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  
+  <reporting>
+    <plugins>
+      <plugin>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <version>2.9</version>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>license</report>
+              <report>summary</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+    </plugins>
+  </reporting>  
+  
+</project>

Propchange: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/foo.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/foo.xml?rev=1814364&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/foo.xml (added)
+++ maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/foo.xml Sun Nov  5 17:38:22 2017
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<document xmlns="http://maven.apache.org/XDOC/2.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
+  <properties>
+    <title>Xdoc Truc en Français</title>
+    <author>Hervé Boutemy</author>
+  </properties>
+  <body>
+    <section name="Xdoc Truc en Français">
+      <p>Ce fichier a été écrit en Xdoc Doxia Markup.</p>
+    </section>
+  </body>
+</document>

Propchange: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/foo.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/help.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/help.xml?rev=1814364&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/help.xml (added)
+++ maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/help.xml Sun Nov  5 17:38:22 2017
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<document xmlns="http://maven.apache.org/XDOC/2.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
+  <properties>
+    <title>Xdoc Aide en Français</title>
+    <author>Hervé Boutemy</author>
+  </properties>
+  <body>
+    <section name="Xdoc Aide en Français">
+      <p>Ce fichier a été écrit en Xdoc Doxia Markup.</p>
+    </section>
+  </body>
+</document>

Propchange: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/fr/xdoc/help.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/pdf.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/pdf.xml?rev=1814364&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/pdf.xml (added)
+++ maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/pdf.xml Sun Nov  5 17:38:22 2017
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<document xmlns="http://maven.apache.org/DOCUMENT/1.0.1"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DOCUMENT/1.0.1 http://maven.apache.org/xsd/document-1.0.1.xsd"
+  outputName="maven-pdf-plugin">
+
+ <meta>
+ <title>AnyTitle</title>
+ </meta>
+
+ <toc name="Table of Contents">
+ <item name="Help" ref="help.xml" />
+ <item name="Foo" ref="foo.xml" />
+ </toc>
+
+ <cover>
+ <coverTitle>${project.name}</coverTitle>
+ <coverSubTitle>v. ${project.version}</coverSubTitle>
+ <coverType>User Guide</coverType>
+ <projectName>${project.name}</projectName>
+ <!--<projectLogo>some project logo</projectLogo>-->
+ <companyName>Apache</companyName>
+ <!--<companyLogo>some company logo</companyLogo>-->
+ </cover>
+</document>

Propchange: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/pdf.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/pdf_fr.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/pdf_fr.xml?rev=1814364&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/pdf_fr.xml (added)
+++ maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/pdf_fr.xml Sun Nov  5 17:38:22 2017
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<document xmlns="http://maven.apache.org/DOCUMENT/1.0.1"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DOCUMENT/1.0.1 http://maven.apache.org/xsd/document-1.0.1.xsd"
+  outputName="maven-pdf-plugin">
+
+ <meta>
+ <title>N'importe quel Titre</title>
+ </meta>
+
+ <toc name="Table des matieres"><!-- using 'è' generates content too complex to test in pdf... -->
+ <item name="Aide" ref="help.xml" />
+ <item name="Truc" ref="foo.xml" />
+ </toc>
+
+ <cover>
+ <coverTitle>${project.name}</coverTitle>
+ <coverSubTitle>v. ${project.version}</coverSubTitle>
+ <coverType>Documentation Utilisateur</coverType>
+ <projectName>${project.name}</projectName>
+ <!--<projectLogo>some project logo</projectLogo>-->
+ <companyName>Apache</companyName>
+ <!--<companyLogo>some company logo</companyLogo>-->
+ </cover>
+</document>

Propchange: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/pdf_fr.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/foo.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/foo.xml?rev=1814364&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/foo.xml (added)
+++ maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/foo.xml Sun Nov  5 17:38:22 2017
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<document xmlns="http://maven.apache.org/XDOC/2.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
+  <properties>
+    <title>Xdoc Foo in Default Locale</title>
+    <author>Hervé Boutemy</author>
+  </properties>
+  <body>
+    <section name="Xdoc Foo in in Default Locale">
+      <p>This file was written in Xdoc Doxia Markup.</p>
+    </section>
+  </body>
+</document>

Propchange: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/foo.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/help.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/help.xml?rev=1814364&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/help.xml (added)
+++ maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/help.xml Sun Nov  5 17:38:22 2017
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<document xmlns="http://maven.apache.org/XDOC/2.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
+  <properties>
+    <title>Xdoc Help in Default Locale</title>
+    <author>Hervé Boutemy</author>
+  </properties>
+  <body>
+    <section name="Xdoc Help in in Default Locale">
+      <p>This file was written in Xdoc Doxia Markup.</p>
+    </section>
+  </body>
+</document>

Propchange: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/src/site/xdoc/help.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/verify.groovy?rev=1814364&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/verify.groovy (added)
+++ maven/plugins/trunk/maven-pdf-plugin/src/it/descriptor/verify.groovy Sun Nov  5 17:38:22 2017
@@ -0,0 +1,24 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+pdfFile = new File( basedir, "target/pdf/fr/maven-pdf-plugin.pdf" )
+
+assert !pdfFile.text.contains( "Table of Content" )
+assert pdfFile.text.contains( "Table des matieres" )

Modified: maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java?rev=1814364&r1=1814363&r2=1814364&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java (original)
+++ maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java Sun Nov  5 17:38:22 2017
@@ -31,7 +31,7 @@ import org.apache.maven.doxia.document.i
 
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
-
+import org.apache.maven.shared.utils.io.FileUtils;
 import org.codehaus.plexus.interpolation.EnvarBasedValueSource;
 import org.codehaus.plexus.interpolation.InterpolationException;
 import org.codehaus.plexus.interpolation.Interpolator;
@@ -42,6 +42,7 @@ import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import java.util.Locale;
 
 /**
  * Read and filter a DocumentModel from a document descriptor file.
@@ -57,12 +58,14 @@ public class DocumentDescriptorReader
     /** Used to log the interpolated document descriptor. */
     private final Log log;
 
+    private final Locale locale;
+
     /**
      * Constructor.
      */
     public DocumentDescriptorReader()
     {
-        this( null, null );
+        this( null, null, null );
     }
 
     /**
@@ -72,7 +75,7 @@ public class DocumentDescriptorReader
      */
     public DocumentDescriptorReader( final MavenProject project )
     {
-        this( project, null );
+        this( project, null, null );
     }
 
     /**
@@ -81,23 +84,37 @@ public class DocumentDescriptorReader
      * @param project may be null.
      * @param log may be null.
      */
-    public DocumentDescriptorReader( final MavenProject project, final Log log )
+    public DocumentDescriptorReader( final MavenProject project, final Log log, final Locale locale )
     {
         this.project = project;
         this.log = log;
+        this.locale = locale;
     }
 
     /**
      * Read and filter the <code>docDescriptor</code> file.
      *
-     * @param docDescriptor not null.
+     * @param docDescriptor not null, corresponding to non-localized descriptor file.
      * @return a DocumentModel instance.
      * @throws XmlPullParserException if an error occurs during parsing.
      * @throws IOException if an error occurs during reading.
      */
-    public DocumentModel readAndFilterDocumentDescriptor( final File docDescriptor )
+    public DocumentModel readAndFilterDocumentDescriptor( File docDescriptor )
         throws XmlPullParserException, IOException
     {
+        if ( locale != null )
+        {
+            String descriptorFilename = docDescriptor.getName();
+            String localized = FileUtils.removeExtension( descriptorFilename ) + '_' + locale.getLanguage() + '.'
+                + FileUtils.getExtension( descriptorFilename );
+            File localizedDocDescriptor = new File( docDescriptor.getParentFile(), localized );
+
+            if ( localizedDocDescriptor.exists() )
+            {
+                docDescriptor = localizedDocDescriptor;
+            }
+        }
+
         Reader reader = null;
         try
         {

Modified: maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java?rev=1814364&r1=1814363&r2=1814364&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java (original)
+++ maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java Sun Nov  5 17:38:22 2017
@@ -719,8 +719,8 @@ public class PdfMojo
 
         try
         {
-            model =
-                new DocumentDescriptorReader( project, getLog() ).readAndFilterDocumentDescriptor( docDescriptor );
+            model = new DocumentDescriptorReader( project, getLog(),
+                                                  locale ).readAndFilterDocumentDescriptor( docDescriptor );
         }
         catch ( XmlPullParserException ex )
         {