[openpgp-applet] 32/61: Add i18n infrastructure

2015-08-18 Thread Clement Hermann
This is an automated email from the git hooks/post-receive script.

nodens-guest pushed a commit to annotated tag OpenPGP_Applet-0.9
in repository openpgp-applet.

commit 8e1aca42818a773a2af020d49eca59b902c66c06
Author: Clément Hermann (nodens) 
Date:   Sun Sep 28 16:32:18 2014 +0200

Add i18n infrastructure

(using iuk as example)
- po/ directory and Makefiles
- dist::zilla mo files generation
- change i18n domain from tails to OpenPGP_Applet (i.e. dist name)
- generate pot file
---
 bin/openpgp-applet|   2 +-
 dist.ini  |   5 +-
 po/Makefile   |  93 +++
 po/OpenPGP_Applet.pot | 171 ++
 po/PACKAGE|  44 +
 po/POTFILES.in|   1 +
 6 files changed, 312 insertions(+), 4 deletions(-)

diff --git a/bin/openpgp-applet b/bin/openpgp-applet
index 053b9d2..518561d 100755
--- a/bin/openpgp-applet
+++ b/bin/openpgp-applet
@@ -72,7 +72,7 @@ use File::ShareDir;
 use Locale::gettext;
 use POSIX;
 setlocale(LC_MESSAGES, "");
-textdomain("tails");
+textdomain("OpenPGP_Applet");
 
 
 =head1 GLOBALS
diff --git a/dist.ini b/dist.ini
index 6c1d773..8da18ee 100644
--- a/dist.ini
+++ b/dist.ini
@@ -32,10 +32,9 @@ requires = xclip
 
 [ExecDir]
 
-; no po file for now
 ; Compile .po files to .mo files
-;[LocaleMsgfmt]
-;locale = po
+[LocaleMsgfmt]
+locale = po
 
 [Git::Check]
 
diff --git a/po/Makefile b/po/Makefile
new file mode 100644
index 000..5bec6ca
--- /dev/null
+++ b/po/Makefile
@@ -0,0 +1,93 @@
+# Makefile for various po files.
+
+srcdir = .
+destdir = $(DESTDIR)$(PREFIX)
+
+#CATALOGS = $(addsuffix .po, LINGUAS)
+CATALOGS = $(LINGUAS)
+MO_FILES = $(addsuffix .mo, $(LINGUAS))
+
+MSGMERGE = msgmerge
+MSGFMT   = msgfmt
+XGETTEXT = xgettext
+CATOBJEXT = .po
+
+include PACKAGE
+
+TD = $(strip $(TEXTDOMAIN))
+
+default: help
+
+all: $(TD).pot update-po update-mo
+
+help:
+   @echo "Available targets:"
+   @echo "  pot   - remake master catalog"
+   @echo "  update-po - merge po files"
+   @echo "  update-mo - regenerate mo files"
+   @echo "  install   - install mo files"
+   @echo "  all   - all of the above"
+
+POTFILES = $(srcdir)/POTFILES.in \
+   $(shell cat $(srcdir)/POTFILES.in) 
+
+pot: $(TD).pot 
+
+clean:
+   rm -f *~ *.bak *.mo
+
+# FIXME: The parameter --from-code is only needed if your sources contain
+# any 8 bit data (even in comments).  UTF-8 is only a guess here, but it
+# will at least accept any 8 bit data.
+#
+# The parameter "--language=perl" is not strictly needed because the
+# source language of all our files will be auto-detected by xgettext
+# by their filename extension.  You should even avoid this parameter
+# if you want to extract strings from multiple source languages.
+$(TD).pot: $(POTFILES)
+   $(XGETTEXT) --output=$(srcdir)/$(TD).pox --from-code=utf-8 \
+   --add-comments=TRANSLATORS: --files-from=$(srcdir)/POTFILES.in \
+   --copyright-holder="$(COPYRIGHT_HOLDER)" \
+   --msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \
+   --language=perl && \
+   rm -f $@ && mv $(TD).pox $@
+
+install: $(MO_FILES)
+   cd $(srcdir); \
+   targetdir='$(destdir)/share/locale'; \
+   languages='$(LINGUAS)'; \
+   for lang in $$languages; do \
+   mkdir -p "$$targetdir/$$lang/LC_MESSAGES" || exit 1; \
+   dest="$$targetdir/$$lang/LC_MESSAGES/$(TD).mo"; \
+   cat="$$lang.mo"; \
+   echo "installing $$cat as $$dest"; \
+   cp -f $$cat $$dest && chmod 644 $$dest || exit 1; \
+   done
+
+update-mo: $(MO_FILES)
+
+update-po:
+   $(MAKE) $(TD).pot
+   cd $(srcdir); \
+catalogs='$(CATALOGS)'; \
+for cat in $$catalogs; do \
+  cat=`basename $$cat`; \
+  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+  mv $$lang.po $$lang.old.po; \
+  echo "$$lang:"; \
+  if $(MSGMERGE) $$lang.old.po $(TD).pot -o $$lang.po; then \
+rm -f $$lang.old.po; \
+  else \
+echo "msgmerge for $$cat failed!"; \
+rm -f $$lang.po; \
+mv $$lang.old.po $$lang.po; \
+  fi; \
+done
+
+.SUFFIXES:
+.SUFFIXES: .po .mo
+
+.po.mo:
+   $(MSGFMT) --check --statistics --verbose -o $@ $<
+
+
diff --git a/po/OpenPGP_Applet.pot b/po/OpenPGP_Applet.pot
new file mode 100644
index 000..bd9b87e
--- /dev/null
+++ b/po/OpenPGP_Applet.pot
@@ -0,0 +1,171 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Tails developers
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: Tails developers \n"
+"POT-Creation-Date: 2014-09-28 23:53+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n

