Author: vsiveton Date: Tue Jan 29 16:28:10 2008 New Revision: 616571 URL: http://svn.apache.org/viewvc?rev=616571&view=rev Log: MJAVADOC-169: Add support for i18n Submitted by: Benjamin Bentmann Reviewed by: Vincent Siveton
o applied Added: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report.properties (with props) maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_de.properties (with props) maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_en.properties (with props) maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report.properties (with props) maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_de.properties (with props) maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_en.properties (with props) Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocReport.java Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java?rev=616571&r1=616570&r2=616571&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java Tue Jan 29 16:28:10 2008 @@ -33,6 +33,7 @@ import java.io.IOException; import java.util.List; import java.util.Locale; +import java.util.ResourceBundle; /** * Generates documentation for the <code>Java code</code> in the project using the standard @@ -82,7 +83,7 @@ * The name of the Javadoc report. * * @since 2.1 - * @parameter expression="${name}" default-value="JavaDocs" + * @parameter expression="${name}" */ private String name; @@ -90,7 +91,7 @@ * The description of the Javadoc report. * * @since 2.1 - * @parameter expression="${description}" default-value="JavaDoc API documentation." + * @parameter expression="${description}" */ private String description; @@ -105,7 +106,7 @@ { if ( StringUtils.isEmpty( name ) ) { - return "JavaDocs"; + return getBundle( locale ).getString( "report.javadoc.name" ); } return name; @@ -118,7 +119,7 @@ { if ( StringUtils.isEmpty( description ) ) { - return "JavaDoc API documentation."; + return getBundle( locale ).getString( "report.javadoc.description" ); } return description; @@ -237,5 +238,16 @@ throw new MojoExecutionException( "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation:" + e.getMessage(), e ); } + } + + /** + * Gets the resource bundle for the specified locale. + * + * @param locale The locale of the currently generated report. + * @return The resource bundle for the requested locale. + */ + private ResourceBundle getBundle( Locale locale ) + { + return ResourceBundle.getBundle( "javadoc-report", locale, getClass().getClassLoader() ); } } Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocReport.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocReport.java?rev=616571&r1=616570&r2=616571&view=diff ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocReport.java (original) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocReport.java Tue Jan 29 16:28:10 2008 @@ -24,6 +24,7 @@ import java.util.Collections; import java.util.List; import java.util.Locale; +import java.util.ResourceBundle; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.StringUtils; @@ -105,14 +106,14 @@ /** * The name of the test Javadoc report. * - * @parameter expression="${name}" default-value="Test JavaDocs" + * @parameter expression="${name}" */ private String name; /** * The description of the test Javadoc report. * - * @parameter expression="${description}" default-value="Test JavaDoc API documentation." + * @parameter expression="${description}" */ private String description; @@ -127,7 +128,7 @@ { if ( StringUtils.isEmpty( name ) ) { - return "Test JavaDocs"; + return getBundle( locale ).getString( "report.test-javadoc.name" ); } return name; @@ -140,7 +141,7 @@ { if ( StringUtils.isEmpty( description ) ) { - return "Test JavaDoc API documentation."; + return getBundle( locale ).getString( "report.test-javadoc.description" ); } return description; @@ -264,5 +265,16 @@ protected String getWindowtitle() { return windowtitle; + } + + /** + * Gets the resource bundle for the specified locale. + * + * @param locale The locale of the currently generated report. + * @return The resource bundle for the requested locale. + */ + private ResourceBundle getBundle( Locale locale ) + { + return ResourceBundle.getBundle( "test-javadoc-report", locale, getClass().getClassLoader() ); } } Added: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report.properties?rev=616571&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report.properties (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report.properties Tue Jan 29 16:28:10 2008 @@ -0,0 +1,19 @@ +# 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. + +report.javadoc.name=JavaDocs +report.javadoc.description=JavaDoc API documentation. Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report.properties ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_de.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_de.properties?rev=616571&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_de.properties (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_de.properties Tue Jan 29 16:28:10 2008 @@ -0,0 +1,19 @@ +# 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. + +report.javadoc.name=JavaDocs +report.javadoc.description=JavaDoc API Dokumentation. Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_de.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_de.properties ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_en.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_en.properties?rev=616571&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_en.properties (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_en.properties Tue Jan 29 16:28:10 2008 @@ -0,0 +1,23 @@ +# 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. + +# NOTE: +# This bundle is intentionally empty because English strings are provided by the base bundle via the parent chain. It +# must be provided nevertheless such that a request for locale "en" will not errorneously pick up the bundle for the +# JVM's default locale (which need not be "en"). See the method javadoc about +# ResourceBundle.getBundle(String, Locale, ClassLoader) +# for a full description of the lookup strategy. Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_en.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/javadoc-report_en.properties ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report.properties?rev=616571&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report.properties (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report.properties Tue Jan 29 16:28:10 2008 @@ -0,0 +1,19 @@ +# 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. + +report.test-javadoc.name=Test JavaDocs +report.test-javadoc.description=Test JavaDoc API documentation. Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report.properties ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_de.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_de.properties?rev=616571&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_de.properties (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_de.properties Tue Jan 29 16:28:10 2008 @@ -0,0 +1,19 @@ +# 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. + +report.test-javadoc.name=Test JavaDocs +report.test-javadoc.description=Test JavaDoc API Dokumentation. Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_de.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_de.properties ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_en.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_en.properties?rev=616571&view=auto ============================================================================== --- maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_en.properties (added) +++ maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_en.properties Tue Jan 29 16:28:10 2008 @@ -0,0 +1,23 @@ +# 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. + +# NOTE: +# This bundle is intentionally empty because English strings are provided by the base bundle via the parent chain. It +# must be provided nevertheless such that a request for locale "en" will not errorneously pick up the bundle for the +# JVM's default locale (which need not be "en"). See the method javadoc about +# ResourceBundle.getBundle(String, Locale, ClassLoader) +# for a full description of the lookup strategy. Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_en.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/main/resources/test-javadoc-report_en.properties ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision"