Skip to content

Commit

Permalink
HV-416 creating initial documentation module and moving docbook sourc…
Browse files Browse the repository at this point in the history
…es into new module
  • Loading branch information
hferentschik committed Nov 21, 2011
1 parent 3b2eb1b commit 66c1e78
Show file tree
Hide file tree
Showing 52 changed files with 278 additions and 78 deletions.
119 changes: 119 additions & 0 deletions hibernate-validator-documentation/pom.xml
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ Copyright (c) 2010, Red Hat, Inc. and/or its affiliates or third-party contributors as
~ indicated by the @author tags or express copyright attribution
~ statements applied by the authors. All third-party contributions are
~ distributed under license by Red Hat, Inc.
~
~ This copyrighted material is made available to anyone wishing to use, modify,
~ copy, or redistribute it subject to the terms and conditions of the GNU
~ Lesser General Public License, as published by the Free Software Foundation.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
~ for more details.
~
~ You should have received a copy of the GNU Lesser General Public License
~ along with this distribution; if not, write to:
~ Free Software Foundation, Inc.
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>hibernate-validator-parent</artifactId>
<groupId>org.hibernate</groupId>
<version>4.3.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>hibernate-validator-documentation</artifactId>
<packaging>jdocbook</packaging>

<name>Hibernate Validator Manual</name>
<description>The Hibernate Validator reference manual</description>

<properties>
<jdocbookSourceDirectory>${basedir}/src/main/docbook</jdocbookSourceDirectory>
<!-- Skip artifact deployment -->
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<configuration>
<sourceDirectory>${jdocbookSourceDirectory}</sourceDirectory>
<sourceDocumentName>master.xml</sourceDocumentName>
<masterTranslation>en-US</masterTranslation>
<translations>
<translation>zh-CN</translation>
</translations>
<imageResource>
<directory>${basedir}/src/main/docbook/en-US/images</directory>
</imageResource>
<formats>
<format>
<formatName>pdf</formatName>
<stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/pdf.xsl
</stylesheetResource>
<finalName>hibernate_validator_reference.pdf</finalName>
</format>
<format>
<formatName>html_single</formatName>
<stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-single.xsl
</stylesheetResource>
<finalName>index.html</finalName>
</format>
<format>
<formatName>html</formatName>
<stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml.xsl
</stylesheetResource>
<finalName>index.html</finalName>
</format>
</formats>
<options>
<xincludeSupported>true</xincludeSupported>
<xmlTransformerType>saxon</xmlTransformerType>
<!-- needed for uri-resolvers; can be ommitted if using 'current' uri scheme -->
<!-- could also locate the docbook dependency and inspect its version... -->
<docbookVersion>1.72.0</docbookVersion>
<localeSeparator>-</localeSeparator>
</options>
<profiling>
<enabled>true</enabled>
</profiling>
</configuration>
<executions>
<execution>
<!--
here we are attaching the translate goal so that the translations are processed
before compilation so that the translated XML is also transformed during
generation
-->
<phase>process-resources</phase>
<goals>
<goal>translate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.zanata</groupId>
<artifactId>zanata-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<srcDir>${basedir}/src/main/docbook</srcDir>
<srcDirPot>${basedir}/src/main/docbook/pot</srcDirPot>
</configuration>
</plugin>
</plugins>
</build>
</project>
117 changes: 117 additions & 0 deletions hibernate-validator-documentation/zanata.sh
@@ -0,0 +1,117 @@
#!/bin/sh

# zanata.sh
#
# Script for pushing and pulling translation files to and from Zanata server

set -eu

push ( )
{
PUSH_PO_FILES=0
while getopts "a" option
do
case $option in
a ) PUSH_PO_FILES=1;;
* ) usage;;
esac
done

# update pot files before importing to zanata
echo "Updating POT files"
mvn jdocbook:update-pot
if [ $PUSH_PO_FILES -gt 0 ]; then
echo "Updating PO files"
mvn jdocbook:update-po
fi

# push updated pot files to zanata for translation
echo "Pushing updated POT files to Zanata for translation"
PUSH_OPTION=""
if [ $PUSH_PO_FILES -gt 0 ]; then
PUSH_OPTION="-Dzanata.importPo"
fi
mvn zanata:publican-push $PUSH_OPTION -e

echo "Finished! You may want to check pot into version control to track the updated POT files"
}

pull ( )
{
echo "Pulling latest translations from Zanata server"
mvn zanata:publican-pull -e -Dzanata.dstDir=src/main/docbook
echo "Finished! Don't forget to check locale dirs into version control to record the updated PO files"
}

draft ( )
{
DRAFT_DIR="target/draft"
while getopts "d:" option
do
case $option in
d ) DRAFT_DIR=$OPTARG;;
* ) usage;;
esac
done

# PO files are saved to a directory outside the locale dirs
# to avoid overwriting versioned files.

mkdir -p $DRAFT_DIR

