Class GettextMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="gettext",
          defaultPhase=GENERATE_RESOURCES)
    public class GettextMojo
    extends AbstractGettextMojo
    Invokes xgettext to extract messages from source code and store them in the keys.pot file.
    • Constructor Summary

      Constructors 
      Constructor Description
      GettextMojo()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.io.File createListFile​(java.lang.String[] files, java.util.List<java.lang.String> fileList)  
      void execute()  
      private java.lang.String getAbsolutePath​(java.lang.String path)  
      private java.lang.String toUnixPath​(java.lang.String path)  
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • encoding

        @Parameter(defaultValue="utf-8",
                   required=true)
        protected java.lang.String encoding
        The encoding of the source Java files. utf-8 is a superset of ascii.
      • keywords

        @Parameter(defaultValue="-k_ -k_n1,2",
                   required=true)
        protected java.lang.String keywords
        The keywords the xgettext parser will look for to extract messages. The default value works with libraries that use the _-format method, as recommended by Gettext documentation.
      • xgettextCmd

        @Parameter(defaultValue="xgettext",
                   required=true)
        protected java.lang.String xgettextCmd
        The xgettext command.
      • extraSourceFiles

        @Parameter
        protected org.apache.maven.model.FileSet extraSourceFiles
        An optional set of source files that should be parsed with xgettext.
         
         <extraSourceFiles>
           <directory>${basedir}</directory>
           <includes>
              <include>** /*.jsp</include>
            </includes>
            <excludes>
              <exclude>** /*.txt</exclude>
            </excludes>
         </extraSourceFiles>
         
         
      • omitHeader

        @Parameter(defaultValue="false")
        protected boolean omitHeader
      • joinExisting

        @Parameter(defaultValue="false")
        protected boolean joinExisting
      • copyrightHolder

        @Parameter(property="project.organisation.name")
        protected java.lang.String copyrightHolder
        Set the copyright holder in the output. string should be the copyright holder of the surrounding package. (Note that the msgstr strings, extracted from the package's sources, belong to the copyright holder of the package.) Translators are expected to transfer or disclaim the copyright for their translations, so that package maintainers can distribute them without legal risk. If string is empty, the output files are marked as being in the public domain; in this case, the translators are expected to disclaim their copyright, again so that package maintainers can distribute them without legal risk. The default value for string is the '' so public domain.
      • packageName

        @Parameter(property="project.build.finalName")
        protected java.lang.String packageName
        Set the package name in the header of the output.
      • packageVersion

        @Parameter(property="project.version")
        protected java.lang.String packageVersion
        Set the package version in the header of the output. This option has an effect only if the 'packageName' option is also used.
      • sort

        @Parameter(defaultValue="FALSE")
        protected Sort sort
        Set if the output should be sorted.
      • msgidBugsAddress

        @Parameter
        protected java.lang.String msgidBugsAddress
        Set the reporting address for msgid bugs. This is the email address or URL to which the translators shall report bugs in the untranslated strings: - Strings which are not entire sentences; see the maintainer guidelines in Preparing Strings. - Strings which use unclear terms or require additional context to be understood. - Strings which make invalid assumptions about notation of date, time or money. - Pluralisation problems. - Incorrect English spelling. - Incorrect formatting. It can be your email address, or a mailing list address where translators can write to without being subscribed, or the URL of a web page through which the translators can contact you. The default value is empty, which means that translators will be clueless! Don't forget to specify this option.
    • Constructor Detail

      • GettextMojo

        public GettextMojo()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • createListFile

        private java.io.File createListFile​(java.lang.String[] files,
                                            java.util.List<java.lang.String> fileList)
      • getAbsolutePath

        private java.lang.String getAbsolutePath​(java.lang.String path)
      • toUnixPath

        private java.lang.String toUnixPath​(java.lang.String path)