summaryrefslogtreecommitdiff
path: root/packages/xserver-common/files/Makefile.translation
diff options
context:
space:
mode:
Diffstat (limited to 'packages/xserver-common/files/Makefile.translation')
-rw-r--r--packages/xserver-common/files/Makefile.translation107
1 files changed, 107 insertions, 0 deletions
diff --git a/packages/xserver-common/files/Makefile.translation b/packages/xserver-common/files/Makefile.translation
new file mode 100644
index 0000000000..1ca7d648fd
--- /dev/null
+++ b/packages/xserver-common/files/Makefile.translation
@@ -0,0 +1,107 @@
+.SUFFIXES: .mo .po .pot .po8
+
+CONTROL = `if test -e familiar/control1; then echo control1; else echo control; fi`
+
+# use ipkg-build or ipkg-deb-build
+IPKG_BUILD := ipkg-build
+
+TRANSLATION_SITE := http://www.iro.umontreal.ca/~gnutra/maint
+
+ifeq ($(DIR_PO),)
+DIR_PO := po
+endif
+
+ifeq ($(BINPACKAGE),)
+BINPACKAGE := $(PACKAGE)
+endif
+
+mo-files = $(patsubst %,$(DIR_PO)/%.mo,$(LINGUAS))
+po-files = $(patsubst %,$(DIR_PO)/%.po,$(LINGUAS))
+
+ifeq ($(shell if [ -f $(PACKAGE).desktop.in ]; then echo present; fi;),present)
+desktop-files += $(PACKAGE).desktop
+endif
+
+ifneq ($(EXTRA_DESKTOPS),)
+desktop-files += $(patsubst %.desktop.in,%.desktop,$(EXTRA_DESKTOPS))
+endif
+
+all-mo: $(mo-files)
+
+all-desktop: $(desktop-files)
+
+install-mo: all-mo
+ if [ "$(ENABLE_NLS)" != "no" ]; then \
+ if [ "x$(LINGUAS)" != "x" ]; then \
+ for i in $(LINGUAS); do mkdir -p $(DESTDIR)$(PREFIX)/share/locale/$$i/LC_MESSAGES; install -m 644 $(DIR_PO)/$$i.mo $(DESTDIR)$(PREFIX)/share/locale/$$i/LC_MESSAGES/$(PACKAGE).mo; done \
+ fi; \
+ fi;
+
+.po8.mo:;
+ if [ "$(ENABLE_NLS)" != "no" ]; then \
+ msgfmt -o $@ $<; \
+ fi;
+
+.po.po8:;
+ CTYPE=`grep "^\"Content-Type:" $< | sed 's/^.*charset=//;s/\\\\.*//'`; sed "s/\(Content-Type: .*=\)$$CTYPE/\1UTF-8/" < $< | iconv -f $${CTYPE} -t UTF-8 >$@
+
+update-po: $(po-files) extract-po
+
+dist-prep: update-po freshen-po
+# empty
+
+ifeq ($(CVSBUILD),yes)
+ipkg-prep: freshen-po
+# empty
+endif
+
+extract-po:
+ mkdir -p $(DIR_PO)
+ ( SOURCES="$(SOURCES)"; for DESK in $(PACKAGE).desktop.in $(EXTRA_DESKTOPS); do if [ -f $$DESK ]; then intltool-extract --type=gettext/ini $$DESK; SOURCES="$$SOURCES $${DESK}.h"; fi; done; if [ "x$$SOURCES" != "x" ]; then xgettext --add-comments=TRANSLATORS: -k_ -kN_ -o $(DIR_PO)/$(PACKAGE).pot.new $$SOURCES; fi )
+ if [ -f $(DIR_PO)/$(PACKAGE).pot.new ]; then if cmp -s $(DIR_PO)/$(PACKAGE).pot.new $(PACKAGE).pot; then rm $(DIR_PO)/$(PACKAGE).pot.new; else mv $(DIR_PO)/$(PACKAGE).pot.new $(DIR_PO)/$(PACKAGE).pot; fi; fi
+
+clean: clean-po clean-dist-translation
+
+clean-po:
+ rm -rf $(DIR_PO)/*.mo
+ for i in $(desktop-files); do if [ -f $$i.in ]; then rm -f $$i; rm -f $$i.in.h; fi; done
+
+%.desktop: %.desktop.in $(patsubst %,$(DIR_PO)/%.po,$(LINGUAS))
+ intltool-merge -u -d $(DIR_PO) $< $@
+
+freshen-po:
+ rm -rf tmp-po
+ mkdir tmp-po
+ cd tmp-po; for LANG in $(LINGUAS); do wget $(TRANSLATION_SITE)/$(PACKAGE)/$$LANG.po; done
+ for LANG in $(LINGUAS); do if [ ! -f $(DIR_PO)/$$LANG.po ] || ! cmp -s $(DIR_PO)/$$LANG.po tmp-po/$$LANG.po ; then mv tmp-po/$$LANG.po $(DIR_PO)/$$LANG.po; echo "Updated $$LANG translation"; fi; done
+ rm -rf tmp-po
+
+# ------------------------------------------------------------------------
+
+MAINTAINER = $(shell grep 'Maintainer: ' familiar/$(CONTROL) | cut -d ' ' -f 2-)
+
+ifndef BUILD
+BUILD = ../build
+endif
+
+transdist := familiar/dist-translation
+templates := $(BUILD)/familiar
+ipkglist := translation-ipkgs.txt
+
+clean-dist-translation:
+ rm -rf $(transdist) $(ipkglist)
+
+real-translation-package: all-mo
+ rm -rf $(transdist) $(ipkglist)
+ for LINGUA in $(LINGUAS); do \
+ i=$$(echo $$LINGUA | tr '[A-Z_]' '[a-z+]'); \
+ mkdir -p $(transdist)/$$i/CONTROL; \
+ mkdir -p $(transdist)/$$i$(PREFIX)/share/locale/$$LINGUA/LC_MESSAGES; \
+ install -m 644 po/$$LINGUA.mo $(transdist)/$$i$(PREFIX)/share/locale/$$LINGUA/LC_MESSAGES/$(PACKAGE).mo; \
+ sed -e "s/<maintainer>/$(MAINTAINER)/;s/<package>/$(BINPACKAGE)/;s/<version>/$(VERSION)/;s/<language>/$$i/;s!<source>!$(SOURCE)!" $(templates)/control.translation > $(transdist)/$$i/CONTROL/control; \
+ install $(templates)/postinst.translation $(transdist)/$$i/CONTROL/postinst; \
+ $(IPKG_BUILD) -g 0 -o 0 $(transdist)/$$i | sed 's/^Packaged .*into //; t 1; d; : 1; s:.*/::' >> $(ipkglist); \
+ done
+
+translation-ipkg:
+ make PREFIX=/usr real-translation-package