[openpgp-applet] 32/61: Add i18n infrastructure

2015-08-15 Thread Clément Hermann
This is an automated email from the git hooks/post-receive script.

nodens-guest pushed a commit to annotated tag OpenPGP_Applet-0.9
in repository openpgp-applet.

commit 8e1aca42818a773a2af020d49eca59b902c66c06
Author: Clément Hermann (nodens) 
Date:   Sun Sep 28 16:32:18 2014 +0200

Add i18n infrastructure

(using iuk as example)
- po/ directory and Makefiles
- dist::zilla mo files generation
- change i18n domain from tails to OpenPGP_Applet (i.e. dist name)
- generate pot file
---
 bin/openpgp-applet|   2 +-
 dist.ini  |   5 +-
 po/Makefile   |  93 +++
 po/OpenPGP_Applet.pot | 171 ++
 po/PACKAGE|  44 +
 po/POTFILES.in|   1 +
 6 files changed, 312 insertions(+), 4 deletions(-)

diff --git a/bin/openpgp-applet b/bin/openpgp-applet
index 053b9d2..518561d 100755
--- a/bin/openpgp-applet
+++ b/bin/openpgp-applet
@@ -72,7 +72,7 @@ use File::ShareDir;
 use Locale::gettext;
 use POSIX;
 setlocale(LC_MESSAGES, "");
-textdomain("tails");
+textdomain("OpenPGP_Applet");
 
 
 =head1 GLOBALS
diff --git a/dist.ini b/dist.ini
index 6c1d773..8da18ee 100644
--- a/dist.ini
+++ b/dist.ini
@@ -32,10 +32,9 @@ requires = xclip
 
 [ExecDir]
 
-; no po file for now
 ; Compile .po files to .mo files
-;[LocaleMsgfmt]
-;locale = po
+[LocaleMsgfmt]
+locale = po
 
 [Git::Check]
 
