mirror of https://github.com/apache/maven.git
[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:
parent
d430b422e0
commit
c3665ae359
|
@ -233,7 +233,7 @@ public class DoxiaMojo
|
||||||
{
|
{
|
||||||
MavenReport report = (MavenReport) j.next();
|
MavenReport report = (MavenReport) j.next();
|
||||||
|
|
||||||
getLog().info( "Generate " + report.getName( locale ) + " report." );
|
getLog().info( "Generate \"" + report.getName( locale ) + "\" report." );
|
||||||
|
|
||||||
report.setReportOutputDirectory( localeOutputDirectory );
|
report.setReportOutputDirectory( localeOutputDirectory );
|
||||||
|
|
||||||
|
@ -283,10 +283,24 @@ public class DoxiaMojo
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate static site
|
// Generate static site
|
||||||
siteRenderer.render( new File( siteDirectory ), localeOutputDirectory,
|
File siteDirectoryFile;
|
||||||
getSiteDescriptor( reports, locale ), template, attributes );
|
|
||||||
siteRenderer.render( new File( generatedSiteDirectory ), localeOutputDirectory,
|
Locale firstLocale = (Locale) localesList.get( 0 );
|
||||||
getSiteDescriptor( reports, locale ), template, attributes );
|
|
||||||
|
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 cssDirectory = new File( siteDirectory, "css" );
|
||||||
File imagesDirectory = new File( siteDirectory, "images" );
|
File imagesDirectory = new File( siteDirectory, "images" );
|
||||||
|
@ -400,7 +414,7 @@ public class DoxiaMojo
|
||||||
private InputStream getSiteDescriptor( List reports, Locale locale )
|
private InputStream getSiteDescriptor( List reports, Locale locale )
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
File siteDescriptor = new File( siteDirectory, "site.xml" );
|
File siteDescriptor = new File( siteDirectory, "site_" + locale.getLanguage() + ".xml" );
|
||||||
|
|
||||||
String siteDescriptorContent = "";
|
String siteDescriptorContent = "";
|
||||||
|
|
||||||
|
@ -412,7 +426,16 @@ public class DoxiaMojo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
siteDescriptorContent = IOUtil.toString( getClass().getResourceAsStream( "/default-site.xml" ) );
|
siteDescriptor = new File( siteDirectory, "site.xml" );
|
||||||
|
|
||||||
|
if ( siteDescriptor.exists() )
|
||||||
|
{
|
||||||
|
siteDescriptorContent = FileUtils.fileRead( siteDescriptor );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
siteDescriptorContent = IOUtil.toString( getClass().getResourceAsStream( "/default-site.xml" ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
|
|
Loading…
Reference in New Issue