From fb31fc94f029a57e8e0134468cac2011c067f5f2 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 5 Sep 2005 15:32:26 +0000 Subject: [PATCH] install .mo files in /usr/share/locale --- Makefile | 18 +++++++++++++++++- src/common/i18n.py | 10 +++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5b173fe8e..ce685610d 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,13 @@ DESTDIR = LIBDIR = /lib MANDIR = $(DESTDIR)$(PREFIX)/share/man -FIND = find . \( -name '*.glade' -o -name '*.py' -o -name '*.xpm' -o -name '*.gif' -o -name '*.png' -o -name '*.mo' -o -name '*.wav' \) +FIND = find . \( -name '*.glade' -o -name '*.py' -o -name '*.xpm' -o -name '*.gif' -o -name '*.png' -o -name '*.wav' \) FILES = `$(FIND)` DIRS = `$(FIND) -exec dirname {} \; | sort -u` +FIND_PO = find ./po \( -name '*.mo' \) +FILES_PO = `$(FIND_PO) | sed -e 's/^\.\/po/\./g'` +DIRS_PO = `$(FIND_PO) -exec dirname {} \; | sort -u | sed -e 's/^\.\/po/\./g'` FIND_LIB = find . -name '*.so' FILES_LIB = `$(FIND_LIB)` @@ -58,6 +61,10 @@ dist: rm -rf gajim-$(VERSION) install: + # Remove the old po folder if it exists + if [ -d $(DESTDIR)$(PREFIX)/share/gajim/po ] ; then \ + rm -rf $(DESTDIR)$(PREFIX)/share/gajim/po; \ + fi for d in $(DIRS) ; do \ if [ ! -d $(DESTDIR)$(PREFIX)/share/gajim/$$d ] ; then \ mkdir -p "$(DESTDIR)$(PREFIX)/share/gajim/$$d"; \ @@ -67,6 +74,15 @@ install: DST=`dirname "$$f"`; \ cp "$$f" "$(DESTDIR)$(PREFIX)/share/gajim/$$DST/"; \ done + for d in $(DIRS_PO) ; do \ + if [ ! -d $(DESTDIR)$(PREFIX)/share/locale/$$d ] ; then \ + mkdir -p "$(DESTDIR)$(PREFIX)/share/locale/$$d"; \ + fi; \ + done + for f in $(FILES_PO) ; do \ + DST=`dirname "$$f"`; \ + cp "./po/$$f" "$(DESTDIR)$(PREFIX)/share/locale/$$DST/"; \ + done cp COPYING "$(DESTDIR)$(PREFIX)/share/gajim/"; mkdir -p "$(DESTDIR)$(PREFIX)/share/pixmaps"; cp data/pixmaps/gajim.png "$(DESTDIR)$(PREFIX)/share/pixmaps/"; diff --git a/src/common/i18n.py b/src/common/i18n.py index 150abf60d..c5a6a9ae0 100644 --- a/src/common/i18n.py +++ b/src/common/i18n.py @@ -17,11 +17,15 @@ ## GNU General Public License for more details. ## -APP = 'gajim' -DIR = '../po' - import locale import gettext +import os + +APP = 'gajim' +if os.path.isdir('../po'): + DIR = '../po' +else: + DIR = '../../locale' locale.setlocale(locale.LC_ALL, '') _translation = None