i18n:generateI18nEnumHelper

Full name:

org.nuiton.i18n:i18n-maven-plugin:4.1:generateI18nEnumHelper

Description:

Generate a i18n enum class helper. Created on 28/08/16.

Attributes:

  • Requires a Maven project to be executed.
  • The goal is not marked as thread-safe and thus does not support parallel builds.
  • Since version: 3.6.
  • Binds by default to the lifecycle phase: generate-sources.

Required Parameters

Name Type Since Description
<bundles> String 3.6 Locales to treate, separated by comma. Example :
fr_FR,en_GB

Default value is: fr_FR,en_GB.
User property is: i18n.bundles.
<className> String 3.6 Name of the generated class.
Default value is: I18nEnumHelper.
User property is: i18n.className.
<encoding> String 3.6 Encoding used to load and store properties.
Default value is: ${project.build.sourceEncoding}.
User property is: i18n.encoding.
<enumerationSets> List 3.6 List of enumerations set to scan to generate i18n keys.
    <enumerationSets>
      <enumerationSet>
        <name>label</name>
        <pattern>myPrefix.@CLASS_NAME@.@NAME@</pattern>
        <enums>
          <org.nuiton.Enum1>
          <org.nuiton.Enum2>
          <...>
        </enums>
      </enumerationSet>
    </enumerationSets>
Example with enum enum org.nuiton.Enum1 { A,B }, will generate i18n keys:
  • myPrefix.org.nuiton.Enum1.A
  • myPrefix.org.nuiton.Enum1.B
In pattern, you can use variable
  • @CLASS_NAME@ for enumeration class fully qualified name
  • @CLASS_SIMPLE_NAME@ for enumeration class simple name
  • @NAME@ for enumeration name
  • @ORDINAL@ for enumeration ordinal
Moreover, two methods will be also generated according to specified name to translate those keys :
    public static String getLabel(Enum)
    public static String getLabel(Locale, Enum)

<outputdirectory> File 3.6 The root directory where to generated.
Default value is: ${basedir}/target/generated-sources/java.
User property is: i18n.outputdirectory.

Optional Parameters

Name Type Since Description
<packageName> String 3.6 To set the package fully qualified name of the generated class. By default, will use groupId.artifactId (with - replaced by .).
User property is: i18n.packageName.
<silent> boolean 1.0.0-rc-5 Silent flag to see only errors in console.
Default value is: false.
User property is: i18n.silent.
<verbose> boolean 3.6 Verbose flag. Note : if not setted, we used the maven.verbose property.
Default value is: ${maven.verbose}.
User property is: i18n.verbose.

Parameter Details

<bundles>

Locales to treate, separated by comma. Example :
fr_FR,en_GB
  • Type: java.lang.String
  • Since: 3.6
  • Required: Yes
  • User Property: i18n.bundles
  • Default: fr_FR,en_GB

<className>

Name of the generated class.
  • Type: java.lang.String
  • Since: 3.6
  • Required: Yes
  • User Property: i18n.className
  • Default: I18nEnumHelper

<encoding>

Encoding used to load and store properties.
  • Type: java.lang.String
  • Since: 3.6
  • Required: Yes
  • User Property: i18n.encoding
  • Default: ${project.build.sourceEncoding}

<enumerationSets>

List of enumerations set to scan to generate i18n keys.
    <enumerationSets>
      <enumerationSet>
        <name>label</name>
        <pattern>myPrefix.@CLASS_NAME@.@NAME@</pattern>
        <enums>
          <org.nuiton.Enum1>
          <org.nuiton.Enum2>
          <...>
        </enums>
      </enumerationSet>
    </enumerationSets>
Example with enum enum org.nuiton.Enum1 { A,B }, will generate i18n keys:
  • myPrefix.org.nuiton.Enum1.A
  • myPrefix.org.nuiton.Enum1.B
In pattern, you can use variable
  • @CLASS_NAME@ for enumeration class fully qualified name
  • @CLASS_SIMPLE_NAME@ for enumeration class simple name
  • @NAME@ for enumeration name
  • @ORDINAL@ for enumeration ordinal
Moreover, two methods will be also generated according to specified name to translate those keys :
    public static String getLabel(Enum)
    public static String getLabel(Locale, Enum)
  • Type: java.util.List
  • Since: 3.6
  • Required: Yes

<outputdirectory>

The root directory where to generated.
  • Type: java.io.File
  • Since: 3.6
  • Required: Yes
  • User Property: i18n.outputdirectory
  • Default: ${basedir}/target/generated-sources/java

<packageName>

To set the package fully qualified name of the generated class. By default, will use groupId.artifactId (with - replaced by .).
  • Type: java.lang.String
  • Since: 3.6
  • Required: No
  • User Property: i18n.packageName

<silent>

Silent flag to see only errors in console.
  • Type: boolean
  • Since: 1.0.0-rc-5
  • Required: No
  • User Property: i18n.silent
  • Default: false

<verbose>

Verbose flag. Note : if not setted, we used the maven.verbose property.
  • Type: boolean
  • Since: 3.6
  • Required: No
  • User Property: i18n.verbose
  • Default: ${maven.verbose}