Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maven-gettext-plugin missing sourceExtensions option #49

Closed
GoogleCodeExporter opened this issue Apr 15, 2015 · 6 comments
Closed

maven-gettext-plugin missing sourceExtensions option #49

GoogleCodeExporter opened this issue Apr 15, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

I needed to make the gettext plugin run on other extension than .java, so I 
added the sourceExtensions option to the GettextMojo.

Attached is a patch created on svn revision 214.

The sourceExtensions can be used as following in the pom configuration:
<build>
        <plugins>
            <plugin>
                <groupId>org.xnap.commons</groupId>
                <artifactId>maven-gettext-plugin</artifactId>
                <version>${gettext.version}</version>
                <configuration>
                    <targetBundle>com.upc.saleslayer.frontend.Messages</targetBundle>
                    <sourceDirectory>${project.build.sourceDirectory}/../</sourceDirectory>
                    <sourceLocale>${gettext.sourceLocale}</sourceLocale>
                    <sourceExtensions>
                        <param>java</param>
                        <param>ftl</param>
                    </sourceExtensions>
                    <keysFile>${gettext.keysFile}</keysFile>
                    <keywords>${gettext.keywords}</keywords>
                    <poDirectory>${gettext.poDirectory}</poDirectory>
                </configuration>
            </plugin>

When the sourceExtensions option is not configured in the POM, the java 
extension is added by default. When "java" is not set as extension, it will 
also be added to the sourceExtensions list by default. So "java" files are 
ALWAYS included in the gettext source list.

Hopefully this can be included in the next version of the maven-gettext-plugin.

Thanks

Original issue reported on code.google.com by pvdis...@gmail.com on 19 Jul 2010 at 3:19

Attachments:

@GoogleCodeExporter
Copy link
Author

BTW. the attached pom.xml patch changes the version of the plugin to 
1.2.1-tricode. This is purely so I can use the changed plugin directly in my 
project without conflicting with your version numbering. When you apply this 
patch, please update the version to 1.2.2 or something :) I'll then step back 
to the original versioning in my dependencies list.

Original comment by pvdis...@gmail.com on 20 Jul 2010 at 8:06

@GoogleCodeExporter
Copy link
Author

Thank you for your contribution!

What other types of files are you trying to internationalize?

The maven gettext plugin handles only Java files so far and more changes would 
be needed to support other languages which might also be also outside the scope 
of this project.

When xgettext is invoked from the maven plugin the parameter --language=Java is 
passed to it which tells it to expect java files as input. Also the output of 
the maven plugin are either properties files or Java classes which only make 
sense for Java.

Original comment by berge...@gmail.com on 27 Jul 2010 at 4:09

@GoogleCodeExporter
Copy link
Author

At the moment I'm using the gettext plugin to internationalize FreeMarker 
template files (it's based on JSP so at the end it's just Java :)). As long as 
the translation methods in the template engine are formed like normale Java 
method calls, it works. To get this working I wrote some viewHelper methods for 
FreeMarker, so now I just use ${_("text to be translated")} for singulars and 
${_p("got one", "got two or more", 3)} for plurals (with support for 
MessageFormat argument replacement). 

Original comment by pvdis...@gmail.com on 27 Jul 2010 at 5:29

@GoogleCodeExporter
Copy link
Author

Hi,

I just released version 1.2.3 of the maven-gettext-plugin that supports files 
with different file endings.

I went with using Maven's FileSet type for specifying extra files that should 
be parsed by xgettext. The optional extra argument is:

<extraSourceFiles>
       <directory>${basedir}</directory>
        <includes>
           <include>**/*.jsp</include>
         </includes>
         <excludes>
           <exclude>**/*.txt</exclude>
         </excludes>
</extraSourceFiles>

I hope this is useful.

Original comment by berge...@gmail.com on 26 Aug 2010 at 5:16

@GoogleCodeExporter
Copy link
Author

Original comment by berge...@gmail.com on 26 Aug 2010 at 5:17

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Perfect, thanks. I'll upgrade my dependencies to use your new version.

Original comment by pvdis...@gmail.com on 6 Sep 2010 at 11:22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant