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

allow general options #43

Open
GoogleCodeExporter opened this issue Apr 15, 2015 · 2 comments
Open

allow general options #43

GoogleCodeExporter opened this issue Apr 15, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

I’ve been using the maven plugin for some time and found it quite
useful. The point is that now I would need to pass a couple of
parameters to the xgettext application that are not included in the
configuration parameters, so I wonder if you’re thinking on adding any
way of doing that.

I modified the source code to fit my current needs but I find that
adding one more parameter that allows to pass more options to the GNU
applications would be a nice feature.

Something like the following would be great

<plugin>
   <groupId>org.xnap.commons</groupId>
   <artifactId>maven-gettext-plugin</artifactId>
   <version>1.2.0</version>
   <executions>
        <execution>
           <id>distribute-properties-files</id>
           <configuration>
                <poDirectory>src/main/po</poDirectory>
                <targetBundle>com.kinamik.vault.Messages</
targetBundle>
                <outputFormat>properties</outputFormat>
                <options>--no-location –add-comments=///</options>
           </configuration>
           <goals>
              <goal>dist</goal>
           </goals>
        </execution>
   </executions>
</plugin>



Original issue reported on code.google.com by berge...@gmail.com on 1 May 2010 at 1:54

@GoogleCodeExporter
Copy link
Author

That's already possible with the <keywords> configurations, I do this as 
following for my webapp with Freemarker templating:
<properties>
        <!-- Gettext -->
        <gettext.sourceLocale>en</gettext.sourceLocale>
        <gettext.keysFile>messages.pot</gettext.keysFile>
        <!--
        Add the keywords:
        _ = 1st param is singular form
        _p = plural, 1st param is singular, 2nd param is plural form
        _noop = 1st param is singular form, this one is a special-case
        @see http://www.gnu.org/software/gettext/manual/gettext.html#Special-cases
        Set extra options to the xgettext command (without the backslashes!):
        \-\-no-location = do not write '#: filename:line' lines in PO files
        \-\-add-comments[=TAG] = place comment block with TAG (or those preceding keyword lines) in PO file
        -->
        <gettext.keywords>-k_ -k_p:1,2 -k_noop --no-location --add-comments=///</gettext.keywords>
        <gettext.poDirectory>${project.build.resourceDirectory}/locale</gettext.poDirectory>
    </properties>

     <build>
        <plugins>
            <plugin>
                    <!-- http://code.google.com/p/gettext-commons/
                         http://gettext-commons.googlecode.com/svn/maven2-plugins-site/index.html
                    -->
                    <groupId>org.xnap.commons</groupId>
                    <artifactId>maven-gettext-plugin</artifactId>
                    <version>${gettext.version}</version>
                    <configuration>
                        <targetBundle>Messages</targetBundle>
                        <sourceDirectory>${project.basedir}/src</sourceDirectory>
                        <sourceLocale>${gettext.sourceLocale}</sourceLocale>
                        <extraSourceFiles>
                            <!-- Use build specific templates directory -->
                            <directory>${freemarker.templates.dir}</directory>
                            <includes>
                                <!-- Include FreeMarker templates -->
                                <include>**/*.ftl</include>
                            </includes>
                        </extraSourceFiles>
                        <keysFile>${gettext.keysFile}</keysFile>
                        <keywords>${gettext.keywords}</keywords>
                        <poDirectory>${gettext.poDirectory}</poDirectory>
                    </configuration>
                    <executions>
                        <execution>
                            <id>merge</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>merge</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>dist</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>dist</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
     </build>

Original comment by pvdis...@gmail.com on 24 Jan 2011 at 2:09

@GoogleCodeExporter
Copy link
Author

Awesome, this is helping me tremendously.

Would you be so kind to show some examples in your freemarker templates, 
ideally including a case with plural text? Much appreciated! 

Hank

Original comment by hankipa...@gmail.com on 29 Sep 2011 at 1:26

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