summaryrefslogtreecommitdiffstats
path: root/zenmap/share/zenmap/locale/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'zenmap/share/zenmap/locale/Makefile')
-rw-r--r--zenmap/share/zenmap/locale/Makefile39
1 files changed, 39 insertions, 0 deletions
diff --git a/zenmap/share/zenmap/locale/Makefile b/zenmap/share/zenmap/locale/Makefile
new file mode 100644
index 0000000..d957c63
--- /dev/null
+++ b/zenmap/share/zenmap/locale/Makefile
@@ -0,0 +1,39 @@
+LINGUAS = $(patsubst %.po,%,$(wildcard *.po))
+
+TOPDIR = ../../..
+SOURCEFILES = zenmap
+SOURCEDIRS = zenmapCore zenmapGUI radialnet
+PROFILE_EDITOR_XML = share/zenmap/misc/profile_editor.xml
+
+XGETTEXT = xgettext
+MSGID_BUGS_ADDRESS = dev@nmap.org
+
+ZENMAP_POT = zenmap.pot
+TMP_POT = tmp.pot
+
+TMP_PO = tmp.po
+
+all:
+ @echo 'Run "make update-pot" to update $(ZENMAP_POT).'
+ @echo 'Run "make <XX>.po" to update <XX>.po from $(ZENMAP_POT).'
+ @echo 'Run "make update-mo" to update all MO files from PO files.'
+
+update-pot:
+ (echo $(SOURCEFILES); cd $(TOPDIR) && find $(SOURCEDIRS) -name '*.py') \
+ | $(XGETTEXT) -D $(TOPDIR) --from-code=utf-8 --language=python --msgid-bugs-address=$(MSGID_BUGS_ADDRESS) -f - -o $(TMP_POT)
+ ./xgettext-profile_editor.py -D $(TOPDIR) $(PROFILE_EDITOR_XML) >> $(TMP_POT)
+ msguniq --to-code=utf-8 $(TMP_POT) | msgmerge -U --backup=none $(ZENMAP_POT) -
+ rm -f $(TMP_POT)
+
+update-mo: $(addsuffix /LC_MESSAGES/zenmap.mo,$(LINGUAS))
+
+%.po: $(ZENMAP_POT)
+ cp -f $@ $(TMP_PO)
+ msgmerge -N $(TMP_PO) $< | msgattrib --no-obsolete -o $@
+ rm -f $(TMP_PO)
+
+%/LC_MESSAGES/zenmap.mo: %.po
+ mkdir -p $*/LC_MESSAGES
+ msgfmt $< -o $@
+
+.PHONY: update-pot