Permalink
Browse files

Automatically register translated resources in create transifex script

  • Loading branch information...
1 parent cc1374e commit 3b26ebab43a2e9849ab1edc0431aac3a91e80569 @timlinux timlinux committed Mar 19, 2013
Showing with 24 additions and 7 deletions.
  1. +24 −7 scripts/create-transifex-resources.sh
@@ -19,26 +19,26 @@ do
for POFILE in `find docs/i18n/en/LC_MESSAGES/${ITEM}/ -type f -name '*.po'`
do
# get the po file replacing 'en' with '<lang>'
- GENERICFILE=`echo $POFILE | sed 's/\/en\//\/<lang>\//g'`
+ GENERICFILE=`echo $POFILE | sed 's/\/en\//\/<lang>\//g' | sed 's/\/\//\//g'`
echo $GENERICFILE
# Get the filename only part of the po file so we can use that
# name when registering the resource
BASE=`basename $GENERICFILE .po`
BASE=`echo $BASE | sed 's/_/-/g' | sed 's/ /-/g'`
RESOURCE=inasafe.${ITEM}-$BASE
# Register each po file as a transifex resource (an individual translatable file)
+ #set -x
tx set -t PO --auto-local -r $RESOURCE \
"$GENERICFILE" \
--source-lang en \
--execute
+ #set +x
# now register the languate translations for the localised po file against
# this resources.
for LOCALE in $LOCALES
do
LOCALEFILE=`echo $POFILE | sed "s/\/en\//\/$LOCALE\//g"`
- set -x
tx set -r $RESOURCE -l $LOCALE "$LOCALEFILE"
- set +x
done
# When we are done in this block we should have created a section in the
# .tx/config file that looks like this:
@@ -52,25 +52,42 @@ do
# type = PO
done
done
-
#
# Now safe package
#
+POFILE='safe/i18n/en/LC_MESSAGES/inasafe.po'
+RESOURCE='safe/i18n/<lang>/LC_MESSAGES/inasafe.po'
+
tx set -t PO --auto-local -r inasafe.safe \
- 'safe/i18n/<lang>/LC_MESSAGES/inasafe.po' \
+ $RESOURCE \
--source safe/i18n/en/LC_MESSAGES/inasafe.po \
--source-lang en --execute
+for LOCALE in $LOCALES
+do
+ LOCALEFILE=`echo $POFILE | sed "s/\/en\//\/$LOCALE\//g"`
+ tx set -r $RESOURCE -l $LOCALE "$LOCALEFILE"
+done
+
#
# Now safe_qgis package
#
+TSFILE='safe_qgis/i18n/inasafe_en.ts'
+RESOURCE='safe_qgis/i18n/inasafe_<lang>.ts'
+
tx set -t QT --auto-local -r inasafe.safe_qgis \
- 'safe_qgis/i18n/inasafe_<lang>.ts' \
+ $RESOURCE \
--source-lang en \
- --source safe_qgis/i18n/inasafe_en.ts \
+ --source $TSFILE \
--execute
+for LOCALE in $LOCALES
+do
+ LOCALEFILE=`echo $TSFILE | sed "s/\_en/\_$LOCALE/g"`
+ tx set -r $RESOURCE -l $LOCALE "$LOCALEFILE"
+done
+
#Print out a listing of all registered resources
tx status

0 comments on commit 3b26eba

Please sign in to comment.