[MNG-515]. Each language can have their own site descriptor (site.xml for default language, site_fr.xml for french menu)

Each i18n site must be under site directory:
src
  site
    apt <= default language
    xdoc
    fr
      apt <= french content
      xdoc

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@201584 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-06-24 09:06:47 +00:00
parent d430b422e0
commit c3665ae359
1 changed files with 30 additions and 7 deletions

View File

@ -233,7 +233,7 @@ public class DoxiaMojo
{
MavenReport report = (MavenReport) j.next();
getLog().info( "Generate " + report.getName( locale ) + " report." );
getLog().info( "Generate \"" + report.getName( locale ) + "\" report." );
report.setReportOutputDirectory( localeOutputDirectory );
@ -283,10 +283,24 @@ public class DoxiaMojo
}
// Generate static site
siteRenderer.render( new File( siteDirectory ), localeOutputDirectory,
getSiteDescriptor( reports, locale ), template, attributes );
siteRenderer.render( new File( generatedSiteDirectory ), localeOutputDirectory,
getSiteDescriptor( reports, locale ), template, attributes );
File siteDirectoryFile;
Locale firstLocale = (Locale) localesList.get( 0 );
if ( locale.equals( firstLocale ) )
{
siteDirectoryFile = new File( siteDirectory );
}
else
{
siteDirectoryFile = new File( siteDirectory, locale.getLanguage() );
}
siteRenderer.render( siteDirectoryFile, localeOutputDirectory,
getSiteDescriptor( reports, locale ), template, attributes, locale );
siteRenderer.render( siteDirectoryFile, localeOutputDirectory,
getSiteDescriptor( reports, locale ), template, attributes, locale );
File cssDirectory = new File( siteDirectory, "css" );
File imagesDirectory = new File( siteDirectory, "images" );
@ -400,12 +414,20 @@ public class DoxiaMojo
private InputStream getSiteDescriptor( List reports, Locale locale )
throws MojoExecutionException
{
File siteDescriptor = new File( siteDirectory, "site.xml" );
File siteDescriptor = new File( siteDirectory, "site_" + locale.getLanguage() + ".xml" );
String siteDescriptorContent = "";
try
{
if ( siteDescriptor.exists() )
{
siteDescriptorContent = FileUtils.fileRead( siteDescriptor );
}
else
{
siteDescriptor = new File( siteDirectory, "site.xml" );
if ( siteDescriptor.exists() )
{
siteDescriptorContent = FileUtils.fileRead( siteDescriptor );
@ -415,6 +437,7 @@ public class DoxiaMojo
siteDescriptorContent = IOUtil.toString( getClass().getResourceAsStream( "/default-site.xml" ) );
}
}
}
catch ( IOException e )
{
throw new MojoExecutionException( "The site descriptor cannot be read!", e );