diff --git a/po/Makefile b/po/Makefile
new file mode 100644
index 000..5bec6ca
--- /dev/null
+++ b/po/Makefile
@@ -0,0 +1,93 @@
+# Makefile for various po files.
+
+srcdir = .
+destdir = $(DESTDIR)$(PREFIX)
+
+#CATALOGS = $(addsuffix .po, LINGUAS)
+CATALOGS = $(LINGUAS)
+MO_FILES = $(addsuffix .mo, $(LINGUAS))
+
+MSGMERGE = msgmerge
+MSGFMT   = msgfmt
+XGETTEXT = xgettext
+CATOBJEXT = .po
+
+include PACKAGE
+
+TD = $(strip $(TEXTDOMAIN))
+
+default: help
+
+all: $(TD).pot update-po update-mo
+
+help:
+   @echo "Available targets:"
+   @echo "  pot   - remake master catalog"
+   @echo "  update-po - merge po files"
+   @echo "  update-mo - regenerate mo files"
+   @echo "  install   - install mo files"
+   @echo "  all   - all of the above"
+
+POTFILES = $(srcdir)/POTFILES.in \
+   $(shell cat $(srcdir)/POTFILES.in) 
+
+pot: $(TD).pot 
+
+clean:
+   rm -f *~ *.bak *.mo
+
+# FIXME: The parameter --from-code is only needed if your sources contain
+# any 8 bit data (even in comments).  UTF-8 is only a guess here, but it
+# will at least accept any 8 bit data.
+#
+# The parameter "--language=perl" is not strictly needed because the
+# source language of all our files will be auto-detected by xgettext
+# by their filename extension.  You should even avoid this parameter
+# if you want to extract strings from multiple source languages.
+$(TD).pot: $(POTFILES)
+   $(XGETTEXT) --output=$(srcdir)/$(TD).pox --from-code=utf-8 \
+   --add-comments=TRANSLATORS: --files-from=$(srcdir)/POTFILES.in \
+   --copyright-holder="$(COPYRIGHT_HOLDER)" \
+   --msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \
+   --language=perl && \
+   rm -f $@ && mv $(TD).pox $@
+
+install: $(MO_FILES)
+   cd $(srcdir); \
+   targetdir='$(destdir)/share/locale'; \
+   languages='$(LINGUAS)'; \
+   for lang in $$languages; do \
+   mkdir -p "$$targetdir/$$lang/LC_MESSAGES" || exit 1; \
+   dest="$$targetdir/$$lang/LC_MESSAGES/$(TD).mo"; \
+   cat="$$lang.mo"; \
+   echo "installing $$cat as $$dest"; \
+   cp -f $$cat $$dest && chmod 644 $$dest || exit 1; \
+   done
+
+update-mo: $(MO_FILES)
+
+update-po:
+   $(MAKE) $(TD).pot
+   cd $(srcdir); \
+catalogs='$(CATALOGS)'; \
+for cat in $$catalogs; do \
+  cat=`basename $$cat`; \
+  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+  mv $$lang.po $$lang.old.po; \
+  echo "$$lang:"; \
+  if $(MSGMERGE) $$lang.old.po $(TD).pot -o $$lang.po; then \
+rm -f $$lang.old.po; \
+  else \
+echo "msgmerge for $$cat failed!"; \
+rm -f $$lang.po; \
+mv $$lang.old.po $$lang.po; \
+  fi; \
+done
+
+.SUFFIXES:
+.SUFFIXES: .po .mo
+
+.po.mo:
+   $(MSGFMT) --check --statistics --verbose -o $@ $<
+
+
diff --git a/po/OpenPGP_Applet.pot b/po/OpenPGP_Applet.pot
new file mode 100644
index 000..bd9b87e
--- /dev/null
+++ b/po/OpenPGP_Applet.pot
@@ -0,0 +1,171 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Tails developers
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: Tails developers \n"
+"POT-Creation-Date: 2014-09-28 23:53+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n