]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Initial support for gettext in build system.
authorRobert Millan <rmh@aybabtu.com>
Sun, 15 Nov 2009 23:11:01 +0000 (23:11 +0000)
committerRobert Millan <rmh@aybabtu.com>
Sun, 15 Nov 2009 23:11:01 +0000 (23:11 +0000)
Makefile.in
po/POTFILES [new file with mode: 0644]
po/ca.po [new file with mode: 0644]
util/i386/pc/grub-mkimage.c

index 89d5189eb355526cd2ae8ae2931be055427ec527..0b599f51ba77d374164553645371cbb41daaaefc 100644 (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
 
diff --git a/po/POTFILES b/po/POTFILES
new file mode 100644 (file)
index 0000000..d99ec54
--- /dev/null
@@ -0,0 +1,2 @@
+# List of files which contain translatable strings.
+util/i386/pc/grub-mkimage.c
diff --git a/po/ca.po b/po/ca.po
new file mode 100644 (file)
index 0000000..4213346
--- /dev/null
+++ b/po/ca.po
@@ -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"
index 15168f8fa8f2d4c1e630e27a369c0d3a822bbdd6..86f4808352472d902833a2060aa85e4774aefce8 100644 (file)
 #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);