Skip to content

Commit

Permalink
[MJAVADOC-803] Add default parameter to force root locale
Browse files Browse the repository at this point in the history
This closes #298
  • Loading branch information
michael-o committed Jul 13, 2024
1 parent 4904e08 commit d3afd39
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,17 @@ public abstract class AbstractJavadocMojo extends AbstractMojo {
@Parameter(defaultValue = "${project.build.outputTimestamp}")
protected String outputTimestamp;

/**
* Forces the Javadoc JVM locale to be {@link Locale#ROOT}. This will force the Javadoc output
* on {@code stdout} and {@code stderr} to be in English only and the generated HTML content in
* English as well. If you need the generated HTML content in another supported language use
* {@link #locale}.
*
* @since 3.7.1
*/
@Parameter(property = "forceRootLocale", defaultValue = "true")
private boolean forceRootLocale;

// ----------------------------------------------------------------------
// protected methods
// ----------------------------------------------------------------------
Expand Down Expand Up @@ -1937,6 +1948,11 @@ protected void executeReport(Locale unusedLocale) throws MavenReportException {
addMemoryArg(cmd, "-Xms", this.minmemory);
addProxyArg(cmd);

if (forceRootLocale) {
cmd.createArg().setValue("-J-Duser.language=");
cmd.createArg().setValue("-J-Duser.country=");
}

if (additionalJOption != null && !additionalJOption.isEmpty()) {
cmd.createArg().setValue(additionalJOption);
}
Expand Down

0 comments on commit d3afd39

Please sign in to comment.