[ocrfeeder] Made i18n more compliant with intltool



commit ac9b0c42a804ac4317420009e951bf6d8ce3acd2
Author: Joaquim Rocha <jrocha igalia com>
Date:   Fri Mar 5 09:57:57 2010 +0100

    Made i18n more compliant with intltool

 Makefile                              |   42 ++-
 locale/de/LC_MESSAGES/ocrfeeder.mo    |  Bin 8163 -> 0 bytes
 locale/es/LC_MESSAGES/ocrfeeder.mo    |  Bin 8264 -> 0 bytes
 locale/fr/LC_MESSAGES/ocrfeeder.mo    |  Bin 8302 -> 0 bytes
 locale/gl/LC_MESSAGES/ocrfeeder.mo    |  Bin 8099 -> 0 bytes
 locale/it/LC_MESSAGES/ocrfeeder.mo    |  Bin 8249 -> 0 bytes
 locale/pt/LC_MESSAGES/ocrfeeder.mo    |  Bin 8152 -> 0 bytes
 locale/sv/LC_MESSAGES/ocrfeeder.mo    |  Bin 8007 -> 0 bytes
 locale/zh_CN/LC_MESSAGES/ocrfeeder.mo |  Bin 7723 -> 0 bytes
 po/ocrfeeder.pot                      |  597 ---------------------------------
 10 files changed, 23 insertions(+), 616 deletions(-)
---
diff --git a/Makefile b/Makefile
index 6b29577..19654be 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ DESTDIR=/
 BUILDIR=$(CURDIR)/debian/ocrfeeder
 PROJECT=ocrfeeder
 PO_DIR=po
+PO_FILES=$(wildcard $(PO_DIR)/*.po)
 VERSION=0.6
 
 all:
@@ -12,16 +13,33 @@ all:
 	@echo "make builddeb - Generate a deb package"
 	@echo "make clean    - Get rid of scratch and byte files"
 
-source:
+po/$(PROJECT).pot:
+	cd $(PO_DIR); intltool-update -p -g $(PROJECT)
+
+update-po: $(PO_DIR)/$(PROJECT).pot
+	cd $(PO_DIR); intltool-update -r -g $(PROJECT)
+
+%.mo : %.po
+	@langname=`basename $(<) .po`; \
+	dirname=locale/$$langname/LC_MESSAGES/; \
+	echo Generating $$dirname/$(PROJECT).mo; \
+	mkdir -p $$dirname; \
+	msgfmt $< -o $$dirname/$(PROJECT).mo; \
+
+generate-mo: $(patsubst %.po,%.mo,$(PO_FILES))
+
+i18n: po/$(PROJECT).pot update-po generate-mo 
+
+source: i18n
 	$(PYTHON) setup.py sdist $(COMPILE)
 
-install:
+install: i18n
 	$(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE)
 
-buildrpm:
+buildrpm: i18n
 	$(PYTHON) setup.py bdist_rpm --post-install=rpm/postinstall --pre-uninstall=rpm/preuninstall
 
-builddeb:
+builddeb: i18n
 	# build the source package in the parent directory
 	# then rename it to project_version.orig.tar.gz
 	$(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../ 
@@ -33,23 +51,9 @@ clean:
 	$(PYTHON) setup.py clean
 	$(MAKE) -f $(CURDIR)/debian/rules clean
 	rm -rf build/ MANIFEST
+	rm -rf locale po/$(PROJECT).pot
 	find . -name '*.pyc' -delete
 
-compilemessages:
-	@# Compile .po to .mo
-	@# Use it such as: make compilemessages L=pt_PT
-	@if [ ! -z $(L) ]; then \
-	  if [ -f "$(PO_DIR)/$(L).po" ]; then \
-	    mkdir -p locale/$(L)/LC_MESSAGES; \
-	    msgfmt --output-file=locale/$(L)/LC_MESSAGES/$(PROJECT).mo $(PO_DIR)/$(L).po; \
-	    echo Generated locale/$(L)/LC_MESSAGES/$(PROJECT).mo; \
-	  else \
-	    echo $(PO_DIR)/$(L).po was not found.;\
-	  fi \
-	else \
-	    echo Please provide the L argument. E.g.: make compilemessages L=pt_PT; \
-	fi
-
 generatepot:
 	@# After this, use the following command to initiate an empty po: msginit --input=po/ocrfeeder.pot --locale=en_US
 	@# To update an existing po, do this: msgmerge -U po/en_US.po new_en_US.po        the po/en_US.po will be updated.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]