echo "Pulling latest translations from Zanata server"
# write PO files to a different directory under target
mvn zanata:publican-pull -e -Dzanata.dstDir=$DRAFT_DIR

# draft build the translated documents

# copy en-US source to draft dir for use by jDocBook
cp -a ./src/main/docbook/en-US $DRAFT_DIR/en-US

echo "Building translated documentation with jDocBook"

# pick up PO files from the different directory above
mvn jdocbook:resources jdocbook:translate jdocbook:generate -DjdocbookSourceDirectory=$DRAFT_DIR

echo "Finished!"
}

usage ( )
{
echo "Usage: `basename $0` <command> [<cmd-options>]"
echo "where <command> is one of:"
echo " push : Import updated source content from git to Zanata."
echo " [-a] Update and push translations as well"
echo " pull : Export translations from Zanata to git"
echo " draft : Build DocBook document using latest translations"
echo " [-d draftdir] Directory in which to build the draft documentation"
exit $E_OPTERROR
}

NO_ARGS=0
E_OPTERROR=85

if [ $# -eq "$NO_ARGS" ] # Script invoked with no command-line args?
then
usage
fi

command=$1
shift

case $command in
"push" ) if [ $# -eq "$NO_ARGS" ]
then
push
else
push "${@}"
fi;;
"pull" ) pull;;
"draft" ) if [ $# -eq "$NO_ARGS" ]
then
draft
else
draft "${@}"
fi;;
* ) usage;;
esac
17 changes: 17 additions & 0 deletions hibernate-validator-documentation/zanata.xml
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://zanata.org/namespace/config/">
<url>https://translate.jboss.org/</url>
<project>hibernate_search</project>
<project-version>4.2.0</project-version>
<locales>
<locale map-from="de-DE">de</locale>
<locale map-from="es-ES">es</locale>
<locale map-from="fr-FR">fr</locale>
<locale map-from="it-IT">it</locale>
<locale map-from="ja-JP">ja</locale>
<locale map-from="ko-KR">ko</locale>
<locale>pt-BR</locale>
<locale map-from="zh-CN">zh-Hans</locale>
<locale map-from="zh-TW">zh-Hant</locale>
</locales>
</config>
73 changes: 1 addition & 72 deletions hibernate-validator/pom.xml
Expand Up @@ -264,78 +264,7 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jdocbook-style</artifactId>
<version>2.0.1</version>
<type>jdocbook-style</type>
</dependency>
</dependencies>
<configuration>
<sourceDocumentName>master.xml</sourceDocumentName>
<sourceDirectory>${basedir}/src/main/docbook</sourceDirectory>
<masterTranslation>en-US</masterTranslation>
<translations>
<translation>zh-CN</translation>
</translations>
<!--
The jdookbook plug-in doesn't define an expression for this property, therefore
it can't be passed on the command line. To address this issue the value is retrieved
from a custom property, which itself can be set using -DignoreTranslations=...
-->
<ignoreTranslations>${jdocbook.ignoreTranslations}</ignoreTranslations>
<imageResource>
<directory>${basedir}/src/main/docbook/en-US/images</directory>
</imageResource>
<formats>
<format>
<formatName>pdf</formatName>
<stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/pdf.xsl</stylesheetResource>
<finalName>hibernate_validator_reference.pdf</finalName>
</format>
<format>
<formatName>html_single</formatName>
<stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-single.xsl
</stylesheetResource>
<finalName>index.html</finalName>
</format>
<format>
<formatName>html</formatName>
<stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml.xsl
</stylesheetResource>
<finalName>index.html</finalName>
</format>
</formats>
<options>
<xincludeSupported>true</xincludeSupported>
<xmlTransformerType>saxon</xmlTransformerType>
<!-- needed for uri-resolvers; can be omitted if using 'current' uri scheme -->
<!-- could also locate the docbook dependency and inspect its version... -->
<docbookVersion>1.72.0</docbookVersion>
<localeSeparator>-</localeSeparator>
</options>
<profiling>
<enabled>true</enabled>
</profiling>
</configuration>
<executions>
<execution>
<id>make-doc</id>
<phase>deploy</phase>
<goals>
<goal>resources</goal>
<goal>translate</goal>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-style-plugin</artifactId>
</plugin>
Expand Down
30 changes: 24 additions & 6 deletions pom.xml
Expand Up @@ -340,12 +340,16 @@
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<version>2.2.3</version>
</plugin>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-style-plugin</artifactId>
<version>2.0.0</version>
<version>2.3.5</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jdocbook-style</artifactId>
<version>2.0.1</version>
<type>jdocbook-style</type>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -476,4 +480,18 @@
</pluginRepository>
</pluginRepositories>

<profiles>
<profile>
<id>docs</id>
<activation>
<property>
<name>disableDocumentationBuild</name>
<value>!true</value>
</property>
</activation>
<modules>
<module>hibernate-validator-documentation</module>
</modules>
</profile>
</profiles>
</project>

0 comments on commit 66c1e78

Please sign in to comment.