Some support for Zanata translations.
authorCarl Hetherington <cth@carlh.net>
Fri, 12 Jun 2015 09:31:20 +0000 (10:31 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 12 Jun 2015 09:31:20 +0000 (10:31 +0100)
.gitignore
hacks/zanata_upload.sh [new file with mode: 0644]
wscript
zanata.xml [new file with mode: 0644]

index 6be4e4c..96a8eb7 100644 (file)
@@ -31,3 +31,4 @@ GSYMS
 GTAGS
 TAGS
 .*.swp
+.zanata-cache
diff --git a/hacks/zanata_upload.sh b/hacks/zanata_upload.sh
new file mode 100644 (file)
index 0000000..c67f189
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+ZANATA=/opt/zanata-cli-3.6.0/bin/zanata-cli
+dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+tmp=/tmp/zanata.$$
+cd $dir/..
+./waf pot
+mkdir -p $tmp/source $tmp/translated
+cp build/src/lib/*.pot build/src/wx/*.pot build/src/tools/*.pot $tmp/source
+for f in src/lib/po/*.po; do
+  cp $f $tmp/translated/lib_$f
+done
+for f in src/wx/po/*.po; do
+  cp $f $tmp/translated/wx_$f
+done
+for f in src/tools/po/*.po; do
+  cp $f $tmp/translated/tools_$f
+done
+$ZANATA push --push-type both -s $tmp/source -t $tmp/translated
+rm -rf $tmp
diff --git a/wscript b/wscript
index 9d191b7..e04ebe8 100644 (file)
--- a/wscript
+++ b/wscript
@@ -20,6 +20,7 @@ import subprocess
 import os
 import shlex
 import sys
+import glob
 import distutils
 import distutils.spawn
 from waflib import Logs
@@ -469,3 +470,11 @@ def pot_merge(bld):
 
 def tags(bld):
     os.system('etags src/lib/*.cc src/lib/*.h src/wx/*.cc src/wx/*.h src/tools/*.cc src/tools/*.h')
+
+def zanata_pull(bld):
+    os.system('zanata-cli -B -q pull -t .')
+    for f in glob.glob('src/lib/po/*.po'):
+        l = os.path.basename(f)
+        os.rename('dcpomatic_%s' % l, 'src/tools/po/%s' % l)
+        os.rename('libdcpomatic_%s' % l, 'src/lib/po/%s' % l)
+        os.rename('libdcpomatic-wx_%s' % l, 'src/wx/po/%s' % l)
diff --git a/zanata.xml b/zanata.xml
new file mode 100644 (file)
index 0000000..a32c50b
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<config xmlns="http://zanata.org/namespace/config/">
+  <url>https://translate.zanata.org/zanata/</url>
+  <project>dcpomatic</project>
+  <project-version>2.0</project-version>
+  <project-type>gettext</project-type>
+
+  <locales>
+    <locale map-from='fr_FR'>fr</locale>
+    <locale map-from='de_DE'>de-DE</locale>
+    <locale map-from='nl_NL'>nl</locale>
+    <locale map-from='sv_SE'>sv</locale>
+    <locale map-from='it_IT'>it</locale>
+    <locale map-from='es_ES'>es-ES</locale>
+  </locales>
+
+  <rules>
+    <rule pattern="*.po">{filename}_{locale_with_underscore}.po</rule>
+  </rules>
+
+</config>