From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Cc: Jordi Mallach <jordi@sindominio.net>,
Carles Pina i Estany <carles@pina.cat>
Subject: gettext in build system
Date: Mon, 16 Nov 2009 00:13:55 +0100 [thread overview]
Message-ID: <20091115231355.GA11962@thorin> (raw)
[-- Attachment #1: Type: text/plain, Size: 451 bytes --]
I wrote initial support for gettext in build system. It is available in:
sftp://bzr.savannah.gnu.org/srv/bzr/grub/people/robertmh/gettext/
also attached. It probably still needs some polish, please comment.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
[-- Attachment #2: gettext.diff --]
[-- Type: text/x-diff, Size: 4144 bytes --]
=== modified file 'Makefile.in'
--- Makefile.in 2009-11-15 12:41:25 +0000
+++ Makefile.in 2009-11-15 23:01:10 +0000
@@ -41,6 +41,8 @@ includedir = @includedir@
pkgdatadir = $(datadir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`
pkglibdir = $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed '$(transform)'`
+LINGUAS = ca
+
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
@@ -153,7 +155,7 @@ include $(srcdir)/conf/$(target_cpu)-$(p
### General targets.
-CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA)
+CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
cat $(DEFSYMFILES) /dev/null \
@@ -237,7 +239,7 @@ build_env.mk: Makefile
) > $@
pkglib_BUILDDIR += config.h grub_script.tab.h
-all-local: $(PROGRAMS) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES)
+all-local: $(PROGRAMS) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES) $(foreach lang, $(LINGUAS), po/$(lang).mo)
install: install-local
@@ -301,6 +303,13 @@ install-local: all
dest="`echo $$file | sed 's,.*/,,'`"; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \
done
+ $(foreach lang, $(LINGUAS), \
+ $(SHELL) $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$(lang)/LC_MESSAGES
+ @list='po/$(lang).mo'; \
+ for file in $$list; do \
+ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
+ $(INSTALL_DATA) $$dir$$file $(DESTDIR)/$(datadir)/locale/$(lang)/LC_MESSAGES/grub.mo; \
+ done)
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(infodir)
@list='$(info_INFOS)'; \
for file in $$list; do \
@@ -455,6 +464,16 @@ gensymlist.sh: gensymlist.sh.in config.s
genkernsyms.sh: genkernsyms.sh.in config.status
$(SHELL) ./config.status
+po/messages.pot: po/POTFILES
+ xgettext --from-code=utf-8 --keyword=_ -f $< -o $@
+
+po/*.po: po/messages.pot
+ msgmerge -U $@ po/messages.pot
+
+po/%.mo: po/%.po
+ $(MKDIR_P) $$(dirname $@)
+ msgfmt -c --statistics -o $@ $^
+
.PHONY: all install install-strip uninstall clean mostlyclean distclean
.PHONY: maintainer-clean info dvi dist check
=== added directory 'po'
=== added file 'po/POTFILES'
--- po/POTFILES 1970-01-01 00:00:00 +0000
+++ po/POTFILES 2009-11-15 23:00:07 +0000
@@ -0,0 +1,2 @@
+# List of files which contain translatable strings.
+util/i386/pc/grub-mkimage.c
=== added file 'po/ca.po'
--- po/ca.po 1970-01-01 00:00:00 +0000
+++ po/ca.po 2009-11-15 23:05:55 +0000
@@ -0,0 +1,20 @@
+# Copyright (C) 2009 Free Software Foundation, Inc
+# This file is distributed under the same license as the GNU GRUB package.
+# Robert Millan <rmh.grub@aybabtu.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: GNU GRUB\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-11-16 00:05+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Robert Millan <rmh.grub@aybabtu.com>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: util/i386/pc/grub-mkimage.c:322
+#, c-format
+msgid "Try ``%s --help'' for more information.\n"
+msgstr "Proveu «%s --help» per a obtenir més informació.\n"
=== modified file 'util/i386/pc/grub-mkimage.c'
--- util/i386/pc/grub-mkimage.c 2009-09-24 13:40:40 +0000
+++ util/i386/pc/grub-mkimage.c 2009-11-15 22:59:36 +0000
@@ -33,6 +33,10 @@
#include <string.h>
#include <stdlib.h>
+#include <locale.h>
+#include <libintl.h>
+#define _(str) gettext(str)
+
#define _GNU_SOURCE 1
#include <getopt.h>
@@ -315,7 +319,7 @@ static void
usage (int status)
{
if (status)
- fprintf (stderr, "Try ``grub-mkimage --help'' for more information.\n");
+ fprintf (stderr, _("Try ``%s --help'' for more information.\n"), progname);
else
printf ("\
Usage: grub-mkimage [OPTION]... [MODULES]\n\
@@ -349,6 +353,8 @@ main (int argc, char *argv[])
progname = "grub-mkimage";
+ textdomain ("grub");
+
while (1)
{
int c = getopt_long (argc, argv, "d:p:m:c:o:hVv", options, 0);
next reply other threads:[~2009-11-15 23:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-15 23:13 Robert Millan [this message]
2009-11-15 23:59 ` gettext in build system Robert Millan
2009-11-16 0:23 ` Colin Watson
2009-11-16 19:15 ` Robert Millan
2009-11-16 19:09 ` Jordi Mallach
2009-11-16 19:56 ` Robert Millan
2009-11-16 20:24 ` Robert Millan
2009-11-16 22:34 ` Jordi Mallach
2009-11-16 22:32 ` Jordi Mallach
2009-11-17 10:49 ` Robert Millan
2009-11-17 12:22 ` Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091115231355.GA11962@thorin \
--to=rmh@aybabtu.com \
--cc=carles@pina.cat \
--cc=grub-devel@gnu.org \
--cc=jordi@sindominio.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.