changeset 6612701a5f47 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=6612701a5f47
description: add script to build plugins translations
diffstat:
scripts/dev/plugins_translate | 95 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 95 insertions(+), 0 deletions(-)
diffs (99 lines):
diff -r b809c3dbbbd1 -r 6612701a5f47 scripts/dev/plugins_translate
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/dev/plugins_translate Sat Sep 03 22:56:37 2011 +0200
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+PYFILES=$(find -L ./ -type f -name "*.py")
+GLADEFILES=$(find -L ./ -type f -name "*.ui")
+
+
+check_args()
+{
+ if [ $# -ne 2 ]; then
+ echo "Missing lang argument" >&2
+ exit 4
+ fi
+}
+
+init_ln()
+{
+ if [ -e "core_plugins" ] && [ ! -L "core_plugins" ]; then
+ echo "core_plugins must be a symbolic link" >&2
+ exit 1
+ fi
+ if [ ! -e "core_plugins" ]; then
+ ln -s ../../plugins core_plugins
+ fi
+ if [ ! -L "community_plugins" ]; then
+ echo "community_plugins should be a symbolic link to gajim-plugins
repository, else they won't be in po files"
+ fi
+}
+
+make_pot()
+{
+ # Generate .ui.h
+ find -L ./ -type f -name "*.ui" -exec intltool-extract
--type="gettext/glade" {} \;
+ GLADEHFILES=$(find -L ./ -type f -name "*.ui.h")
+ xgettext -k_ -kN_ -o plugins_translations.pot $PYFILES $GLADEHFILES
--from-code=utf-8
+ rm $GLADEHFILES
+}
+
+make_po()
+{
+ if [ -f $1.po ]; then
+ echo "Updating '$1' language";
+ msgmerge -U $1.po plugins_translations.pot;
+ else
+ msginit -l $1.UTF-8 -o $1.po;
+ fi
+}
+
+make_mo()
+{
+ if [ ! -f $1.po ]; then
+ echo "$1.po doesn't existe. Use plugins_translation make_po $1 to
create it.";
+ exit 3
+ fi
+ mkdir -p locale/$1/LC_MESSAGES
+ msgfmt -o $1.mo $1.po
+}
+
+install_mo()
+{
+ if [ -L community_plugins ]; then
+ cp $1.mo community_plugins/plugins_translate/
+ fi
+ mkdir -p ~/.local/share/gajim/plugins/locale/$1/LC_MESSAGES/
+ cp $1.mo
~/.local/share/gajim/plugins/locale/$1/LC_MESSAGES/gajim_plugins.mo
+}
+
+
+case "$1" in
+ make_po)
+ check_args $@
+ init_ln
+ make_pot
+ make_po $2
+ ;;
+ make_mo)
+ check_args $@
+ make_mo $2
+ ;;
+ install_mo)
+ install_mo
+ ;;
+ all)
+ check_args $@
+ init_ln
+ make_pot
+ make_po $2
+ make_mo $2
+ install_mo $2
+ ;;
+ *)
+ echo "Usage: plugins_translation {all|make_po|make_mo|install_mo}" >&2
+ echo "example: plugins_translation make_po fr_FR"
+ exit 2
+ ;;
+esac
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits