Initial support for gettext in build system.

This commit is contained in:
Robert Millan 2009-11-15 23:11:01 +00:00
parent fd6fd3d770
commit ed101e8122
4 changed files with 50 additions and 3 deletions

View file

@ -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)-$(platform).mk
### 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.status
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

2
po/POTFILES Normal file
View file

@ -0,0 +1,2 @@
# List of files which contain translatable strings.
util/i386/pc/grub-mkimage.c

20
po/ca.po Normal file
View file

@ -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"

View file

@ -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);