Skip to content

Commit

Permalink
add sync script for cron (not working correctly)
Browse files Browse the repository at this point in the history
  • Loading branch information
eumel8 committed Jan 29, 2016
1 parent 6a007f6 commit f77cfbe
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cron/zanata-sync.sh
@@ -0,0 +1,22 @@
#!/bin/sh

# fetch new po files for spezific lang
/opt/zanata/zanata-cli-3.8.1/bin/zanata-cli -B -q pull -l de

# compile mo files
for file in `find trans -name "*.po"` ; do msgfmt -o `echo $file | sed 's/\.po$/.mo/'` $file ; done

# backup curret data
tar cvfz backup_`date +%s`.tgz /opt/stack/horizon/horizon/locale/de/LC_MESSAGES /opt/stack/horizon/openstack_dashboard/locale/de/LC_MESSAGES

# delete staff
rm -f /opt/stack/horizon/horizon/locale/de/LC_MESSAGES/*
rm -f /opt/stack/horizon/openstack_dashboard/locale/de/LC_MESSAGES/*

# copy new content
cp trans/horizon/locale/* /opt/stack/horizon/horizon/locale/de/LC_MESSAGES/
cp trans/openstack_dashboard/locale/* /opt/stack/horizon/openstack_dashboard/locale/de/LC_MESSAGES/

# reload apache
sudo apache2ctl graceful

11 changes: 11 additions & 0 deletions cron/zanata.xml
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://zanata.org/namespace/config/">
<url>https://translate.openstack.org:443/</url>
<project>horizon</project>
<project-version>stable-liberty</project-version>
<project-type>gettext</project-type>
<src-dir>.</src-dir>
<trans-dir>trans</trans-dir>
<includes>*</includes>
<rules/>
</config>

2 comments on commit f77cfbe

@eumel8
Copy link
Owner Author

@eumel8 eumel8 commented on f77cfbe Jan 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not the correct file name and would not work

@daisy-ycguo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this zanata.xml (https://github.com/daisy-ycguo/translation_checksite/blob/zanata_xml/cron/zanata.xml), put it in the root folder of horizon project, and run "zanata-cli -B -e pull".
All translation files will be pulled into the specific folders.

Please sign in to comment.