From afc6093ea5b87d2d4c870cef7ef66548d3d576ba Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 8 Jul 2017 21:32:08 -0400 Subject: Makefile: rename $(outdir)/everything.pot to $(srcdir)/dir.pot --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e7b35e4..444a669 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ $(outdir)/shellcheck: cd $(@D)/test && ./testenv $(TESTENVFLAGS) 'cd "$$TMPDIR/destdir" && find \( $(shellcheck.prune) \) -prune -o -not -type d -exec shellcheck $(shellcheck.flags) {} +' _po_rule = \ -po/%(pkg).pot: $(addsuffix /everything.pot,$(pkg.%(pkg))); \ +$(srcdir)/po/%(pkg).pot: $(addsuffix /dir.pot,$(pkg.%(pkg))); \ cat $^ | msguniq -Fi --to-code=UTF-8 > '$@' $(eval $(foreach pkg,$(pkgs),\ $(subst %(pkg),$(pkg),$(value _po_rule))$(at.nl))) -- cgit v1.2.3-54-g00ecf From bcc12b176fc19070aa16940ff4840830bc2ecd59 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 8 Jul 2017 22:08:04 -0400 Subject: Makefile: add support for compiling and installing localizations This means that the new `po/files.generate` target can be used to build the `.pot` files without doing anything else; we can stop requiring translators to install ruby-ronn. It also means that we can put the `.pot` files in the source tarball, to make it even easier for translators. Unfortunately, it does add the extra step of having to create another symlink when adding a new locale. --- Makefile | 2 +- po/.gitignore | 1 + po/HACKING | 23 +++++++++++++---------- po/Makefile | 11 +++++++++++ po/es/Makefile | 1 + po/subdir.mk | 17 +++++++++++++++++ 6 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 po/Makefile create mode 120000 po/es/Makefile create mode 100644 po/subdir.mk (limited to 'Makefile') diff --git a/Makefile b/Makefile index 444a669..f6b78e9 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,6 @@ libretools.out.confs = libretools.out = $(foreach pkg,$(pkgs),po/$(pkg).pot) files.src.gen += .srcversion-libretools.mk .srcversion-devtools.mk -nested.subdirs = $(foreach pkg,$(pkgs),$(pkg.$(pkg))) +nested.subdirs = $(foreach pkg,$(pkgs),$(pkg.$(pkg))) po include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/po/.gitignore b/po/.gitignore index e3a8c5d..514b3d0 100644 --- a/po/.gitignore +++ b/po/.gitignore @@ -1 +1,2 @@ *.pot +*/*.mo diff --git a/po/HACKING b/po/HACKING index 9ab35a7..5dd207c 100644 --- a/po/HACKING +++ b/po/HACKING @@ -2,23 +2,24 @@ Translations for programs are provided in files with the `.po` suffix. These are created by copying PO-template (`.pot`) files, and filling in the missing "msgstr" values. -To add a translation, you'll first (1) need to create the `.pot` -files, and then (2) copy them and (3) fill them in. +To add a translation, you'll first (1) need to create the `.pot` files +if you don't already have them, and then (2) copy them and (3) fill +them in. # 1. Create `.pot` files + If you are working from a release source tarball, you can skip this + step (the `.pot` files are included in the tarball); if you are + working from git, read on. + libretools' .pot files are not tracked in git; they are created by - running `make` (you'll need a checkout of both devtools-par and - libretools to run `make` if building from git). In addition to the - usual (`base-devel`) depenencies when running `make`, you'll need - the `ruby-ronn` package as well. + running `make`. You'll need a checkout of both "devtools-par" and + "libretools" to run `make` if building from git. - $ sudo pacman -S --needed base-devel ruby-ronn - ... $ git clone https://git.parabola.nu/packages/devtools-par.git/ $ git clone https://git.parabola.nu/packages/libretools.git/ $ cd libretools - $ make + $ make po/files.generate ... $ cd po/ $ ls @@ -33,10 +34,12 @@ files, and then (2) copy them and (3) fill them in. Create a folder under `po/` with the two-letter language code[^1] you want to add. Then, copy the `.pot` files to that folder, - changing the file extension to `.po`; for example: + changing the file extension to `.po`. Finally, link the `subdir.mk` + file to be the Makefile for that directory. For example: $ mkdir es $ for file in *.pot; do cp $file es/${file%t}; done + $ ln -s ../subdir.mk es/Makefile [^1]: See the langauge code table here: diff --git a/po/Makefile b/po/Makefile new file mode 100644 index 0000000..1e56edd --- /dev/null +++ b/po/Makefile @@ -0,0 +1,11 @@ +include $(dir $(lastword $(MAKEFILE_LIST)))/../config.mk +include $(topsrcdir)/build-aux/Makefile.head.mk + +domains = libretools librelib gitget xbs +locales := $(filter-out .,$(sort $(patsubst %/,%,$(dir $(files.src.src))))) + +files.src.gen += $(addsuffix .pot,$(domains)) +nested.subdirs += $(locales) +at.subdirs += .. + +include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/po/es/Makefile b/po/es/Makefile new file mode 120000 index 0000000..71a1159 --- /dev/null +++ b/po/es/Makefile @@ -0,0 +1 @@ +../subdir.mk \ No newline at end of file diff --git a/po/subdir.mk b/po/subdir.mk new file mode 100644 index 0000000..6c4120b --- /dev/null +++ b/po/subdir.mk @@ -0,0 +1,17 @@ +include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk +include $(topsrcdir)/build-aux/Makefile.head.mk + +locale = $(notdir $(srcdir)) +domains = $(patsubst %.po,%,$(filter %.po,$(files.src.src))) + +$(outdir)/%.mo: $(srcdir)/%.po $(call at.path,../%.po) + msgfmt -o $@ $< + +$(DESTDIR)$(localedir)/$(locale)/LC_MESSAGES/%.mo: $(outdir)/%.mo + install -T -Dm644 '$<' '$@' + +files.out.all += $(addsuffix .mo,$(domains)) +files.sys.all += $(foreach domain,$(domains),$(localedir)/$(locale)/LC_MESSAGES/$(domain).mo) +at.subdirs += .. + +include $(topsrcdir)/build-aux/Makefile.tail.mk -- cgit v1.2.3-54-g00ecf From e3d7fbca888e07f02c5867dd1e50393247a066b7 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 9 Jul 2017 20:12:32 -0400 Subject: po: add pot headers --- Makefile | 6 +----- po/.gitignore | 4 ++-- po/Makefile | 10 ++++++++++ po/es/gitget.po | 15 +++++++++++++++ po/es/librelib.po | 15 +++++++++++++++ po/es/libretools.po | 15 +++++++++++++++ po/es/xbs.po | 15 +++++++++++++++ po/header.po.head.in | 14 ++++++++++++++ 8 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 po/header.po.head.in (limited to 'Makefile') diff --git a/Makefile b/Makefile index f6b78e9..5d7ece2 100644 --- a/Makefile +++ b/Makefile @@ -39,11 +39,8 @@ $(outdir)/shellcheck: private shellcheck.prune += -o -type f -name source.sh.gen $(outdir)/shellcheck: cd $(@D)/test && ./testenv $(TESTENVFLAGS) 'cd "$$TMPDIR/destdir" && find \( $(shellcheck.prune) \) -prune -o -not -type d -exec shellcheck $(shellcheck.flags) {} +' -_po_rule = \ -$(srcdir)/po/%(pkg).pot: $(addsuffix /dir.pot,$(pkg.%(pkg))); \ - cat $^ | msguniq -Fi --to-code=UTF-8 > '$@' $(eval $(foreach pkg,$(pkgs),\ - $(subst %(pkg),$(pkg),$(value _po_rule))$(at.nl))) + $(srcdir)/po/$(pkg).pot: $(addsuffix /dir.pot,$(pkg.$(pkg)))$(at.nl))) libretools.out.mans = libretools.out.bins = @@ -51,7 +48,6 @@ libretools.out.libexecs = libretools.out.libs = libretools.out.docs = libretools.out.confs = -libretools.out = $(foreach pkg,$(pkgs),po/$(pkg).pot) files.src.gen += .srcversion-libretools.mk .srcversion-devtools.mk nested.subdirs = $(foreach pkg,$(pkgs),$(pkg.$(pkg))) po diff --git a/po/.gitignore b/po/.gitignore index 514b3d0..406ef00 100644 --- a/po/.gitignore +++ b/po/.gitignore @@ -1,2 +1,2 @@ -*.pot -*/*.mo +*.mo +/header.po.head diff --git a/po/Makefile b/po/Makefile index 1e56edd..96d8490 100644 --- a/po/Makefile +++ b/po/Makefile @@ -6,6 +6,16 @@ locales := $(filter-out .,$(sort $(patsubst %/,%,$(dir $(files.src.src))))) files.src.gen += $(addsuffix .pot,$(domains)) nested.subdirs += $(locales) + +# Have the header include the version number +$(srcdir)/header.po.head: $(srcdir)/%: $(srcdir)/%.in + @echo 'EDIT < $< > $@'; $(libretools.edit) < '$<' > '$@' +$(srcdir)/header.po.head: $(var.)PACKAGE $(var.)VERSION +files.src.int += header.po.head + +# Rely on ../Makefile to fill in a list of our .pot dependencies +$(srcdir)/%.pot: $(srcdir)/header.po.head + cat $^ | msguniq -Fi > '$@' at.subdirs += .. include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/po/es/gitget.po b/po/es/gitget.po index d3478f7..97f06d8 100644 --- a/po/es/gitget.po +++ b/po/es/gitget.po @@ -1,3 +1,18 @@ +# Copyright (C) 2017 David P +# This file is distributed under the same license as the libretools package. +# +msgid "" +msgstr "Project-Id-Version: libretools 20170705\n" + "Report-Msgid-Bugs-To: Parabola Hackers \n" + "PO-Revision-Date: 2017-07-05 19:27-0400\n" + "Last-Translator: David P \n" + "Language-Team: Spanish\n" + "Language: es\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" + "Plural-Forms: nplurals=2; plural=(n != 1);\n" + #: src/gitget/gitget:35 msgid "Failed to change to directory %s" msgstr "Falló al cambiar el directorio %s" diff --git a/po/es/librelib.po b/po/es/librelib.po index 2a8c977..f71b087 100644 --- a/po/es/librelib.po +++ b/po/es/librelib.po @@ -1,3 +1,18 @@ +# Copyright (C) 2017 David P +# This file is distributed under the same license as the libretools package. +# +msgid "" +msgstr "Project-Id-Version: libretools 20170705\n" + "Report-Msgid-Bugs-To: Parabola Hackers \n" + "PO-Revision-Date: 2017-07-05 20:02-0400\n" + "Last-Translator: David P \n" + "Language-Team: Spanish\n" + "Language: es\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" + "Plural-Forms: nplurals=2; plural=(n != 1);\n" + #: src/lib/archroot.sh:62 msgid "Unable to delete subvolume %s" msgstr "Incapaz de eliminar subvolumen %s" diff --git a/po/es/libretools.po b/po/es/libretools.po index 6add814..794051a 100644 --- a/po/es/libretools.po +++ b/po/es/libretools.po @@ -1,3 +1,18 @@ +# Copyright (C) 2017 David P +# This file is distributed under the same license as the libretools package. +# +msgid "" +msgstr "Project-Id-Version: libretools 20170705\n" + "Report-Msgid-Bugs-To: Parabola Hackers \n" + "PO-Revision-Date: 2017-07-06 13:59-0400\n" + "Last-Translator: David P \n" + "Language-Team: Spanish\n" + "Language: es\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" + "Plural-Forms: nplurals=2; plural=(n != 1);\n" + #: src/abslibre-tools/createworkdir:36 msgid "Creating WORKDIR at %s..." msgstr "Creando WORKDIR en %s..." diff --git a/po/es/xbs.po b/po/es/xbs.po index 35bd7f1..880b5df 100644 --- a/po/es/xbs.po +++ b/po/es/xbs.po @@ -1,3 +1,18 @@ +# Copyright (C) 2017 David P +# This file is distributed under the same license as the libretools package. +# +msgid "" +msgstr "Project-Id-Version: libretools 20170705\n" + "Report-Msgid-Bugs-To: Parabola Hackers \n" + "PO-Revision-Date: 2017-07-05 20:22-0400\n" + "Last-Translator: David P \n" + "Language-Team: Spanish\n" + "Language: es\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" + "Plural-Forms: nplurals=2; plural=(n != 1);\n" + #: src/xbs-abs/archrelease:12 msgid "Option requires an argument -- '%s'" msgstr "Las opciones requieren un argumento -- '%s'" diff --git a/po/header.po.head.in b/po/header.po.head.in new file mode 100644 index 0000000..2346080 --- /dev/null +++ b/po/header.po.head.in @@ -0,0 +1,14 @@ +# Copyright (C) YEAR FULL NAME +# This file is distributed under the same license as the @PACKAGE@ package. +# +msgid "" +msgstr "Project-Id-Version: @PACKAGE@ @VERSION@\n" + "Report-Msgid-Bugs-To: Parabola Hackers \n" + "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" + "Last-Translator: FULL NAME \n" + "Language-Team: LANGUAGE \n" + "Language: LANGCODE\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" + "Plural-Forms: nplurals=2; plural=(n != 1);\n" -- cgit v1.2.3-54-g00ecf