[GRASS-SVN] r33840 - grass/branches/develbranch_6/locale

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 12 04:32:46 EDT 2008


Author: neteler
Date: 2008-10-12 04:32:46 -0400 (Sun, 12 Oct 2008)
New Revision: 33840

Modified:
   grass/branches/develbranch_6/locale/Makefile
Log:
improvements backported

Modified: grass/branches/develbranch_6/locale/Makefile
===================================================================
--- grass/branches/develbranch_6/locale/Makefile	2008-10-12 07:22:22 UTC (rev 33839)
+++ grass/branches/develbranch_6/locale/Makefile	2008-10-12 08:32:46 UTC (rev 33840)
@@ -6,7 +6,12 @@
 include $(MODULE_TOPDIR)/include/Make/Module.make
 
 default:
-	@if [ "$(HAVE_NLS)" != "" ] ; then echo "Creating translations (= 'make mo')" ; $(MAKE) mo ; else echo "NLS disabled, cannot translate (re-configure GRASS first)." ; fi
+	@if [ "$(HAVE_NLS)" != "" ] ; then \
+		echo "Creating translations (= 'make mo')" >&2 ; \
+		$(MAKE) mo ; \
+	else \
+		echo "NLS disabled." ; \
+	fi
 
 all:
 	@echo 'Usage:'
@@ -15,8 +20,8 @@
 	@echo '   make mo         create the *.mo files'
 
 # Directory for installing tcl .msg files:
-MSG_DIR = $(GISBASE)/etc/msgs
-MO_DIR = $(GISBASE)/locale
+MSG_DIR = $(ARCH_DISTDIR)/etc/msgs
+MO_DIR = $(ARCH_DISTDIR)/locale
 PO_DIR = po
 
 #distinguish between library messages and modules:
@@ -66,21 +71,21 @@
 		done
 	@echo "Be careful with SVN commits as .po file updates must be syncronized with the individual translators."
 
+define dom_rule
+$(1)_FILES := $$(patsubst po/grass$(1)_%.po,$$(MO_DIR)/%/LC_MESSAGES/grass$(1).mo,$$(wildcard po/grass$(1)_*.po))
+$$(MO_DIR)/%/LC_MESSAGES/grass$(1).mo: po/grass$(1)_%.po
+	@ [ -d $$(MO_DIR)/$$*/LC_MESSAGES ] || $(MKDIR) $$(MO_DIR)/$$*/LC_MESSAGES
+	msgfmt --statistics -o $$@ $$<
+endef
+$(foreach domain,libs mods wxpy,$(eval $(call dom_rule,$(domain))))
+
+$(MSG_DIR)/%.msg: po/grasstcl_%.po
+	@ [ -d $(MSG_DIR) ] || $(MKDIR) $(MSG_DIR)
+	msgfmt --statistics --tcl -l $* -d $(MSG_DIR)/ $<
+
+MSGFILES := $(patsubst po/grasstcl_%.po,$(MSG_DIR)/%.msg,$(wildcard po/grasstcl_*.po))
+
 #create binary messages files
-mo:
-	@(cd ./po/ ; for po in `ls *_*.po 2>/dev/null` ; do\
-		suffix=`echo $$po | cut -d'_' -f2-`; \
-		lingua=`basename $$suffix .po`; \
-		prefix=`echo $$po | cut -d'_' -f1`; \
-		$(INSTALL) -d $(MO_DIR)/$$lingua/LC_MESSAGES/ ; \
-		echo -n $$po": "; \
-		if [ $$prefix = $(TCLDOMAIN) ]; then\
-		$(INSTALL) -d $(MSG_DIR) ; \
-		msgfmt --statistics --tcl -l $$lingua \
-			-d $(MSG_DIR)/ $$po ;\
-		else \
-		msgfmt --statistics \
-			-o $(MO_DIR)/$$lingua/LC_MESSAGES/$$prefix.mo $$po ;\
-		fi \
-	done \
-	)
+mo: $(libs_FILES) $(mods_FILES) $(wxpy_FILES) $(MSGFILES)
+
+.PHONY: mo



More information about the grass-commit mailing list