public abstract class AbstractI18nMojo
extends org.nuiton.plugin.AbstractPlugin
implements org.nuiton.plugin.PluginWithEncoding
| Modifier and Type | Field and Description |
|---|---|
protected String |
artifactId
Name to use as prefix of generated files.
|
protected String |
bundles
Locales to treate, separated by comma.
|
protected String |
encoding
Encoding used to load and store properties.
|
protected boolean |
genSrc
To update generated files to user i18n files.
|
protected Locale[] |
locales
locales to process
|
protected File |
out
Directory where to generate i18n files.
|
protected org.apache.maven.project.MavenProject |
project
Dependance du projet.
|
protected boolean |
silent
Silent flag to see only errors in console.
|
protected File |
src
Directory where to find project i18n files.
|
protected boolean |
strictMode
Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys.
|
protected boolean |
verbose
Verbose flag.
|
| Constructor and Description |
|---|
AbstractI18nMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addGetter()
Prend en compte qu'un getter a été détecté.
|
protected void |
backupFile(File f) |
protected void |
checkBundle(Locale locale,
Properties propertiesOut,
boolean showEmpty,
Map<Locale,SortedSet<String>> unsafeHolder) |
protected boolean |
checkPackaging() |
String |
getArtifactId() |
File |
getBackupFile(File file) |
String |
getEncoding() |
File |
getGetterFile(File root,
String getter,
boolean create) |
File |
getI18nFile(File root,
String artifactId,
Locale locale,
boolean create) |
org.apache.maven.project.MavenProject |
getProject() |
void |
init() |
boolean |
isSilent() |
boolean |
isStrictMode() |
boolean |
isVerbose() |
protected boolean |
needGeneration() |
void |
setEncoding(String encoding) |
void |
setProject(org.apache.maven.project.MavenProject project) |
void |
setVerbose(boolean verbose) |
acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addUrlToUrlsList, afterExecute, checkEncoding, checkResource, checkRunOnceDone, checkSkip, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, doAction, execute, getFileFromBasedir, getFilesToTreate, getFilesToTreateForRoots, getRootProject, getTemplate, hasClassPath, initClassLoader, isExecutionRoot, isFileNewerThanPomFile, needInvoke, needInvoke, rejectPackaging, removeCompileSourceRoots, removeTestCompileSourceRoots, renameFile, writeFilegetLog, getPluginContext, setLog, setPluginContext@Component protected org.apache.maven.project.MavenProject project
@Parameter(property="i18n.artifactId",
defaultValue="${project.artifactId}",
readonly=true)
protected String artifactId
@Parameter(property="i18n.bundles",
defaultValue="fr_FR,en_GB",
required=true)
protected String bundles
fr_FR,en_GB
@Parameter(property="i18n.src",
defaultValue="${basedir}/src/main/resources/i18n",
required=true)
protected File src
@Parameter(property="i18n.out",
defaultValue="${basedir}/target/generated-sources/i18n",
required=true)
protected File out
@Parameter(property="i18n.encoding",
defaultValue="${project.build.sourceEncoding}",
required=true)
protected String encoding
@Parameter(property="i18n.genSrc",
defaultValue="true")
protected boolean genSrc
@Parameter(property="i18n.verbose",
defaultValue="${maven.verbose}")
protected boolean verbose
maven.verbose property.@Parameter(property="i18n.silent",
defaultValue="false")
protected boolean silent
@Parameter(property="i18n.strictMode",
defaultValue="false")
protected boolean strictMode
protected Locale[] locales
protected boolean checkPackaging()
checkPackaging in class org.nuiton.plugin.AbstractPluginpublic void init()
throws Exception
init in class org.nuiton.plugin.AbstractPluginExceptionpublic String getArtifactId()
protected boolean needGeneration()
true si des getters ont etes enregistres pendant le
cycle de vie, false sinon.protected void addGetter()
public File getI18nFile(File root, String artifactId, Locale locale, boolean create) throws IOException
root - le repertoire ou sont stockes les fichiers i18nartifactId - le nom de l'artifactlocale - le nom de la locale (peut-être nulle)create - true pour creer le fichier si non presentIOException - si probleme lors de la creation du fichierpublic File getGetterFile(File root, String getter, boolean create) throws IOException
root - le repertoire ou sont stockes les fichiers gettergetter - le nom du gettercreate - true pour creer le fichier si non presentIOException - si probleme lors de la creation du fichierprotected void checkBundle(Locale locale, Properties propertiesOut, boolean showEmpty, Map<Locale,SortedSet<String>> unsafeHolder)
public File getBackupFile(File file)
getBackupFile in class org.nuiton.plugin.AbstractPluginprotected void backupFile(File f) throws IOException
backupFile in class org.nuiton.plugin.AbstractPluginIOExceptionpublic org.apache.maven.project.MavenProject getProject()
getProject in interface org.nuiton.plugin.Pluginpublic void setProject(org.apache.maven.project.MavenProject project)
setProject in interface org.nuiton.plugin.Pluginpublic boolean isVerbose()
isVerbose in interface org.nuiton.plugin.Pluginpublic void setVerbose(boolean verbose)
setVerbose in interface org.nuiton.plugin.Pluginpublic boolean isSilent()
public boolean isStrictMode()
public String getEncoding()
getEncoding in interface org.nuiton.plugin.PluginWithEncodingpublic void setEncoding(String encoding)
setEncoding in interface org.nuiton.plugin.PluginWithEncodingCopyright © 2007–2014 CodeLutin. All rights reserved.