Commits

Sean Flanigan committed 2dea711

add sample scripts from weld ref guide

  • Participants
  • Parent commits 530181e

Comments (0)

Files changed (7)

client/zanata-maven-plugin/sample-scripts/README-scripts.md

+Guide to Translation Build Scripts
+==================================
+
+
+Translation Workflow
+--------------------
+
+1. Author modifies documentation, checks in DocBook XML source.
+2. At some point in the lifecycle, a documentation freeze is announced.
+3. Import job is run (eg from Hudson/Jenkins).  (See script 2 below: `zanata_import_source`.)
+4. Translators can begin translating at <https://translate.jboss.org/>.
+5. Draft builds are run nightly or more often (Jenkins?).  (See script 3 below: `zanata_draft_build`)
+6. If author changes any XML, go back to step 3.
+7. Translations declared "final"
+8. Documentation release build is run.  (See script 4 below: `zanata_export_translations`)
+
+
+
+Configuration for build machine
+-------------------------------
+Create the file `~/.config/zanata.ini` like this:
+
+<pre>
+[servers]
+jboss.url = https://translate.jboss.org/
+jboss.username = your_jboss_username
+jboss.key = your_API_key_from_Flies_Profile_page
+</pre>
+
+NB: Your key can be obtained by logging in to [Zanata](https://translate.jboss.org/), 
+visiting the [Profile page](https://translate.jboss.org/profile/view) and 
+clicking "generate API key" at the bottom.
+
+The Scripts
+-----------
+
+1. Initial Import (run once only, when first integrating with Zanata):  
+ This script will update the POT (source) and PO (translation) files 
+ under `.` from the DocBook XML, and push the content 
+ to Zanata for translation.  
+ `etc/scripts/zanata_import_all`  
+ `svn add .; svn ci`  
+
+2. Import job (run after documentation freeze):  
+ This script will update the POT files in `pot` and
+ push them to Zanata for translation.  
+ `etc/scripts/zanata_import_source`
+
+3. Build docs with latest translations (probably run nightly):  
+ This script will fetch the latest translations to temporary files 
+ in `target/draft` and build the documentation for review purposes.  
+ `etc/scripts/zanata_draft_build`
+
+4. Documentation release build:  
+ This script will fetch the latest translations so that the release 
+ build can be run.  
+ `etc/scripts/zanata_export_translations`  
+ `svn add .; svn ci`  
+ _run existing ant build_
+
+

client/zanata-maven-plugin/sample-scripts/etc/scripts/zanata_draft_build

+#!/bin/sh
+set -eu
+
+# Build DocBook document using latest (draft) translations
+
+# PO files are saved to a directory outside the locale dirs
+# to avoid overwriting versioned files.
+
+draft_dir=target/draft
+mkdir -p $draft_dir
+
+echo "Pulling latest translations from Flies server"
+# write PO files to a different directory under target
+mvn flies:publican-pull -e -Dflies.dstDir=$draft_dir
+
+# draft build the translated documents
+# (alternative: run Ant from weld/build/dist)
+
+# copy en-US source to draft dir for use by jDocBook
+cp -a ./en-US $draft_dir/en-US
+
+echo "Building translated documentation with jDocBook"
+
+# pick up PO files from the different directory above
+mvn compile -Ptranslations -DjdocbookSourceDirectory=$draft_dir
+
+echo "Finished! You may need to overwrite pot and locale dirs from version control"

client/zanata-maven-plugin/sample-scripts/etc/scripts/zanata_export_translations

+#!/bin/sh
+set -eu
+
+# Export translations from flies to git (eg before a release)
+
+# pull latest translations into po files
+echo "Pulling latest translations from Flies server"
+mvn flies:publican-pull -e
+
+echo "Finished! Don't forget to check locale dirs into version control to record the updated PO files"

client/zanata-maven-plugin/sample-scripts/etc/scripts/zanata_import_all

+#!/bin/sh
+set -eu
+
+# Initial import (used when first setting up project in Flies)
+
+# update pot and po files before importing to flies
+echo "Updating POT and PO files from DocBook XML"
+publican update_pot
+publican update_po --langs=all
+
+# push initial po and pot files to flies for translation
+echo "Note: this script should only be run against a new, empty Flies project version!"
+echo "Use the script flies_import_source for normal updates."
+echo
+echo "Pushing to Flies server."
+mvn flies:publican-push -Dflies.importPo -e
+
+echo "Finished!  You may want to check pot and locale dirs into version control to track the updated POT/PO files"

client/zanata-maven-plugin/sample-scripts/etc/scripts/zanata_import_source

+#!/bin/sh
+set -eu
+
+# Import updated source content from git to Flies (possibly run nightly)
+
+# update pot files before importing to flies
+echo "Updating POT files"
+publican update_pot
+
+# push updated pot files to flies for translation
+echo "Pushing updated POT files to Flies for translation"
+mvn flies:publican-push -e -B
+
+# optional: push pot files back to VCS (probably best avoided for nightly jobs)
+echo "Finished!  You may want to check pot into version control to track the updated POT files"

client/zanata-maven-plugin/sample-scripts/pom.xml

+<project>
+   <modelVersion>4.0.0</modelVersion>
+   <groupId>null</groupId>
+   <artifactId>null</artifactId>
+   <version>0</version>
+   
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.zanata</groupId>
+            <artifactId>zanata-maven-plugin</artifactId>
+            <version>1.3-alpha-1</version>
+            <configuration>
+               <srcDir>.</srcDir>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+   <!-- NB: this is not needed if you have the jboss 'public' repository group enabled -->
+   <pluginRepositories>
+      <pluginRepository>
+         <id>openl10n-public-repository-group</id>
+         <name>OpenL10n Public Repository Group</name>
+         <url>http://nexus.openl10n.net/content/groups/public</url>
+         <releases>
+            <enabled>true</enabled>
+         </releases>
+         <snapshots>
+            <enabled>true</enabled>
+         </snapshots>
+      </pluginRepository>
+   </pluginRepositories>
+</project>

client/zanata-maven-plugin/sample-scripts/zanata.xml

+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<config xmlns="http://flies.openl10n.net/config/v1/">
+      <url>https://translate.jboss.org/</url>
+      <project>example-project</project>
+      <project-version>1.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>