Add i18n translations for dependencies report

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@193018 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-06-22 22:49:17 +00:00
parent 96437550d4
commit e95085dbbe
3 changed files with 39 additions and 10 deletions

View File

@ -28,6 +28,7 @@ import org.codehaus.doxia.site.renderer.SiteRenderer;
import java.io.IOException;
import java.util.Iterator;
import java.util.Locale;
import java.util.ResourceBundle;
/**
* @goal dependencies
@ -64,7 +65,7 @@ public class DependenciesReport
*/
public String getName( Locale locale )
{
return "Dependencies";
return getBundle( locale ).getString( "report.dependencies.name" );
}
/**
@ -80,7 +81,7 @@ public class DependenciesReport
*/
public String getDescription( Locale locale )
{
return "This document lists the projects dependencies and provides information on each dependency.";
return getBundle( locale ).getString( "report.dependencies.description" );
}
/**
@ -115,7 +116,7 @@ public class DependenciesReport
{
try
{
DependenciesRenderer r = new DependenciesRenderer( getSink(), getProject().getModel() );
DependenciesRenderer r = new DependenciesRenderer( getSink(), getProject().getModel(), locale );
r.render();
}
@ -138,17 +139,21 @@ public class DependenciesReport
{
private Model model;
public DependenciesRenderer( Sink sink, Model model )
private Locale locale;
public DependenciesRenderer( Sink sink, Model model, Locale locale )
{
super( sink );
this.model = model;
this.locale = locale;
}
// How to i18n these ...
public String getTitle()
{
return "Project Dependencies";
return getBundle( locale ).getString( "report.dependencies.title" );
}
public void renderBody()
@ -158,17 +163,21 @@ public class DependenciesReport
if ( model.getDependencies().isEmpty() )
{
// TODO: should the report just be excluded?
paragraph( "There are no dependencies for this project. It is a standalone " +
"application that does not depend on any other project." );
paragraph( getBundle( locale ).getString( "report.dependencies.nolist" ) );
}
else
{
startTable();
tableCaption( "The following is a list of dependencies for this project. These dependencies " +
"are required to compile and run the application:" );
tableCaption( getBundle( locale ).getString( "report.dependencies.intro" ) );
tableHeader( new String[]{"GroupId", "ArtifactId", "Version"} );
String groupId = getBundle( locale ).getString( "report.dependencies.column.groupId" );
String artifactId = getBundle( locale ).getString( "report.dependencies.column.artifactId" );
String version = getBundle( locale ).getString( "report.dependencies.column.version" );
tableHeader( new String[]{groupId, artifactId, version} );
for ( Iterator i = model.getDependencies().iterator(); i.hasNext(); )
{
@ -182,6 +191,10 @@ public class DependenciesReport
endSection();
}
}
private static ResourceBundle getBundle( Locale locale )
{
return ResourceBundle.getBundle("project-info-report", locale, DependenciesReport.class.getClassLoader() );
}
}

View File

@ -1,3 +1,11 @@
report.dependencies.name=Dependencies
report.dependencies.nolist=There are no dependencies for this project. It is a standalone application that does not depend on any other project.
report.dependencies.title=Project Dependencies
report.dependencies.description=This document lists the projects dependencies and provides information on each dependency.
report.dependencies.intro=The following is a list of dependencies for this project. These dependencies are required to compile and run the application:
report.dependencies.column.groupId=GroupId
report.dependencies.column.artifactId=ArtifactId
report.dependencies.column.version=Version
report.mailing-lists.name=Mailing Lists
report.mailing-lists.nolist=There are no mailing lists currently associated with this project.
report.mailing-lists.title=Project Mailing Lists

View File

@ -1,3 +1,11 @@
report.dependencies.name=Dépendances
report.dependencies.nolist=Il n'y a aucune dépendance pour ce projet. C'est une application autonome qui ne dépend d'aucun autre projet.
report.dependencies.title=Dépendances du projet
report.dependencies.description=Ce document liste les dépendances du projet et fournit les informations sur chaque dépendance.
report.dependencies.intro= Ce qui suit est la liste de dépendances pour ce projet. Ces dépendances sont requises pour compiler et exécuter l'application :
report.dependencies.column.groupId=GroupId
report.dependencies.column.artifactId=ArtifactId
report.dependencies.column.version=Version
report.mailing-lists.name=Listes de diffusion
report.mailing-lists.nolist= Il n'y a aucune liste de diffusion actuellement liée à ce projet.
report.mailing-lists.title=Listes de diffusion du projet