postgresql-jdbc.git / summary / log / commit / refs

commit    e2fa9ecfd289acde98cba768e008088838cd9c6e
Author:   Crunchy Builder <john.harvey@crunchydata.com>
Commit:   Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
Date:     Tue Dec 29 19:32:17 2015 +0000

    chore: rework update-translations.sh into pom file as a profile
    
    Closes #479


README.md | 17 +++++++++++ pgjdbc/pom.xml | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++ update-translations.sh | 14 --------- 3 files changed, 97 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3f34e619..adb890cc 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,10 @@ In order to build the source code for PgJDBC you will need the following tools: - A JDK for the JDBC version you'd like to build (JDK6 for JDBC 4, JDK7 for JDBC 4.1 or JDK8 for JDBC 4.2) - A running PostgreSQL instance +Additionally, in order to update translations (not typical), you will need the following additional tools: + +- the gettext package, which contains the commands "msgfmt", "msgmerge", and "xgettext" + ## Checking out the source code The PgJDBC project uses git for version control. You can check out the current code by running: @@ -162,6 +166,19 @@ Here's sample configuration for Mac OS: </toolchains> ``` +## Updating translations + +From time to time, the translation packages will need to be updated as part of the build process. +However, this is atypical, and is generally only done when needed such as by a project committer before a major release. +This process adds additional compile time and generally should not be executed for every build. + +Updating translations can be accomplished with the following command: + + mvn -Ptranslate compile && git add pgjdbc && git commit -m "Translations updated" + +Note that the maven profile "translate" can safely be called with other profiles, such as -P release-artifacts. +Invocation of this command will generate new .po files, a new messages.pot file, and newly translated class files. + ## Releasing a snapshot version TravisCI automatically deploys snapshots for each commit to master branch. diff --git a/pgjdbc/pom.xml b/pgjdbc/pom.xml index d25333b6..6ec48d82 100644 --- a/pgjdbc/pom.xml +++ b/pgjdbc/pom.xml @@ -37,6 +37,86 @@ <skip.assembly>false</skip.assembly> </properties> + <profiles> + <profile> + <id>translate</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <build> + <plugins> + <plugin> + <groupId>com.googlecode.gettext-commons</groupId> + <artifactId>gettext-maven-plugin</artifactId> + <version>1.2.4</version> + <executions> + <execution> + <id>generate_pot_and_po_files</id> + <phase>generate-resources</phase> + <goals> + <goal>merge</goal> + </goals> + <configuration> + <outputDirectory>src/main/resources</outputDirectory> + </configuration> + </execution> + <execution> + <id>generate_resource_bundles</id> + <phase>generate-resources</phase> + <goals> + <goal>dist</goal> + </goals> + </execution> + </executions> + <configuration> + <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> + <outputDirectory>src/main/resources</outputDirectory> + <keysFile>messages.pot</keysFile> + <poDirectory>src/main/java/org/postgresql/translation</poDirectory> + <targetBundle>org.postgresql.translation.messages</targetBundle> + <keywords>-kGT.tr</keywords> + <msgmergeCmd>msgmerge</msgmergeCmd> + </configuration> + </plugin> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <executions> + <execution> + <id>clean_msmerge_backups</id> + <goals> + <goal>clean</goal> + </goals> + <phase>compile</phase> + <configuration> + <!-- Do not delete target folder --> + <excludeDefaultDirectories>true</excludeDefaultDirectories> + <filesets> + <fileset> + <directory>src/main/resources/org/postgresql/translation</directory> + <includes> + <include>**$*.class</include> + <include>messages.properties</include> + <include>messages_en.properties</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>src/main/java/org/postgresql/translation</directory> + <includes> + <include>*.po.~*~</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + </filesets> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + <build> <plugins> <plugin> diff --git a/update-translations.sh b/update-translations.sh deleted file mode 100755 index ea0ca1d2..00000000 --- a/update-translations.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# - -mvn clean -find . -name '*.java' -o -name '*.java.in' > translation.filelist -xgettext -k -kGT.tr -F -f translation.filelist -L Java -o src/main/resources/org/postgresql/translation/messages.pot --from-code=utf-8 -rm translation.filelist - -for i in src/main/java/org/postgresql/translation/*.po -do - msgmerge --backup=none -U $i src/main/resources/org/postgresql/translation/messages.pot - polang=`basename $i .po` - msgfmt -j -l $polang -r org.postgresql.translation.messages -d src/main/resources $i -done [parent: e52f7e3d08b4]