All of lore.kernel.org
 help / color / mirror / Atom feed
* Fw: gettext support
@ 2009-06-16 21:47 Carles Pina i Estany
  2009-06-16 22:37 ` Vladimir 'phcoder' Serbinenko
  2009-06-17 11:37 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 2 replies; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-16 21:47 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1935 bytes --]


Hello,

Last January I sent a patch to add gettext support. When I had time, the
list was not very, and afterwards I didn't have time.

Hopefully from now on and during next weeks I will have some time to
follow up the discussion, make changes, etc. (not exactly everyday but I
will be able to do, I hope).

Find attached the patch that you can apply with the last version.
Surprisingly, after resolving a couple of conflicts, it works like last
January.

General design:
a) I did a new module called gettext. It uses locale_prefix and lang
variables to locate the .mo file

b) Some strings in Grub (currently only one) uses _("") function to
translate the text. This is a hook function that returns the same text
when the gettext module is not loaded or the translation when it's
loaded

gettext module parses the .mo file without using hash and using
bisection for the searching (if I remember correctly).

The scripts that generates menu.lst also supports (at least some)
gettext support from Bash/Shell itself.

Here you can read the ChangeLog:
http://lists.gnu.org/archive/html/grub-devel/2009-01/msg00118.html and
more instructions

In that thread we talked about some encoding problem. As Niels (I think)
suggested, after setting up the Charset in the .po file it's working
fine.

Right now you would need to "compile" the .po file to .mo file by hand
(directory grub2/po) and then copy to the correct place in your
/usr/share directory, like:
/usr/share/locale/ca/LC_MESSAGES/grub.mo

(you can use this location with this menu.lst:
set locale_prefix=/usr/share/locale
set lang=ca
insmod gettext
)

Comments for next steps to commit the patch are welcomed.
(maybe I need to setup the "path" to access to /usr/share/locale in the
Grub installation script in grub.cfg -e.g. search --fs-uuid ...- or we
can do it afterwards?)

Thanks,

PS: any Grub developer living/working in London?

-- 
Carles Pina i Estany
	http://pinux.info

[-- Attachment #2: gettext10.patch --]
[-- Type: text/x-diff, Size: 17132 bytes --]

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 2334)
+++ Makefile.in	(working copy)
@@ -123,6 +123,7 @@
 PROGRAMS = $(bin_UTILITIES) $(sbin_UTILITIES)
 SCRIPTS = $(bin_SCRIPTS) $(sbin_SCRIPTS) $(grub-mkconfig_SCRIPTS) \
 	$(lib_SCRIPTS)
+GRUBD = $(srcdir)/util/grub.d
 
 CLEANFILES =
 MOSTLYCLEANFILES =
@@ -187,6 +188,11 @@
 endif
 endif
 
+uptrans:
+	xgettext -k_ -LC -o - `find "$(srcdir)/" -name '*.c'` -o po/grub.pot
+	xgettext -k_ -Lshell -o - $(GRUBD)/* -j -o po/grub.pot
+
+
 # Used for building modules externally
 pkglib_BUILDDIR += build_env.mk
 build_env.mk: Makefile
Index: conf/common.rmk
===================================================================
--- conf/common.rmk	(revision 2334)
+++ conf/common.rmk	(working copy)
@@ -154,6 +154,12 @@
 lib_SCRIPTS += update-grub_lib
 CLEANFILES += update-grub_lib
 
+grub-gettext_lib: util/grub-gettext_lib.in config.status
+	./config.status --file=$@:$<
+	chmod +x $@
+lib_DATA += grub-gettext_lib
+CLEANFILES += grub-gettext_lib
+
 %: util/grub.d/%.in config.status
 	./config.status --file=$@:$<
 	chmod +x $@
@@ -354,7 +360,7 @@
 	terminfo.mod test.mod blocklist.mod hexdump.mod		\
 	read.mod sleep.mod loadenv.mod crc.mod parttool.mod	\
 	pcpart.mod memrw.mod normal.mod sh.mod lua.mod	\
-	gptsync.mod true.mod probe.mod
+	gptsync.mod true.mod probe.mod gettext.mod
 
 # For gptsync.mod.
 gptsync_mod_SOURCES = commands/gptsync.c
@@ -586,6 +592,11 @@
 bufio_mod_CFLAGS = $(COMMON_CFLAGS)
 bufio_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
+# For gettext.mod.
+gettext_mod_SOURCES = gettext/gettext.c
+gettext_mod_CFLAGS = $(COMMON_CFLAGS)
+gettext_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 # Misc.
 pkglib_MODULES += xnu_uuid.mod
 
Index: kern/misc.c
===================================================================
--- kern/misc.c	(revision 2334)
+++ kern/misc.c	(working copy)
@@ -24,6 +24,8 @@
 #include <grub/term.h>
 #include <grub/env.h>
 
+const char* (*grub_gettext) (const char *s) = grub_gettext_dummy;
+
 void *
 grub_memmove (void *dest, const void *src, grub_size_t n)
 {
@@ -1080,6 +1082,13 @@
   return p - dest;
 }
 
+/* grub_gettext_dummy is not translating anything.  */
+const char *
+grub_gettext_dummy (const char *s)
+{
+  return s;
+}
+
 /* Abort GRUB. This function does not return.  */
 void
 grub_abort (void)
Index: po/ca.po
===================================================================
--- po/ca.po	(revision 0)
+++ po/ca.po	(revision 0)
@@ -0,0 +1,25 @@
+#: normal/menu.c:90
+#, c-format
+msgid ""
+"\n"
+"      Use the %C and %C keys to select which entry is highlighted.\n"
+msgstr ""
+"\n"
+"      Utilitzeu les tecles %C i %C per seleccionar l'entrada.\n"
+
+#: normal/menu.c:93
+msgid ""
+"      Press enter to boot the selected OS, 'e' to edit the\n"
+"      commands before booting or 'c' for a command-line."
+msgstr ""
+"      Presioneu retorn per arrancar el SO seleccionat, 'e' editar\n"
+"      les comandes abans d'arrancar, 'c' per línia d'ordres."
+
+#: util/grub.d/10_linux.in:143
+#, sh-format
+msgid "${OS}, linux ${version} (recovery mode)"
+msgstr "${OS}, linux ${version} (mode recuperació)"
+
+#, sh-format
+msgid "hello"
+msgstr "hola"
Index: po/TODO
===================================================================
--- po/TODO	(revision 0)
+++ po/TODO	(revision 0)
@@ -0,0 +1,5 @@
+Prepare a Makefile.in to:
+
+-Compile all .po to .mo (msgfmt $LANG.po -o $LANG.mo)
+-Copy to /usr/share/locale/$LANG/LC_MESSAGES/grub.mo (or /usr/local/share/locale/$LANG/LC_MESSAGES/..., so $prefix...)
+-Check that grub-gettext_lib.in is correct
Index: include/grub/misc.h
===================================================================
--- include/grub/misc.h	(revision 2334)
+++ include/grub/misc.h	(working copy)
@@ -1,7 +1,7 @@
 /* misc.h - prototypes for misc functions */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008,2009  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -32,6 +32,8 @@
 /* XXX: If grub_memmove is too slow, we must implement grub_memcpy.  */
 #define grub_memcpy(d,s,n)	grub_memmove ((d), (s), (n))
 
+#define _(s)	grub_gettext(s)
+
 void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n);
 char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src);
 char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c);
@@ -97,6 +99,9 @@
 grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
 					  grub_uint32_t d, grub_uint32_t *r);
 
+const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s);
+extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);// = grub_gettext_dummy;
+
 #ifdef NEED_ENABLE_EXECUTE_STACK
 void EXPORT_FUNC(__enable_execute_stack) (void *addr);
 #endif
Index: gettext/gettext.c
===================================================================
--- gettext/gettext.c	(revision 0)
+++ gettext/gettext.c	(revision 0)
@@ -0,0 +1,300 @@
+/* gettext.c - gettext module */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/types.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
+#include <grub/err.h>
+#include <grub/dl.h>
+#include <grub/normal.h>
+#include <grub/file.h>
+#include <grub/kernel.h>
+
+/* 
+   .mo file information from: 
+   http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html .
+*/
+
+
+static grub_file_t grub_mofile_open (const char *name);
+static grub_file_t fd_mo;
+
+static int grub_gettext_offsetoriginal;
+static int grub_gettext_max;
+
+static const char* (*grub_gettext_original) (const char *s);
+
+#define GETTEXT_MAGIC_NUMBER 0
+#define GETTEXT_FILE_FORMAT 4
+#define GETTEXT_NUMBER_OF_STRINGS 8
+#define GETTEXT_OFFSET_ORIGINAL 12
+#define GETTEXT_OFFSET_TRANSLATION 16
+
+static int
+grub_gettext_get_info (int offset)
+{
+  int buf;
+
+  grub_file_seek (fd_mo, offset);
+  grub_file_read (fd_mo, (char*) &buf, 4);
+  return buf;
+}
+
+static void
+grub_gettext_getstring_from_offset (int offset, int length, char *translation)
+{
+  grub_file_seek (fd_mo,offset);
+  grub_file_read (fd_mo,translation,length);
+  translation[length] = '\0';
+}
+
+static char*
+grub_gettext_gettranslation_number (int i)
+{
+  int offsettranslation;
+  int position;
+  int length, offset;
+  char *translation;
+
+  offsettranslation = grub_gettext_get_info (GETTEXT_OFFSET_TRANSLATION);
+
+  position=offsettranslation+i*8;
+
+  grub_file_seek (fd_mo, position);
+  grub_file_read (fd_mo, (char*) &length, 4);
+  
+  grub_file_seek (fd_mo, position + 4),
+  grub_file_read (fd_mo, (char*) &offset, 4);
+
+  translation = grub_malloc(length + 1);
+  grub_gettext_getstring_from_offset (offset, length, translation);
+
+  return translation;
+}
+
+static char*
+grub_gettext_getstring_num (int num)
+{
+  int position;
+  int length, offset;
+  char *original;
+
+  /* Get position for string i.  */
+  position = grub_gettext_offsetoriginal + (num * 8);
+
+  /* Get the length of the string i.  */
+  grub_file_seek (fd_mo, position);
+  grub_file_read (fd_mo, (char *) &length, 4);
+
+  /* Get the offset of the string i.  */
+  grub_file_seek (fd_mo, position + 4);
+  grub_file_read (fd_mo, (char *) &offset, 4);
+
+  /* Get the string i.  */
+  original = grub_malloc (length + 1);
+  grub_gettext_getstring_from_offset (offset, length, original);
+
+  return original;
+}
+
+static const char*
+grub_gettext_translate (const char *orig)
+{
+  char *current_string;
+  char *ret;
+
+  int min,max,current;
+
+  if (fd_mo == 0)
+    return orig;
+
+  min = 0;
+  max = grub_gettext_max;
+
+  current = (max + min) / 2;
+
+  while (current != min && current != max)
+    {
+      current_string = grub_gettext_getstring_num (current);
+      /* grub_printf("Current: %s\n",current_string);  */
+
+      /* Search by bissection.  */
+      if (grub_strcmp (current_string, orig) < 0)
+        {
+          grub_free(current_string);
+          min=current;
+        }
+      else if (grub_strcmp (current_string, orig) > 0)
+        {
+          grub_free(current_string);
+          max=current;
+        }
+      else if (grub_strcmp (current_string, orig) == 0)
+        {
+          grub_free(current_string);
+          return grub_gettext_gettranslation_number (current);
+        }
+    current = (max+min)/2;
+    }
+
+  ret = grub_malloc(grub_strlen(orig) + 1);
+  grub_strcpy(ret,orig);
+  return ret;
+}
+
+// XXX: Return a real grub_err_t or static void
+/*static grub_err_t
+grub_cmd_translate (struct grub_arg_list *state __attribute__ ((unused)),
+		int argc __attribute__ ((unused)),
+		char **args __attribute__ ((unused)))
+{
+  if (argc != 1)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "text to translate required");
+
+  char *translation;
+
+  translation = grub_gettext_translate(args[0]);
+  grub_printf("%s\n",translation);
+  //grub_printf("grub__: %d\n",grub__);
+
+  return 0;
+}
+*/
+
+/* This is similar to grub_gzfile_open. */
+static grub_file_t
+grub_mofile_open (const char *filename)
+{
+  int unsigned magic;
+  int version;
+
+  /* Using fd_mo and not another variable because
+     it's needed for grub_gettext_get_info.  */
+
+  fd_mo = grub_file_open (filename);
+  if (! fd_mo)
+    {
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "Cannot read %s",filename);
+      return 0;
+    }
+
+  magic = grub_gettext_get_info (GETTEXT_MAGIC_NUMBER);
+
+  if (magic != 0x950412de)
+    {
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, "mo: invalid mo file: %s", filename);
+      grub_file_close (fd_mo);
+      fd_mo = 0;
+      return 0;
+    }
+  
+  version = grub_gettext_get_info (GETTEXT_FILE_FORMAT);
+
+  if (version != 0)
+    {
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, "mo: invalid mo version in file: %s", filename);
+      fd_mo = 0;
+      return 0;
+    }
+  
+  /*
+  Do we want .mo.gz files? Then, the code:
+  file = grub_gzio_open (io, 0); // 0: transparent
+  if (! file)
+    {
+      grub_printf("Problems opening the file\n");
+      grub_file_close (io);
+      return 0;
+    }
+  */
+
+  return fd_mo;
+}
+
+static void
+grub_gettext_init_ext (const char *lang)
+{
+  char *mo_file;
+  char *locale_prefix;
+
+  locale_prefix = grub_env_get ("locale_prefix");
+  
+  fd_mo = 0;
+      
+  // mo_file e.g.: /usr/share/locale/ca/LC_MESSAGES/grub.mo
+
+  mo_file = grub_malloc (grub_strlen (locale_prefix) + sizeof ("/") + grub_strlen (lang) + sizeof ("/LC_MESSAGES/grub.mo"));
+      
+  if (! mo_file)
+    return;
+
+  grub_sprintf (mo_file, "%s/%s/LC_MESSAGES/grub.mo", locale_prefix, lang);
+  /* XXX: lang is written by the user, need to sanitaze the input?  */
+
+  fd_mo = grub_mofile_open(mo_file);
+  grub_free (mo_file);
+
+  if (fd_mo)
+    {
+      grub_gettext_offsetoriginal = grub_gettext_get_info(GETTEXT_OFFSET_ORIGINAL);
+      grub_gettext_max = grub_gettext_get_info(GETTEXT_NUMBER_OF_STRINGS);
+
+      grub_gettext_original = grub_gettext;
+      grub_gettext = grub_gettext_translate;
+    }
+}
+
+static char*
+grub_gettext_env_write_lang (struct grub_env_var *var __attribute__ ((unused)),
+			     const char *val)
+{
+  grub_gettext_init_ext (val);
+
+  return grub_strdup (val);
+}
+
+GRUB_MOD_INIT(gettext)
+{
+  (void)mod;			/* To stop warning.  */
+ 
+  const char *lang;
+
+  lang = grub_env_get ("lang"); 
+
+  grub_gettext_init_ext (lang);
+
+  /* Testing:
+  grub_register_command ("_", grub_cmd_translate, GRUB_COMMAND_FLAG_BOTH,
+			 "_", "internalization support trans", 0);
+  */
+
+  /* Reload .mo file information if lang changes.  */
+  grub_register_variable_hook ("lang", NULL, grub_gettext_env_write_lang);
+
+  /* Preserve hooks after context changes.  */
+  grub_env_export ("lang");
+}
+
+GRUB_MOD_FINI(gettext)
+{
+  if (fd_mo != 0)
+    grub_file_close(fd_mo);
+
+  grub_gettext = grub_gettext_original;
+}
Index: normal/menu_text.c
===================================================================
--- normal/menu_text.c	(revision 2334)
+++ normal/menu_text.c	(working copy)
@@ -93,8 +93,8 @@
     }
   else
     {
-      grub_printf ("\n\
-      Use the %C and %C keys to select which entry is highlighted.\n",
+      grub_printf (_("\n\
+      Use the %C and %C keys to select which entry is highlighted.\n"),
 		   (grub_uint32_t) GRUB_TERM_DISP_UP, (grub_uint32_t) GRUB_TERM_DISP_DOWN);
       grub_printf ("\
       Press enter to boot the selected OS, \'e\' to edit the\n\
Index: util/grub.d/10_linux.in
===================================================================
--- util/grub.d/10_linux.in	(revision 2334)
+++ util/grub.d/10_linux.in	(working copy)
@@ -141,10 +141,10 @@
     linux_root_device_thisversion=${GRUB_DEVICE}
   fi
 
-  linux_entry "${OS}, Linux ${version}" \
-      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
-  linux_entry "${OS}, Linux ${version} (recovery mode)" \
-      "single ${GRUB_CMDLINE_LINUX}"
+  linux_entry $eval_gettext ("${OS}, Linux ${version}" \
+      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}")
+  linux_entry $eval_gettext ("${OS}, Linux ${version} (recovery mode)" \
+      "single ${GRUB_CMDLINE_LINUX}")
 
   list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
 done
Index: util/grub.d/00_header.in
===================================================================
--- util/grub.d/00_header.in	(revision 2334)
+++ util/grub.d/00_header.in	(working copy)
@@ -22,6 +22,7 @@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 grub_prefix=`echo /boot/grub | sed ${transform}`
+locale_prefix="/usr/share/locale" # TODO: dynamic with exec_prefix ?
 
 . ${libdir}/grub/grub-mkconfig_lib
 
@@ -112,3 +113,18 @@
 EOF
   ;;
 esac
+
+if test -e ${grub_prefix}/gettext.mod -a -d /usr/share/locale; then
+  # Make the locales accesible
+  prepare_grub_to_access_device `${grub_probe} --target=device ${locale_prefix}`
+  lang=`get_locale_lang`
+  grub_locale_prefix=`make_system_path_relative_to_its_root ${locale_prefix}`
+  cat << EOF
+# Gettext variables and module
+set locale_prefix=${grub_locale_prefix}
+set lang=${lang}
+insmod gettext 
+EOF
+else
+  echo "gettext module is not available"
+fi
Index: util/grub-gettext_lib.in
===================================================================
--- util/grub-gettext_lib.in	(revision 0)
+++ util/grub-gettext_lib.in	(revision 0)
@@ -0,0 +1,23 @@
+# Configuration of grub-gettext
+# Copyright (C) 2009  Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+
+TEXTDOMAINDIR=@prefix@/share/locale
+TEXTDOMAIN=grub
+. gettext.sh

Property changes on: util/grub-gettext_lib.in
___________________________________________________________________
Added: svn:mergeinfo

Index: util/grub-mkconfig_lib.in
===================================================================
--- util/grub-mkconfig_lib.in	(revision 2334)
+++ util/grub-mkconfig_lib.in	(working copy)
@@ -176,3 +176,14 @@
   fi
   return 0
 }
+
+get_locale_lang ()
+{
+  lang="`echo ${LANG} | cut -d _ -f 1`"
+  if [ "x${lang}" = "x" ] ; then
+    return 1
+  else
+    echo "${lang}"
+    return 0
+  fi
+}

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-16 21:47 Fw: gettext support Carles Pina i Estany
@ 2009-06-16 22:37 ` Vladimir 'phcoder' Serbinenko
  2009-06-17 11:37 ` Vladimir 'phcoder' Serbinenko
  1 sibling, 0 replies; 46+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-06-16 22:37 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 2715 bytes --]

Hello. Welcome back and your work is appreciated. I will look at the patch
later (In couple minutes I go to sleep)

On Tue, Jun 16, 2009 at 11:47 PM, Carles Pina i Estany <carles@pina.cat>wrote:

>
> Hello,
>
> Last January I sent a patch to add gettext support. When I had time, the
> list was not very, and afterwards I didn't have time.
>
> Hopefully from now on and during next weeks I will have some time to
> follow up the discussion, make changes, etc. (not exactly everyday but I
> will be able to do, I hope).
>
> Find attached the patch that you can apply with the last version.
> Surprisingly, after resolving a couple of conflicts, it works like last
> January.
>
> General design:
> a) I did a new module called gettext. It uses locale_prefix and lang
> variables to locate the .mo file
>
> b) Some strings in Grub (currently only one) uses _("") function to
> translate the text. This is a hook function that returns the same text
> when the gettext module is not loaded or the translation when it's
> loaded
>
> gettext module parses the .mo file without using hash and using
> bisection for the searching (if I remember correctly).
>
> The scripts that generates menu.lst also supports (at least some)
> gettext support from Bash/Shell itself.
>
> Here you can read the ChangeLog:
> http://lists.gnu.org/archive/html/grub-devel/2009-01/msg00118.html and
> more instructions
>
> In that thread we talked about some encoding problem. As Niels (I think)
> suggested, after setting up the Charset in the .po file it's working
> fine.
>
> Right now you would need to "compile" the .po file to .mo file by hand
> (directory grub2/po) and then copy to the correct place in your
> /usr/share directory, like:
> /usr/share/locale/ca/LC_MESSAGES/grub.mo
>
> (you can use this location with this menu.lst:
> set locale_prefix=/usr/share/locale
> set lang=ca
> insmod gettext
> )
>
> Comments for next steps to commit the patch are welcomed.
> (maybe I need to setup the "path" to access to /usr/share/locale in the
> Grub installation script in grub.cfg -e.g. search --fs-uuid ...- or we
> can do it afterwards?)
>
 I already commented on this issue: simply don't use /usr. It may be
inacessible (e.g. encrypted). Just make grub-install to copy locale files to
$prefix or to $prefix/locale and then you don't need a separate variable for
locale prefix (just use $prefix or $prefix/locale)

>
> Thanks,
>
> PS: any Grub developer living/working in London?
>
> --
> Carles Pina i Estany
>        http://pinux.info
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>


-- 
Regards
Vladimir 'phcoder' Serbinenko

[-- Attachment #2: Type: text/html, Size: 3678 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-16 21:47 Fw: gettext support Carles Pina i Estany
  2009-06-16 22:37 ` Vladimir 'phcoder' Serbinenko
@ 2009-06-17 11:37 ` Vladimir 'phcoder' Serbinenko
  2009-06-17 20:29   ` Carles Pina i Estany
  2009-06-18 20:56   ` Carles Pina i Estany
  1 sibling, 2 replies; 46+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-06-17 11:37 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 714 bytes --]

Hello


> Comments for next steps to commit the patch are welcomed.

Quick look revealed that you haven't taken into account my comments exposed
here:  http://lists.gnu.org/archive/html/grub-devel/2009-04/msg00181.html

>
> (maybe I need to setup the "path" to access to /usr/share/locale in the
> Grub installation script in grub.cfg -e.g. search --fs-uuid ...- or we
> can do it afterwards?)
>
> Thanks,
>
> PS: any Grub developer living/working in London?
>
> --
> Carles Pina i Estany
>        http://pinux.info
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>


-- 
Regards
Vladimir 'phcoder' Serbinenko

[-- Attachment #2: Type: text/html, Size: 1438 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-17 11:37 ` Vladimir 'phcoder' Serbinenko
@ 2009-06-17 20:29   ` Carles Pina i Estany
  2009-06-18 13:38     ` Robert Millan
  2009-06-18 20:56   ` Carles Pina i Estany
  1 sibling, 1 reply; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-17 20:29 UTC (permalink / raw)
  To: The development of GRUB 2


Hi,

On Jun/17/2009, Vladimir 'phcoder' Serbinenko wrote:
> Hello
> 
> 
> > Comments for next steps to commit the patch are welcomed.
> 
> Quick look revealed that you haven't taken into account my comments exposed
> here:  http://lists.gnu.org/archive/html/grub-devel/2009-04/msg00181.html

Right, I will do that improvements soon and send the patch again. I
think that I saw it on April and after that I forgot it (it was when I
didn't have time...)

Thanks!

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-17 20:29   ` Carles Pina i Estany
@ 2009-06-18 13:38     ` Robert Millan
  2009-06-18 14:45       ` Vladimir 'phcoder' Serbinenko
  2009-06-18 19:30       ` Carles Pina i Estany
  0 siblings, 2 replies; 46+ messages in thread
From: Robert Millan @ 2009-06-18 13:38 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: david.planella

On Wed, Jun 17, 2009 at 09:29:13PM +0100, Carles Pina i Estany wrote:
> 
> Hi,
> 
> On Jun/17/2009, Vladimir 'phcoder' Serbinenko wrote:
> > Hello
> > 
> > 
> > > Comments for next steps to commit the patch are welcomed.
> > 
> > Quick look revealed that you haven't taken into account my comments exposed
> > here:  http://lists.gnu.org/archive/html/grub-devel/2009-04/msg00181.html
> 
> Right, I will do that improvements soon and send the patch again. I
> think that I saw it on April and after that I forgot it (it was when I
> didn't have time...)

Hi Carles,

Could you give an estimate?  Ubuntu folks are very interested in this
feature (if it'll take too long, I might be able to help sorting out
the issues).

P.S: Please keep David on CC

Thanks!

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-18 13:38     ` Robert Millan
@ 2009-06-18 14:45       ` Vladimir 'phcoder' Serbinenko
  2009-06-18 21:07         ` Carles Pina i Estany
  2009-06-19 10:32         ` Robert Millan
  2009-06-18 19:30       ` Carles Pina i Estany
  1 sibling, 2 replies; 46+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-06-18 14:45 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: david.planella

On Thu, Jun 18, 2009 at 3:38 PM, Robert Millan<rmh@aybabtu.com> wrote:
> On Wed, Jun 17, 2009 at 09:29:13PM +0100, Carles Pina i Estany wrote:
>>
>> Hi,
>>
>> On Jun/17/2009, Vladimir 'phcoder' Serbinenko wrote:
>> > Hello
>> >
>> >
>> > > Comments for next steps to commit the patch are welcomed.
>> >
>> > Quick look revealed that you haven't taken into account my comments exposed
>> > here:  http://lists.gnu.org/archive/html/grub-devel/2009-04/msg00181.html
>>
>> Right, I will do that improvements soon and send the patch again. I
>> think that I saw it on April and after that I forgot it (it was when I
>> didn't have time...)
>
> Hi Carles,
>
> Could you give an estimate?  Ubuntu folks are very interested in this
> feature (if it'll take too long, I might be able to help sorting out
> the issues).
If you want I'll add compilation po to mo to build system.
>
> P.S: Please keep David on CC
>
> Thanks!
>
> --
> 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."
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-18 13:38     ` Robert Millan
  2009-06-18 14:45       ` Vladimir 'phcoder' Serbinenko
@ 2009-06-18 19:30       ` Carles Pina i Estany
  1 sibling, 0 replies; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-18 19:30 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: david.planella


Hi,

On Jun/18/2009, Robert Millan wrote:
> On Wed, Jun 17, 2009 at 09:29:13PM +0100, Carles Pina i Estany wrote:
> > 
> > Hi,
> > 
> > On Jun/17/2009, Vladimir 'phcoder' Serbinenko wrote:
> > > Hello
> > > 
> > > 
> > > > Comments for next steps to commit the patch are welcomed.
> > > 
> > > Quick look revealed that you haven't taken into account my comments exposed
> > > here:  http://lists.gnu.org/archive/html/grub-devel/2009-04/msg00181.html
> > 
> > Right, I will do that improvements soon and send the patch again. I
> > think that I saw it on April and after that I forgot it (it was when I
> > didn't have time...)
> 
> Hi Carles,
> 
> Could you give an estimate?  Ubuntu folks are very interested in this
> feature (if it'll take too long, I might be able to help sorting out
> the issues).

My plan is that next days/weeks I will be quite available and I can
dedicate many hours to it. So if Vladimir and others helps with the
building system, and already having a working implementation from last
January, it should not take more than some weeks to have it. I hope, at
least.

> P.S: Please keep David on CC

done :)

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-17 11:37 ` Vladimir 'phcoder' Serbinenko
  2009-06-17 20:29   ` Carles Pina i Estany
@ 2009-06-18 20:56   ` Carles Pina i Estany
  2009-06-19 10:37     ` Robert Millan
  1 sibling, 1 reply; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-18 20:56 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 4106 bytes --]


Hello,

On Jun/17/2009, Vladimir 'phcoder' Serbinenko wrote:
> Hello
> 
> 
> > Comments for next steps to commit the patch are welcomed.
> 
> Quick look revealed that you haven't taken into account my comments exposed
> here:  http://lists.gnu.org/archive/html/grub-devel/2009-04/msg00181.html

I will copy-paste your comments and my reply with the attached patch.
I will comment only the concerns about things that are not about the
building system (this will come in another mail)

http://lists.gnu.org/archive/html/grub-devel/2009-04/msg00181.html

(double quote is me, single quote is vladimir)

> >         -Copy ca.mo to /usr/share/locale/ca/LC_MESSAGES/grub.mo 
> 
> Languages files should go to a subdir of $PREFIX. E.g. to
> $PREFIX/langs/$LANG.mo linux directories may be inaccessible 

Now the gettext module will search in $prefix/locale/lang.mo, where lang
is the variable that the user will setup in grub.cfg (e.g. ca for
catalan) and $prefix is usually /boot/grub

> > -I have seen that Grub2 is not printing correctly the accents,
> > could be a problem in gettext or in some other layer
> 
> Did you load unifont as your font? Are you in gfxterm mode? Plain pc
> console can't output unicode characters because it uses fixed-width
> 8-bit font. Perhaps loading the characters most useful for current
> languages to the upper 128 characters would be an option. OR we can just
> tell everyone to use gfxterm 

It's working fine, it was a problem generating the .mo file (I didnt'
setup the correct charset)

> > Index: gettext/gettext.c
> > ===================================================================
> > --- gettext/gettext.c   (revision 0)
> > +++ gettext/gettext.c   (revision 0)
> > +static int
> > +grub_gettext_get_info (int offset)
> > +{
> > +  int buf;

> Use grub_uint32_t here. Also be aware of endianness. It should be

Done!

> >grub_gettext_translation_number is a bit a misnomer because this name
> > would suggest transforming translation into number 

change from grub_gettext_translation_number (int i) to
grub_gettext_translation_from_position (int position) 
Don't confuse the string in position "N" with the position (in bytes) of
the string inside the file (called internal_position). I'm still not
happy with the names...

> > +  position=offsettranslation+i*8;
> Please respect GCS. This should be position = offsettranslation + i *
> 8; 

Done!

> > +  ret = grub_malloc(grub_strlen(orig) + 1);
> > +  grub_strcpy(ret,orig);
> > +  return ret;
> This would fail if the string isn't present at all in .mo 

I think that it's fine. If the string is in the .mo file, it will return
before:
      else if (grub_strcmp (current_string, orig) == 0)
        {
          grub_free(current_string);
          return grub_gettext_gettranslation_from_position (current);
        }

If we don't find the string, it will return the string that we wanted to
translate (orig is the original string).
So if grub tries to translate something that it's not in the .mo file we
will return the same string.

> >         + if (magic != 0x950412de) 
> A define instead of hardcoded number is suggested 

Done!

> >         + locale_prefix = grub_env_get ("locale_prefix"); 
> You need to treat the case when no locale_prefix is defined. I suggest
> to put a default $prefix/locale 

Done!

> >         +  grub_sprintf (mo_file, "%s/%s/LC_MESSAGES/grub.mo",
> > locale_prefix, lang);
> >         +  /* XXX: lang is written by the user, need to sanitaze the
> > input?  */

> I suggest
> grub_sprintf (mo_file, "%s/%s.mo", locale_prefix, lang);
> because .mo need to reside together with grub so all LC_MESSAGE is just
> unnecessary

Your way is easier. Previous way was talked with Robert, but then it
still needed some work in grub.cfg to detect the directory and in my
opinion is quite clear to have all grub stuff all together.

I send attached the patch. I will comment things that executes outside
grub environment (so, during the installation) in some other mail.

Thanks for all feedback and sorry to take so long to answer :-)

-- 
Carles Pina i Estany
	http://pinux.info

[-- Attachment #2: gettext11.patch --]
[-- Type: text/x-diff, Size: 16229 bytes --]

Index: conf/common.rmk
===================================================================
--- conf/common.rmk	(revision 2343)
+++ conf/common.rmk	(working copy)
@@ -154,6 +154,12 @@
 lib_SCRIPTS += update-grub_lib
 CLEANFILES += update-grub_lib
 
+grub-gettext_lib: util/grub-gettext_lib.in config.status
+	./config.status --file=$@:$<
+	chmod +x $@
+lib_DATA += grub-gettext_lib
+CLEANFILES += grub-gettext_lib
+
 %: util/grub.d/%.in config.status
 	./config.status --file=$@:$<
 	chmod +x $@
@@ -354,7 +360,7 @@
 	terminfo.mod test.mod blocklist.mod hexdump.mod		\
 	read.mod sleep.mod loadenv.mod crc.mod parttool.mod	\
 	pcpart.mod memrw.mod normal.mod sh.mod lua.mod	\
-	gptsync.mod true.mod probe.mod
+	gptsync.mod true.mod probe.mod gettext.mod
 
 # For gptsync.mod.
 gptsync_mod_SOURCES = commands/gptsync.c
@@ -586,6 +592,11 @@
 bufio_mod_CFLAGS = $(COMMON_CFLAGS)
 bufio_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
+# For gettext.mod.
+gettext_mod_SOURCES = gettext/gettext.c
+gettext_mod_CFLAGS = $(COMMON_CFLAGS)
+gettext_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 # Misc.
 pkglib_MODULES += xnu_uuid.mod
 
Index: kern/misc.c
===================================================================
--- kern/misc.c	(revision 2343)
+++ kern/misc.c	(working copy)
@@ -24,6 +24,8 @@
 #include <grub/term.h>
 #include <grub/env.h>
 
+const char* (*grub_gettext) (const char *s) = grub_gettext_dummy;
+
 void *
 grub_memmove (void *dest, const void *src, grub_size_t n)
 {
@@ -1080,6 +1082,13 @@
   return p - dest;
 }
 
+/* grub_gettext_dummy is not translating anything.  */
+const char *
+grub_gettext_dummy (const char *s)
+{
+  return s;
+}
+
 /* Abort GRUB. This function does not return.  */
 void
 grub_abort (void)
Index: po/ca.po
===================================================================
--- po/ca.po	(revision 0)
+++ po/ca.po	(revision 0)
@@ -0,0 +1,25 @@
+#: normal/menu.c:90
+#, c-format
+msgid ""
+"\n"
+"      Use the %C and %C keys to select which entry is highlighted.\n"
+msgstr ""
+"\n"
+"      Utilitzeu les tecles %C i %C per seleccionar l'entrada.\n"
+
+#: normal/menu.c:93
+msgid ""
+"      Press enter to boot the selected OS, 'e' to edit the\n"
+"      commands before booting or 'c' for a command-line."
+msgstr ""
+"      Presioneu retorn per arrancar el SO seleccionat, 'e' editar\n"
+"      les comandes abans d'arrancar, 'c' per línia d'ordres."
+
+#: util/grub.d/10_linux.in:143
+#, sh-format
+msgid "${OS}, linux ${version} (recovery mode)"
+msgstr "${OS}, linux ${version} (mode recuperació)"
+
+#, sh-format
+msgid "hello"
+msgstr "hola"
Index: po/TODO
===================================================================
--- po/TODO	(revision 0)
+++ po/TODO	(revision 0)
@@ -0,0 +1,5 @@
+Prepare a Makefile.in to:
+
+-Compile all .po to .mo (msgfmt $LANG.po -o $LANG.mo)
+-Copy to /usr/share/locale/$LANG/LC_MESSAGES/grub.mo (or /usr/local/share/locale/$LANG/LC_MESSAGES/..., so $prefix...)
+-Check that grub-gettext_lib.in is correct
Index: include/grub/misc.h
===================================================================
--- include/grub/misc.h	(revision 2343)
+++ include/grub/misc.h	(working copy)
@@ -1,7 +1,7 @@
 /* misc.h - prototypes for misc functions */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008,2009  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -32,6 +32,8 @@
 /* XXX: If grub_memmove is too slow, we must implement grub_memcpy.  */
 #define grub_memcpy(d,s,n)	grub_memmove ((d), (s), (n))
 
+#define _(s)	grub_gettext(s)
+
 void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n);
 char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src);
 char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c);
@@ -97,6 +99,9 @@
 grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
 					  grub_uint32_t d, grub_uint32_t *r);
 
+const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s);
+extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);// = grub_gettext_dummy;
+
 #ifdef NEED_ENABLE_EXECUTE_STACK
 void EXPORT_FUNC(__enable_execute_stack) (void *addr);
 #endif
Index: gettext/gettext.c
===================================================================
--- gettext/gettext.c	(revision 0)
+++ gettext/gettext.c	(revision 0)
@@ -0,0 +1,285 @@
+/* gettext.c - gettext module */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/types.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
+#include <grub/err.h>
+#include <grub/dl.h>
+#include <grub/normal.h>
+#include <grub/file.h>
+#include <grub/kernel.h>
+
+/* 
+   .mo file information from: 
+   http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html .
+*/
+
+
+static grub_file_t grub_mofile_open (const char *name);
+static grub_file_t fd_mo;
+
+static int grub_gettext_offsetoriginal;
+static int grub_gettext_max;
+
+static const char* (*grub_gettext_original) (const char *s);
+
+#define GETTEXT_MAGIC_NUMBER 0
+#define GETTEXT_FILE_FORMAT 4
+#define GETTEXT_NUMBER_OF_STRINGS 8
+#define GETTEXT_OFFSET_ORIGINAL 12
+#define GETTEXT_OFFSET_TRANSLATION 16
+
+#define MO_MAGIC_NUMBER 0x950412de
+
+static grub_uint32_t
+grub_gettext_get_info (int offset)
+{
+  grub_uint32_t value;
+
+  grub_file_seek (fd_mo, offset);
+  grub_file_read (fd_mo, (char*) &value, 4);
+  value = grub_cpu_to_le32 (value);
+  return value;
+}
+
+static void
+grub_gettext_getstring_from_offset (grub_uint32_t offset, grub_uint32_t length, char *translation)
+{
+  grub_file_seek (fd_mo, offset);
+  grub_file_read (fd_mo, translation, length);
+  translation[length] = '\0';
+}
+
+static char*
+grub_gettext_gettranslation_from_position (int position)
+{
+  int offsettranslation;
+  int internal_position;
+  grub_uint32_t length, offset;
+  char *translation;
+
+  offsettranslation = grub_gettext_get_info (GETTEXT_OFFSET_TRANSLATION);
+
+  internal_position = offsettranslation + position * 8;
+
+  grub_file_seek (fd_mo, internal_position);
+  grub_file_read (fd_mo, (char*) &length, 4);
+  length = grub_cpu_to_le32 (length);
+  
+  grub_file_seek (fd_mo, internal_position + 4),
+  grub_file_read (fd_mo, (char*) &offset, 4);
+  offset = grub_cpu_to_le32 (offset);
+
+  translation = grub_malloc(length + 1);
+  grub_gettext_getstring_from_offset (offset, length, translation);
+
+  return translation;
+}
+
+static char*
+grub_gettext_getstring_from_position (int position)
+{
+  int internal_position;
+  int length, offset;
+  char *original;
+
+  /* Get position for string i.  */
+  internal_position = grub_gettext_offsetoriginal + (position * 8);
+
+  /* Get the length of the string i.  */
+  grub_file_seek (fd_mo, internal_position);
+  grub_file_read (fd_mo, (char *) &length, 4);
+
+  /* Get the offset of the string i.  */
+  grub_file_seek (fd_mo, internal_position + 4);
+  grub_file_read (fd_mo, (char *) &offset, 4);
+
+  /* Get the string i.  */
+  original = grub_malloc (length + 1);
+  grub_gettext_getstring_from_offset (offset, length, original);
+
+  return original;
+}
+
+static const char*
+grub_gettext_translate (const char *orig)
+{
+  char *current_string;
+  char *ret;
+
+  int min,max,current;
+
+  if (fd_mo == 0)
+    return orig;
+
+  min = 0;
+  max = grub_gettext_max;
+
+  current = (max + min) / 2;
+
+  while (current != min && current != max)
+    {
+      current_string = grub_gettext_getstring_from_position (current);
+
+      /* Search by bisection.  */
+      if (grub_strcmp (current_string, orig) < 0)
+        {
+          grub_free(current_string);
+          min=current;
+        }
+      else if (grub_strcmp (current_string, orig) > 0)
+        {
+          grub_free(current_string);
+          max=current;
+        }
+      else if (grub_strcmp (current_string, orig) == 0)
+        {
+          grub_free(current_string);
+          return grub_gettext_gettranslation_from_position (current);
+        }
+    current = (max+min)/2;
+    }
+
+  ret = grub_malloc(grub_strlen(orig) + 1);
+  grub_strcpy(ret,orig);
+  return ret;
+}
+
+/* This is similar to grub_gzfile_open. */
+static grub_file_t
+grub_mofile_open (const char *filename)
+{
+  int unsigned magic;
+  int version;
+
+  /* Using fd_mo and not another variable because
+     it's needed for grub_gettext_get_info.  */
+
+  fd_mo = grub_file_open (filename);
+  if (! fd_mo)
+    {
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "Cannot read %s",filename);
+      return 0;
+    }
+
+  magic = grub_gettext_get_info (GETTEXT_MAGIC_NUMBER);
+
+  if (magic != MO_MAGIC_NUMBER)
+    {
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, "mo: invalid mo file: %s", filename);
+      grub_file_close (fd_mo);
+      fd_mo = 0;
+      return 0;
+    }
+  
+  version = grub_gettext_get_info (GETTEXT_FILE_FORMAT);
+
+  if (version != 0)
+    {
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, "mo: invalid mo version in file: %s", filename);
+      fd_mo = 0;
+      return 0;
+    }
+  
+  /*
+  Do we want .mo.gz files? Then, the code:
+  file = grub_gzio_open (io, 0); // 0: transparent
+  if (! file)
+    {
+      grub_printf("Problems opening the file\n");
+      grub_file_close (io);
+      return 0;
+    }
+  */
+
+  return fd_mo;
+}
+
+static void
+grub_gettext_init_ext (const char *lang)
+{
+  char *mo_file;
+  char *grub_prefix;
+
+  grub_prefix = grub_env_get ("prefix");
+  
+  fd_mo = 0;
+      
+  // mo_file e.g.: /boot/grub/locale/ca.mo
+
+  mo_file = grub_malloc (grub_strlen (grub_prefix) + sizeof ("/locale/") + grub_strlen (lang) + sizeof(".mo"));
+ 
+  // Warning: if changing some paths in the below line, change the grub_malloc
+  // contents below
+ 
+  grub_sprintf (mo_file, "%s/locale/%s.mo", grub_prefix, lang);
+  grub_dprintf(" -------------- %s ",mo_file);
+
+  fd_mo = grub_mofile_open(mo_file);
+  grub_free (mo_file);
+
+  if (fd_mo)
+    {
+      grub_gettext_offsetoriginal = grub_gettext_get_info(GETTEXT_OFFSET_ORIGINAL);
+      grub_gettext_max = grub_gettext_get_info(GETTEXT_NUMBER_OF_STRINGS);
+
+      grub_gettext_original = grub_gettext;
+      grub_gettext = grub_gettext_translate;
+    }
+}
+
+static char*
+grub_gettext_env_write_lang (struct grub_env_var *var __attribute__ ((unused)),
+			     const char *val)
+{
+  grub_gettext_init_ext (val);
+
+  return grub_strdup (val);
+}
+
+GRUB_MOD_INIT(gettext)
+{
+  (void)mod;			/* To stop warning.  */
+ 
+  const char *lang;
+
+  lang = grub_env_get ("lang"); 
+
+  grub_gettext_init_ext (lang);
+
+  /* Testing:
+  grub_register_command ("_", grub_cmd_translate, GRUB_COMMAND_FLAG_BOTH,
+			 "_", "internalization support trans", 0);
+  */
+
+  /* Reload .mo file information if lang changes.  */
+  grub_register_variable_hook ("lang", NULL, grub_gettext_env_write_lang);
+
+  /* Preserve hooks after context changes.  */
+  grub_env_export ("lang");
+}
+
+GRUB_MOD_FINI(gettext)
+{
+  if (fd_mo != 0)
+    grub_file_close(fd_mo);
+
+  grub_gettext = grub_gettext_original;
+}
Index: normal/menu_text.c
===================================================================
--- normal/menu_text.c	(revision 2343)
+++ normal/menu_text.c	(working copy)
@@ -93,8 +93,8 @@
     }
   else
     {
-      grub_printf ("\n\
-      Use the %C and %C keys to select which entry is highlighted.\n",
+      grub_printf (_("\n\
+      Use the %C and %C keys to select which entry is highlighted.\n"),
 		   (grub_uint32_t) GRUB_TERM_DISP_UP, (grub_uint32_t) GRUB_TERM_DISP_DOWN);
       grub_printf ("\
       Press enter to boot the selected OS, \'e\' to edit the\n\
Index: util/grub.d/10_linux.in
===================================================================
--- util/grub.d/10_linux.in	(revision 2343)
+++ util/grub.d/10_linux.in	(working copy)
@@ -141,10 +141,10 @@
     linux_root_device_thisversion=${GRUB_DEVICE}
   fi
 
-  linux_entry "${OS}, Linux ${version}" \
-      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
-  linux_entry "${OS}, Linux ${version} (recovery mode)" \
-      "single ${GRUB_CMDLINE_LINUX}"
+  linux_entry $eval_gettext ("${OS}, Linux ${version}" \
+      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}")
+  linux_entry $eval_gettext ("${OS}, Linux ${version} (recovery mode)" \
+      "single ${GRUB_CMDLINE_LINUX}")
 
   list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
 done
Index: util/grub.d/00_header.in
===================================================================
--- util/grub.d/00_header.in	(revision 2343)
+++ util/grub.d/00_header.in	(working copy)
@@ -22,6 +22,7 @@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 grub_prefix=`echo /boot/grub | sed ${transform}`
+locale_prefix="/usr/share/locale" # TODO: dynamic with exec_prefix ?
 
 . ${libdir}/grub/grub-mkconfig_lib
 
@@ -112,3 +113,18 @@
 EOF
   ;;
 esac
+
+if test -e ${grub_prefix}/gettext.mod -a -d /usr/share/locale; then
+  # Make the locales accesible
+  prepare_grub_to_access_device `${grub_probe} --target=device ${locale_prefix}`
+  lang=`get_locale_lang`
+  grub_locale_prefix=`make_system_path_relative_to_its_root ${locale_prefix}`
+  cat << EOF
+# Gettext variables and module
+set locale_prefix=${grub_locale_prefix}
+set lang=${lang}
+insmod gettext 
+EOF
+else
+  echo "gettext module is not available"
+fi
Index: util/grub-gettext_lib.in
===================================================================
--- util/grub-gettext_lib.in	(revision 0)
+++ util/grub-gettext_lib.in	(revision 0)
@@ -0,0 +1,23 @@
+# Configuration of grub-gettext
+# Copyright (C) 2009  Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+
+TEXTDOMAINDIR=@prefix@/share/locale
+TEXTDOMAIN=grub
+. gettext.sh

Property changes on: util/grub-gettext_lib.in
___________________________________________________________________
Added: svn:mergeinfo

Index: util/grub-mkconfig_lib.in
===================================================================
--- util/grub-mkconfig_lib.in	(revision 2343)
+++ util/grub-mkconfig_lib.in	(working copy)
@@ -176,3 +176,14 @@
   fi
   return 0
 }
+
+get_locale_lang ()
+{
+  lang="`echo ${LANG} | cut -d _ -f 1`"
+  if [ "x${lang}" = "x" ] ; then
+    return 1
+  else
+    echo "${lang}"
+    return 0
+  fi
+}

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-18 14:45       ` Vladimir 'phcoder' Serbinenko
@ 2009-06-18 21:07         ` Carles Pina i Estany
  2009-06-19 17:22           ` Vladimir 'phcoder' Serbinenko
  2009-06-19 10:32         ` Robert Millan
  1 sibling, 1 reply; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-18 21:07 UTC (permalink / raw)
  To: The development of GRUB 2


Hi,

On Jun/18/2009, Vladimir 'phcoder' Serbinenko wrote:

> If you want I'll add compilation po to mo to build system.

this would be very nice and speed up the process :-)

As it's written in the TODO in grub/po, we need:

-Compile all .po to .mo (msgfmt $LANG.po -o $LANG.mo) (during the make
of Grub?)

-Copy to /usr/share/locale/$LANG/LC_MESSAGES/grub.mo (or
 /usr/local/share/locale/$LANG/LC_MESSAGES/..., so $prefix...)
((Well, now with the last changes I suggest to copy *.mo to
$prefix/locale/ :-) ))

-Make uptrans should execute:
uptrans:
       xgettext -k_ -LC -o - `find "$(srcdir)/" -name '*.c'` -o po/grub.pot
       xgettext -k_ -Lshell -o - $(GRUBD)/* -j -o po/grub.pot

(first line generates the new po template from the *.c files and otehr
one from the grub.d scripts)

Then we have other things to do, like be sure that the scripts that
generates grub.cfg are using the appropiate location of the files. For
example, 10_linux.d is using $eval_gettext, and the system has the
grub-gettext_lib.in that setups some paths and includes gettext.sh (this
is a generic script that comes with gettext-base package).

Maybe we can, now (next days) add gettext support in Grub booting time
and then to the scripts?

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-18 14:45       ` Vladimir 'phcoder' Serbinenko
  2009-06-18 21:07         ` Carles Pina i Estany
@ 2009-06-19 10:32         ` Robert Millan
  1 sibling, 0 replies; 46+ messages in thread
From: Robert Millan @ 2009-06-19 10:32 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: david.planella

On Thu, Jun 18, 2009 at 04:45:38PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> If you want I'll add compilation po to mo to build system.

That would be very nice.  The build system part looks like the part that
would be easiest, but TBH I'm totally clueless on what would be the proper
way to do it.  Running the msg* commands by hand is the only solution I
could think of :-(

Btw, note that even without the gettext patch, translating grub-mkconfig
output already lets us fix some of the most visible strings (menu entry
titles).

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-18 20:56   ` Carles Pina i Estany
@ 2009-06-19 10:37     ` Robert Millan
  2009-06-19 10:42       ` Vladimir 'phcoder' Serbinenko
                         ` (2 more replies)
  0 siblings, 3 replies; 46+ messages in thread
From: Robert Millan @ 2009-06-19 10:37 UTC (permalink / raw)
  To: The development of GRUB 2

On Thu, Jun 18, 2009 at 09:56:07PM +0100, Carles Pina i Estany wrote:
> > >         -Copy ca.mo to /usr/share/locale/ca/LC_MESSAGES/grub.mo 
> > 
> > Languages files should go to a subdir of $PREFIX. E.g. to
> > $PREFIX/langs/$LANG.mo linux directories may be inaccessible 
> 
> Now the gettext module will search in $prefix/locale/lang.mo, where lang
> is the variable that the user will setup in grub.cfg (e.g. ca for
> catalan) and $prefix is usually /boot/grub

Uhm I'm not sure I agree on this one.  Sure, they may be inaccessible, but
only in very rare setups.  On the other hand, we _still_ need a .mo in the
standard directory, because some strings in grub-mkconfig are critical
(they generate text that populates menu entry titles).  So that would mean
installing two .mo files.  Is it really worth the hassle?

What does everyone else think about this?

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-19 10:37     ` Robert Millan
@ 2009-06-19 10:42       ` Vladimir 'phcoder' Serbinenko
  2009-06-21 11:07         ` Robert Millan
  2009-06-19 13:55       ` Jordi Mallach
  2009-06-19 23:08       ` Carles Pina i Estany
  2 siblings, 1 reply; 46+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-06-19 10:42 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1700 bytes --]

On Fri, Jun 19, 2009 at 12:37 PM, Robert Millan <rmh@aybabtu.com> wrote:

> On Thu, Jun 18, 2009 at 09:56:07PM +0100, Carles Pina i Estany wrote:
> > > >         -Copy ca.mo to /usr/share/locale/ca/LC_MESSAGES/grub.mo
> > >
> > > Languages files should go to a subdir of $PREFIX. E.g. to
> > > $PREFIX/langs/$LANG.mo linux directories may be inaccessible
> >
> > Now the gettext module will search in $prefix/locale/lang.mo, where lang
> > is the variable that the user will setup in grub.cfg (e.g. ca for
> > catalan) and $prefix is usually /boot/grub
>
> Uhm I'm not sure I agree on this one.  Sure, they may be inaccessible, but
> only in very rare setups.  On the other hand, we _still_ need a .mo in the
> standard directory, because some strings in grub-mkconfig are critical
> (they generate text that populates menu entry titles).  So that would mean
> installing two .mo files.  Is it really worth the hassle?
>
It's not a problem. We need two locations anyway: one where make install
copies them and the other one where ./grub-install copies them. Would it be
possible to use /usr/share/grub/locale/$LANG.mo rather than
/usr/share/locale/$LANG/LC_MESSAGES/grub.mo? It would make grub-install
easier

>
> What does everyone else think about this?
>
> --
> 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."
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

[-- Attachment #2: Type: text/html, Size: 2533 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-19 10:37     ` Robert Millan
  2009-06-19 10:42       ` Vladimir 'phcoder' Serbinenko
@ 2009-06-19 13:55       ` Jordi Mallach
  2009-06-19 14:32         ` Vladimir 'phcoder' Serbinenko
  2009-06-19 23:08       ` Carles Pina i Estany
  2 siblings, 1 reply; 46+ messages in thread
From: Jordi Mallach @ 2009-06-19 13:55 UTC (permalink / raw)
  To: The development of GRUB 2

On Fri, Jun 19, 2009 at 12:37:47PM +0200, Robert Millan wrote:
> > Now the gettext module will search in $prefix/locale/lang.mo, where lang
> > is the variable that the user will setup in grub.cfg (e.g. ca for
> > catalan) and $prefix is usually /boot/grub
> Uhm I'm not sure I agree on this one.  Sure, they may be inaccessible, but
> only in very rare setups.  On the other hand, we _still_ need a .mo in the
> standard directory, because some strings in grub-mkconfig are critical
> (they generate text that populates menu entry titles).  So that would mean
> installing two .mo files.  Is it really worth the hassle?

I agree with Robert. These should be in /usr/share/locale; if you can't find
it (due to a separate partition, or problems to read it), I think you should
either:

 - lose, and get the C locale messages
 - try to set it up using the correct grub device that contains the locales.
   Probably grub.d/ could make that configurable somehow.

-- 
Jordi Mallach Pérez  --  Debian developer     http://www.debian.org/
jordi@sindominio.net     jordi@debian.org     http://www.sindominio.net/
GnuPG public key information available at http://oskuro.net/



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-19 13:55       ` Jordi Mallach
@ 2009-06-19 14:32         ` Vladimir 'phcoder' Serbinenko
  2009-06-21 11:17           ` Robert Millan
  0 siblings, 1 reply; 46+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-06-19 14:32 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1904 bytes --]

On Fri, Jun 19, 2009 at 3:55 PM, Jordi Mallach <jordi@gnu.org> wrote:

> On Fri, Jun 19, 2009 at 12:37:47PM +0200, Robert Millan wrote:
> > > Now the gettext module will search in $prefix/locale/lang.mo, where
> lang
> > > is the variable that the user will setup in grub.cfg (e.g. ca for
> > > catalan) and $prefix is usually /boot/grub
> > Uhm I'm not sure I agree on this one.  Sure, they may be inaccessible,
> but
> > only in very rare setups.  On the other hand, we _still_ need a .mo in
> the
> > standard directory, because some strings in grub-mkconfig are critical
> > (they generate text that populates menu entry titles).  So that would
> mean
> > installing two .mo files.  Is it really worth the hassle?
>
> I agree with Robert. These should be in /usr/share/locale; if you can't
> find
> it (due to a separate partition, or problems to read it), I think you
> should
> either:
>
>  - lose, and get the C locale messages
>  - try to set it up using the correct grub device that contains the
> locales.

What if partition is in btrfs?

>
>   Probably grub.d/ could make that configurable somehow.
>
Why can't grub-install just copy them to $prefix/locale like it's done with
e.g. modules? Not only it makes it consistent with the rest but also makes
grub OS-independent if needed. I strongly oppose to grub2 reading files from
usr. Now our directory structure is clean (everything in /boot/grub) and it
has to stay such

>
> --
> Jordi Mallach Pérez  --  Debian developer     http://www.debian.org/
> jordi@sindominio.net     jordi@debian.org     http://www.sindominio.net/
> GnuPG public key information available at http://oskuro.net/
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

[-- Attachment #2: Type: text/html, Size: 3053 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-18 21:07         ` Carles Pina i Estany
@ 2009-06-19 17:22           ` Vladimir 'phcoder' Serbinenko
  2009-06-19 23:13             ` Carles Pina i Estany
  0 siblings, 1 reply; 46+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-06-19 17:22 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 2299 bytes --]

On Thu, Jun 18, 2009 at 11:07 PM, Carles Pina i Estany <carles@pina.cat>wrote:

>
> Hi,
>
> On Jun/18/2009, Vladimir 'phcoder' Serbinenko wrote:
>
> > If you want I'll add compilation po to mo to build system.
>
> this would be very nice and speed up the process :-)
>
> As it's written in the TODO in grub/po, we need:
>
> -Compile all .po to .mo (msgfmt $LANG.po -o $LANG.mo) (during the make
> of Grub?)
>
> -Copy to /usr/share/locale/$LANG/LC_MESSAGES/grub.mo (or
>  /usr/local/share/locale/$LANG/LC_MESSAGES/..., so $prefix...)
> ((Well, now with the last changes I suggest to copy *.mo to
> $prefix/locale/ :-) ))

In my git repository you can find a possible way how to do it (branch
for-carles). There is a possibility with minimal modification to copy
languages to both ls /usr/local/lib/grub/<platform>/ and $prefix like it's
the case with modules. It still needs work because I haven't updated non
i386-pc scripts yet and because putting to lib/grub/platform is
inappropriate. But you can already get the idea Would it be ok if it will go
to /usr/local/share/grub and $prefix/locale ? Can you make gettext in
utilities to use /usr/local/share/grub/$LANG.mo

>
>
> -Make uptrans should execute:
> uptrans:
>       xgettext -k_ -LC -o - `find "$(srcdir)/" -name '*.c'` -o po/grub.pot
>       xgettext -k_ -Lshell -o - $(GRUBD)/* -j -o po/grub.pot
>
This will need to be adjusted to use DISTLIST

>
> (first line generates the new po template from the *.c files and otehr
> one from the grub.d scripts)
>
> Then we have other things to do, like be sure that the scripts that
> generates grub.cfg are using the appropiate location of the files. For
> example, 10_linux.d is using $eval_gettext, and the system has the
> grub-gettext_lib.in that setups some paths and includes gettext.sh (this
> is a generic script that comes with gettext-base package).
>
> Maybe we can, now (next days) add gettext support in Grub booting time
> and then to the scripts?
>
Works for me

>
> --
> Carles Pina i Estany
>        http://pinux.info
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git

[-- Attachment #2: Type: text/html, Size: 3606 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-19 10:37     ` Robert Millan
  2009-06-19 10:42       ` Vladimir 'phcoder' Serbinenko
  2009-06-19 13:55       ` Jordi Mallach
@ 2009-06-19 23:08       ` Carles Pina i Estany
  2009-06-21 11:09         ` Robert Millan
  2 siblings, 1 reply; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-19 23:08 UTC (permalink / raw)
  To: The development of GRUB 2


Hi,

On Jun/19/2009, Robert Millan wrote:
> On Thu, Jun 18, 2009 at 09:56:07PM +0100, Carles Pina i Estany wrote:
> > > >         -Copy ca.mo to /usr/share/locale/ca/LC_MESSAGES/grub.mo 
> > > 
> > > Languages files should go to a subdir of $PREFIX. E.g. to
> > > $PREFIX/langs/$LANG.mo linux directories may be inaccessible 
> > 
> > Now the gettext module will search in $prefix/locale/lang.mo, where lang
> > is the variable that the user will setup in grub.cfg (e.g. ca for
> > catalan) and $prefix is usually /boot/grub
> 
> Uhm I'm not sure I agree on this one.  Sure, they may be inaccessible,
> but only in very rare setups.  On the other hand, we _still_ need a
> .mo in the standard directory, because some strings in grub-mkconfig
> are critical (they generate text that populates menu entry titles).
> So that would mean installing two .mo files.  Is it really worth the
> hassle?

Two things:

a) I afraid that having the .mo files in /usr/share/... makes Grub
quite much tight to GNU/Linux. In my opinion, boot loaders should be as
much as operating system agnostic as could be. 

b) grub-mkconfig needs a path to search the .mo file. This can be
/usr/share/locale or /boot/grub/locale, it's not a big difference

Regards,

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-19 17:22           ` Vladimir 'phcoder' Serbinenko
@ 2009-06-19 23:13             ` Carles Pina i Estany
  2009-06-20  0:17               ` Vladimir 'phcoder' Serbinenko
  0 siblings, 1 reply; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-19 23:13 UTC (permalink / raw)
  To: The development of GRUB 2


Hi,

On Jun/19/2009, Vladimir 'phcoder' Serbinenko wrote:
> On Thu, Jun 18, 2009 at 11:07 PM, Carles Pina i Estany <carles@pina.cat>wrote:
> 
> >
> > Hi,
> >
> > On Jun/18/2009, Vladimir 'phcoder' Serbinenko wrote:
> >
> > > If you want I'll add compilation po to mo to build system.
> >
> > this would be very nice and speed up the process :-)
> >
> > As it's written in the TODO in grub/po, we need:
> >
> > -Compile all .po to .mo (msgfmt $LANG.po -o $LANG.mo) (during the make
> > of Grub?)
> >
> > -Copy to /usr/share/locale/$LANG/LC_MESSAGES/grub.mo (or
> >  /usr/local/share/locale/$LANG/LC_MESSAGES/..., so $prefix...)
> > ((Well, now with the last changes I suggest to copy *.mo to
> > $prefix/locale/ :-) ))
> 
> In my git repository you can find a possible way how to do it (branch

Could you send the details of your git repository? (I don't have it
handy)

> for-carles). There is a possibility with minimal modification to copy

thanks :-)

> languages to both ls /usr/local/lib/grub/<platform>/ and $prefix like it's
> the case with modules. It still needs work because I haven't updated non
> i386-pc scripts yet and because putting to lib/grub/platform is
> inappropriate. But you can already get the idea Would it be ok if it will go
> to /usr/local/share/grub and $prefix/locale ? Can you make gettext in
> utilities to use /usr/local/share/grub/$LANG.mo

As far as I remember, gettext utilities uses a shell variable to search
for the .mo file (or to the directory where the .mo file is located). So
yes, we could test if /usr/locale/share/grub exists and failback to
/usr/share/locale/grub, etc.
(I can do something like this during the weekend)

> > -Make uptrans should execute:
> > uptrans:
> >       xgettext -k_ -LC -o - `find "$(srcdir)/" -name '*.c'` -o po/grub.pot
> >       xgettext -k_ -Lshell -o - $(GRUBD)/* -j -o po/grub.pot
> >
> This will need to be adjusted to use DISTLIST

I leave it to you since I'm not familiar with DISTLIST, etc.

> > (first line generates the new po template from the *.c files and otehr
> > one from the grub.d scripts)
> >
> > Then we have other things to do, like be sure that the scripts that
> > generates grub.cfg are using the appropiate location of the files. For
> > example, 10_linux.d is using $eval_gettext, and the system has the
> > grub-gettext_lib.in that setups some paths and includes gettext.sh (this
> > is a generic script that comes with gettext-base package).
> >
> > Maybe we can, now (next days) add gettext support in Grub booting time
> > and then to the scripts?
> >
> Works for me

ok. I think that adding Gettext to Grub is not a very BIG patch itself,
but it touches many places (Grub itself, Scripts, building system) that
makes difficult to prepare only one patch for everything.

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-19 23:13             ` Carles Pina i Estany
@ 2009-06-20  0:17               ` Vladimir 'phcoder' Serbinenko
  0 siblings, 0 replies; 46+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-06-20  0:17 UTC (permalink / raw)
  To: The development of GRUB 2


[-- Attachment #1.1: Type: text/plain, Size: 3662 bytes --]

On Sat, Jun 20, 2009 at 1:13 AM, Carles Pina i Estany <carles@pina.cat>wrote:

>
> Hi,
>
> On Jun/19/2009, Vladimir 'phcoder' Serbinenko wrote:
> > On Thu, Jun 18, 2009 at 11:07 PM, Carles Pina i Estany <carles@pina.cat
> >wrote:
> >
> > >
> > > Hi,
> > >
> > > On Jun/18/2009, Vladimir 'phcoder' Serbinenko wrote:
> > >
> > > > If you want I'll add compilation po to mo to build system.
> > >
> > > this would be very nice and speed up the process :-)
> > >
> > > As it's written in the TODO in grub/po, we need:
> > >
> > > -Compile all .po to .mo (msgfmt $LANG.po -o $LANG.mo) (during the make
> > > of Grub?)
> > >
> > > -Copy to /usr/share/locale/$LANG/LC_MESSAGES/grub.mo (or
> > >  /usr/local/share/locale/$LANG/LC_MESSAGES/..., so $prefix...)
> > > ((Well, now with the last changes I suggest to copy *.mo to
> > > $prefix/locale/ :-) ))
> >
> > In my git repository you can find a possible way how to do it (branch
>
> Could you send the details of your git repository? (I don't have it
> handy)

To recieve the branch for-carles initially you do:
 git clone git://repo.or.cz/grub2/phcoder.git
  cd phcoder/
 git checkout -b for-carles origin/for-carles
Later to update do:
git pull
Alternatively you find the attached patch

>
>
> > for-carles). There is a possibility with minimal modification to copy
>
> thanks :-)
>
> > languages to both ls /usr/local/lib/grub/<platform>/ and $prefix like
> it's
> > the case with modules. It still needs work because I haven't updated non
> > i386-pc scripts yet and because putting to lib/grub/platform is
> > inappropriate. But you can already get the idea Would it be ok if it will
> go
> > to /usr/local/share/grub and $prefix/locale ? Can you make gettext in
> > utilities to use /usr/local/share/grub/$LANG.mo
>
> As far as I remember, gettext utilities uses a shell variable to search
> for the .mo file (or to the directory where the .mo file is located). So
> yes, we could test if /usr/locale/share/grub exists and failback to
> /usr/share/locale/grub, etc.
> (I can do something like this during the weekend)
>
> > > -Make uptrans should execute:
> > > uptrans:
> > >       xgettext -k_ -LC -o - `find "$(srcdir)/" -name '*.c'` -o
> po/grub.pot
> > >       xgettext -k_ -Lshell -o - $(GRUBD)/* -j -o po/grub.pot
> > >
> > This will need to be adjusted to use DISTLIST
>
> I leave it to you since I'm not familiar with DISTLIST, etc.
>
ok. Remember  to pull the updates

>
> > > (first line generates the new po template from the *.c files and otehr
> > > one from the grub.d scripts)
> > >
> > > Then we have other things to do, like be sure that the scripts that
> > > generates grub.cfg are using the appropiate location of the files. For
> > > example, 10_linux.d is using $eval_gettext, and the system has the
> > > grub-gettext_lib.in that setups some paths and includes gettext.sh
> (this
> > > is a generic script that comes with gettext-base package).
> > >
> > > Maybe we can, now (next days) add gettext support in Grub booting time
> > > and then to the scripts?
> > >
> > Works for me
>
> ok. I think that adding Gettext to Grub is not a very BIG patch itself,
> but it touches many places (Grub itself, Scripts, building system) that
> makes difficult to prepare only one patch for everything.
>
Make several patches. It's  also much better for review and goes faster

>
> --
> Carles Pina i Estany
>        http://pinux.info
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git

[-- Attachment #1.2: Type: text/html, Size: 5544 bytes --]

[-- Attachment #2: for-carles.diff --]
[-- Type: text/x-diff, Size: 14537 bytes --]

diff --git a/Makefile.in b/Makefile.in
index f82566a..77e9250 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -92,6 +92,7 @@ HELP2MAN = true
 else
 HELP2MAN := LANG=C $(HELP2MAN) --no-info --source=FSF
 endif
+MSGFMT = @MSGFMT@
 AWK = @AWK@
 LIBCURSES = @LIBCURSES@
 LIBLZO = @LIBLZO@
@@ -108,6 +109,7 @@ enable_grub_mkfont = @enable_grub_mkfont@
 freetype_cflags = @freetype_cflags@
 freetype_libs = @freetype_libs@
 enable_efiemu = @enable_efiemu@
+enable_languages = @enable_languages@
 
 ### General variables.
 
diff --git a/conf/common.rmk b/conf/common.rmk
index fbca2e4..2fa6836 100644
--- a/conf/common.rmk
+++ b/conf/common.rmk
@@ -598,3 +598,10 @@ pkglib_MODULES += xnu_uuid.mod
 xnu_uuid_mod_SOURCES = commands/xnu_uuid.c
 xnu_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
 xnu_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+LANGUAGES = ca.mo
+ifeq ($(enable_languages), yes)
+pkglib_DATA += $(LANGUAGES)
+%.mo: po/%.po
+	$(MSGFMT) $< -o $@
+endif
diff --git a/configure.ac b/configure.ac
index a8cb234..34570a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -433,6 +433,34 @@ AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
 #define NESTED_FUNC_ATTR
 #endif])
 
+AC_ARG_ENABLE([efiemu],
+	      [AS_HELP_STRING([--enable-efiemu],
+                             [build and install the efiemu runtimes (default=guessed)])])
+if test x"$enable_efiemu" = xno ; then
+  efiemu_excuse="explicitely disabled"
+fi
+if test x"$efiemu_excuse" = x ; then
+  AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_no_red_zone, [
+    CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib -c"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+		      [grub_cv_cc_efiemu=yes],
+		      [grub_cv_cc_efiemu=no])
+  ])
+  if test x$grub_cv_cc_efiemu = x$no; then
+     efiemu_excuse="compiler doesn't support compiling with -m64 -mcmodel=large -mno-red-zone -nostdlib -c"
+  fi
+fi
+if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
+  AC_MSG_ERROR([efiemu runtime was explicitely requested but can't be compiled])
+fi
+if test x"$efiemu_excuse" = x ; then
+enable_efiemu=yes
+else
+enable_efiemu=no
+fi
+AC_SUBST([enable_efiemu])
+
+
 # Restore the flags.
 CC="$tmp_CC"
 CFLAGS="$tmp_CFLAGS"
@@ -453,40 +481,75 @@ AC_ARG_ENABLE([mm-debug],
 
 AC_ARG_ENABLE([grub-emu],
 	      [AS_HELP_STRING([--enable-grub-emu],
-                             [build and install the `grub-emu' debugging utility])])
+                             [build and install the `grub-emu' debugging utility (default=guessed)])])
 AC_ARG_ENABLE([grub-emu-usb],
 	      [AS_HELP_STRING([--enable-grub-emu-usb],
-                             [build and install the `grub-emu' debugging utility with USB support])])
-[if [ x"$enable_grub_emu" = xyes ]; then
-  # Check for curses libraries.]
+                             [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
+if test x"$enable_grub_emu" = xno ; then
+  grub_emu_excuse="explicitely disabled"
+fi
+
+  [# Check for curses libraries.]
+[if [ x"$grub_emu_excuse" = x ]; then ]
   AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
     [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
-      [AC_MSG_ERROR([(n)curses libraries are required to build `grub-emu'])])])
+      [grub_emu_excuse=["(n)curses libraries are required to build \`grub-emu'"]])])
   AC_SUBST([LIBCURSES])
-
+[fi]
+[if [ x"$grub_emu_excuse" = x ]; then ]
   [# Check for headers.]
   AC_CHECK_HEADERS([ncurses/curses.h], [],
     [AC_CHECK_HEADERS([ncurses.h], [],
       [AC_CHECK_HEADERS([curses.h], [],
-	[AC_MSG_ERROR([(n)curses header files are required to build `grub-emu'])])])])
+	[grub_emu_excuse=["(n)curses header files are required to build \`grub-emu'"]])])])
+[fi]
 
-  [if [ x"$enable_grub_emu_usb" = xyes ]; then
+if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then
+  AC_MSG_ERROR([grub-emu was explicitely requested but can't be compiled])
+fi
+if test x"$grub_emu_excuse" = x ; then
+enable_grub_emu=yes
+else
+enable_grub_emu=no
+grub_emu_usb_excuse="grub-emu isn't built"
+fi
+if test x"$enable_grub_emu_usb" = xno ; then
+  grub_emu_usb_excuse="explicitely disabled"
+fi
+[if [ x"$grub_emu_usb_excuse" = x ]; then
     # Check for libusb libraries.]
-    AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
-      [AC_MSG_ERROR([libusb libraries are required to build `grub-emu' with USB support])])
+AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
+    [grub_emu_usb_excuse=["libusb libraries are required to build \`grub-emu' with USB support"]])
     AC_SUBST([LIBUSB])
-
-    [# Check for headers.]
+[fi]
+[if [ x"$grub_emu_usb_excuse" = x ]; then
+    # Check for headers.]
     AC_CHECK_HEADERS([usb.h], [],
-      [AC_MSG_ERROR([libusb header file is required to build `grub-emu' with USB support])])
-  [fi]
+      [grub_emu_usb_excuse=["libusb header file is required to build \`grub-emu' with USB support"]])
 [fi]
+if test x"enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
+  AC_MSG_ERROR([USB support for grub-emu was explicitely requested but can't be compiled])
+fi
+if test x"$grub_emu_usb_excuse" = x ; then
+enable_grub_emu_usb=yes
+else
+enable_grub_emu_usb=no
+fi
+
 AC_SUBST([enable_grub_emu])
 AC_SUBST([enable_grub_emu_usb])
 
 AC_ARG_ENABLE([grub-fstest],
 	      [AS_HELP_STRING([--enable-grub-fstest],
-                             [build and install the `grub-fstest' debugging utility])])
+                             [build and install the `grub-fstest' debugging utility (default=guessed)])])
+if test x"$enable_grub_fstest" = xno ; then
+  grub_fstest_excuse="explicitely disabled"
+fi
+if test x"$grub_fstest_excuse" = x ; then
+enable_grub_fstest=yes
+else
+enable_grub_fstest=no
+fi
 AC_SUBST([enable_grub_fstest])
 
 AC_ARG_ENABLE([grub-pe2elf],
@@ -494,26 +557,58 @@ AC_ARG_ENABLE([grub-pe2elf],
                              [build and install the `grub-pe2elf' conversion utility])])
 AC_SUBST([enable_grub_pe2elf])
 
+AC_ARG_ENABLE([languages],
+	      [AS_HELP_STRING([--enable-languages],
+                             [build and install languages (default=guessed)])])
+if test x"$enable_languages" = xno ; then
+  languages_excuse="explicitely disabled"
+fi
+
+if test x"$languages_excuse" = x ; then
+  # Check for freetype libraries.
+  AC_CHECK_PROGS([MSGFMT], [msgfmt])
+  if test "x$MSGFMT" = x ; then
+    languages_excuse="msgfmt not found"
+  fi
+fi
+if test x"$languages_excuse" = x ; then
+enable_languages=yes
+else
+enable_languages=no
+fi
+if test x"$enable_languages" = xyes && test x"$languages_excuse" != x ; then
+  AC_MSG_ERROR([language files explicitely requested but can't be compiled])
+fi
+AC_SUBST([enable_languages])
+
 AC_ARG_ENABLE([grub-mkfont],
 	      [AS_HELP_STRING([--enable-grub-mkfont],
-                             [build and install the `grub-mkfont' utility])])
-if test x"$enable_grub_mkfont" = xyes ; then
+                             [build and install the `grub-mkfont' utility (default=guessed)])])
+if test x"$enable_grub_mkfont" = xno ; then
+  grub_mkfont_excuse="explicitely disabled"
+fi
+
+if test x"$grub_mkfont_excuse" = x ; then
   # Check for freetype libraries.
   AC_CHECK_PROGS([FREETYPE], [freetype-config])
   if test "x$FREETYPE" = x ; then
-    AC_MSG_ERROR([freetype2 libraries are required to build `grub-mkfont'])
+    grub_mkfont_excuse=["freetype2 libraries are required to build \`grub-mkfont'"]
   fi
   freetype_cflags=`freetype-config --cflags`
   freetype_libs=`freetype-config --libs`
 fi
+if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
+  AC_MSG_ERROR([grub-mkfont was explicitely requested but can't be compiled])
+fi
+if test x"$grub_mkfont_excuse" = x ; then
+enable_grub_mkfont=yes
+else
+enable_grub_mkfont=no
+fi
 AC_SUBST([enable_grub_mkfont])
 AC_SUBST([freetype_cflags])
 AC_SUBST([freetype_libs])
 
-AC_ARG_ENABLE([efiemu],
-	      [AS_HELP_STRING([--enable-efiemu],
-                             [build and install the efiemu runtimes])])
-AC_SUBST([enable_efiemu])
 AC_SUBST(ASFLAGS)
 
 # Output files.
@@ -531,3 +626,58 @@ fi
 AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
 AC_OUTPUT
+[
+echo "*******************************************************"
+echo GRUB2 will be compiled with following components:
+echo Platform: "$target_cpu"-"$platform"
+if test "$target_cpu"-"$platform" = i386-pc; then
+if [ x"$enable_lzo" = xyes ]; then
+echo Compression: LZO
+else
+echo Compression: LZMA
+fi
+fi
+if [ x"$grub_emu_excuse" = x ]; then
+echo grub-emu: Yes
+else
+echo grub-emu: No "($grub_emu_excuse)"
+fi
+if [ x"$grub_emu_usb_excuse" = x ]; then
+echo USB support for grub-emu: Yes
+else
+echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
+fi
+if [ x"$enable_mm_debug" = xyes ]; then
+echo With memory debugging: Yes
+else
+echo With memory debugging: No
+fi
+if [ x"$enable_grub_pe2elf" = xyes ]; then
+echo grub-pe2elf will be built and installed
+elif [ x$TARGET_OBJ2ELF = xgrub-pe2elf ]; then
+echo grub-pe2elf will be built but not installed
+else
+echo grub-pe2elf will not be built
+fi
+if [ x"$languages_excuse" = x ]; then
+echo languages: Yes
+else
+echo languages: No "($efiemu_excuse)"
+fi
+if [ x"$efiemu_excuse" = x ]; then
+echo efiemu runtime: Yes
+else
+echo efiemu runtime: No "($efiemu_excuse)"
+fi
+if [ x"$grub_fstest_excuse" = x ]; then
+echo grub-fstest: Yes
+else
+echo grub-fstest: No "($grub_fstest_excuse)"
+fi
+if [ x"$grub_mkfont_excuse" = x ]; then
+echo grub-mkfont: Yes
+else
+echo grub-mkfont: No "($grub_mkfont_excuse)"
+fi
+echo "*******************************************************"
+]
diff --git a/disk/scsi.c b/disk/scsi.c
index 353e639..046dcb8 100644
--- a/disk/scsi.c
+++ b/disk/scsi.c
@@ -246,65 +246,66 @@ grub_scsi_open (const char *name, grub_disk_t disk)
 
   for (p = grub_scsi_dev_list; p; p = p->next)
     {
-      if (p->open (name, scsi))
-	continue;
-      disk->id = (unsigned long) "scsi"; /* XXX */
-      disk->data = scsi;
-      scsi->dev = p;
-      scsi->lun = lun;
-      scsi->name = grub_strdup (name);
-      if (! scsi->name)
+      if (! p->open (name, scsi))
 	{
-	  grub_free (scsi);
-	  return grub_errno;
+	  disk->id = (unsigned long) "scsi"; /* XXX */
+	  disk->data = scsi;
+	  scsi->dev = p;
+	  scsi->lun = lun;
+	  scsi->name = grub_strdup (name);
+	  if (! scsi->name)
+	    {
+	      grub_free (scsi);
+	      return grub_errno;
+	    }
+
+	  grub_dprintf ("scsi", "dev opened\n");
+
+	  err = grub_scsi_inquiry (scsi);
+	  if (err)
+	    {
+	      grub_free (scsi);
+	      grub_dprintf ("scsi", "inquiry failed\n");
+	      return grub_errno;
+	    }
+
+	  grub_dprintf ("scsi", "inquiry: devtype=0x%02x removable=%d\n",
+			scsi->devtype, scsi->removable);
+
+	  /* Try to be conservative about the device types
+	     supported.  */
+	  if (scsi->devtype != grub_scsi_devtype_direct
+	      && scsi->devtype != grub_scsi_devtype_cdrom)
+	    {
+	      grub_free (scsi);
+	      return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
+				 "unknown SCSI device");
+	    }
+
+	  if (scsi->devtype == grub_scsi_devtype_cdrom)
+	    disk->has_partitions = 0;
+	  else
+	    disk->has_partitions = 1;
+
+	  err = grub_scsi_read_capacity (scsi);
+	  if (err)
+	    {
+	      grub_free (scsi);
+	      grub_dprintf ("scsi", "READ CAPACITY failed\n");
+	      return grub_errno;
+	    }
+
+	  /* SCSI blocks can be something else than 512, although GRUB
+	     wants 512 byte blocks.  */
+	  disk->total_sectors = ((scsi->size * scsi->blocksize)
+				 << GRUB_DISK_SECTOR_BITS);
+
+	  grub_dprintf ("scsi", "capacity=%llu, blksize=%d\n",
+			(unsigned long long) disk->total_sectors,
+			scsi->blocksize);
+
+	  return GRUB_ERR_NONE;
 	}
-
-      grub_dprintf ("scsi", "dev opened\n");
-
-      err = grub_scsi_inquiry (scsi);
-      if (err)
-	{
-	  grub_free (scsi);
-	  grub_dprintf ("scsi", "inquiry failed\n");
-	  return grub_errno;
-	}
-
-      grub_dprintf ("scsi", "inquiry: devtype=0x%02x removable=%d\n",
-		    scsi->devtype, scsi->removable);
-
-      /* Try to be conservative about the device types
-	 supported.  */
-      if (scsi->devtype != grub_scsi_devtype_direct
-	  && scsi->devtype != grub_scsi_devtype_cdrom)
-	{
-	  grub_free (scsi);
-	  return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
-			     "unknown SCSI device");
-	}
-
-      if (scsi->devtype == grub_scsi_devtype_cdrom)
-	disk->has_partitions = 0;
-      else
-	disk->has_partitions = 1;
-
-      err = grub_scsi_read_capacity (scsi);
-      if (err)
-	{
-	  grub_free (scsi);
-	  grub_dprintf ("scsi", "READ CAPACITY failed\n");
-	  return grub_errno;
-	}
-
-      /* SCSI blocks can be something else than 512, although GRUB
-	 wants 512 byte blocks.  */
-      disk->total_sectors = ((scsi->size * scsi->blocksize)
-			     << GRUB_DISK_SECTOR_BITS);
-
-      grub_dprintf ("scsi", "capacity=%llu, blksize=%d\n",
-		    (unsigned long long) disk->total_sectors,
-		    scsi->blocksize);
-
-      return GRUB_ERR_NONE;
     }
 
   grub_free (scsi);
diff --git a/genmk.rb b/genmk.rb
index 36f4020..f60e377 100644
--- a/genmk.rb
+++ b/genmk.rb
@@ -310,7 +310,9 @@ class Script
     "CLEANFILES += #{@name}
 
 #{@name}: #{src} $(#{src}_DEPENDENCIES) config.status
-	./config.status --file=#{name}:#{src}
+	./config.status --file=#{name}.tmp:#{src}
+	cat $@.tmp | sed 's/@pkglib_DATA@/$(pkglib_DATA)/g;' > $@
+	-rm -f $@.tmp
 	chmod +x $@
 
 "
diff --git a/util/i386/pc/grub-install.in b/util/i386/pc/grub-install.in
index 5c3ffcd..d266b35 100644
--- a/util/i386/pc/grub-install.in
+++ b/util/i386/pc/grub-install.in
@@ -231,16 +231,19 @@ if test -n "$tmp"; then
 fi
 
 # Copy the GRUB images to the GRUB directory.
-for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img ${grubdir}/efiemu??.o; do
+for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img ${grubdir}/*.mo ${grubdir}/efiemu??.o; do
     if test -f $file && [ "`basename $file`" != menu.lst ]; then
 	rm -f $file || exit 1
     fi
 done
-for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do
+for file in ${pkglibdir}/*.mod; do
     cp -f $file ${grubdir} || exit 1
 done
+for file in @pkglib_DATA@; do
+    cp -f ${pkglibdir}/$file ${grubdir} || exit 1
+done
 if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
-    for file in ${pkglibdir}/*.img ${pkglibdir}/efiemu??.o; do
+    for file in ${pkglibdir}/*.img; do
 	if test -f $file; then
 	    cp -f $file ${grubdir} || exit 1
 	fi

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-19 10:42       ` Vladimir 'phcoder' Serbinenko
@ 2009-06-21 11:07         ` Robert Millan
  2009-06-21 17:22           ` Carles Pina i Estany
  0 siblings, 1 reply; 46+ messages in thread
From: Robert Millan @ 2009-06-21 11:07 UTC (permalink / raw)
  To: The development of GRUB 2

On Fri, Jun 19, 2009 at 12:42:26PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> On Fri, Jun 19, 2009 at 12:37 PM, Robert Millan <rmh@aybabtu.com> wrote:
> 
> > On Thu, Jun 18, 2009 at 09:56:07PM +0100, Carles Pina i Estany wrote:
> > > > >         -Copy ca.mo to /usr/share/locale/ca/LC_MESSAGES/grub.mo
> > > >
> > > > Languages files should go to a subdir of $PREFIX. E.g. to
> > > > $PREFIX/langs/$LANG.mo linux directories may be inaccessible
> > >
> > > Now the gettext module will search in $prefix/locale/lang.mo, where lang
> > > is the variable that the user will setup in grub.cfg (e.g. ca for
> > > catalan) and $prefix is usually /boot/grub
> >
> > Uhm I'm not sure I agree on this one.  Sure, they may be inaccessible, but
> > only in very rare setups.  On the other hand, we _still_ need a .mo in the
> > standard directory, because some strings in grub-mkconfig are critical
> > (they generate text that populates menu entry titles).  So that would mean
> > installing two .mo files.  Is it really worth the hassle?
> >
> It's not a problem. We need two locations anyway: one where make install
> copies them and the other one where ./grub-install copies them. Would it be
> possible to use /usr/share/grub/locale/$LANG.mo rather than
> /usr/share/locale/$LANG/LC_MESSAGES/grub.mo? It would make grub-install
> easier

No, for system locales we need to use standard locations, or the userland
gettext won't find them.

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-19 23:08       ` Carles Pina i Estany
@ 2009-06-21 11:09         ` Robert Millan
  0 siblings, 0 replies; 46+ messages in thread
From: Robert Millan @ 2009-06-21 11:09 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Jun 20, 2009 at 12:08:44AM +0100, Carles Pina i Estany wrote:
> 
> a) I afraid that having the .mo files in /usr/share/... makes Grub
> quite much tight to GNU/Linux. In my opinion, boot loaders should be as
> much as operating system agnostic as could be. 

Sounds like a good point.  I don't mind using /boot/grub/locale then.

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-19 14:32         ` Vladimir 'phcoder' Serbinenko
@ 2009-06-21 11:17           ` Robert Millan
  0 siblings, 0 replies; 46+ messages in thread
From: Robert Millan @ 2009-06-21 11:17 UTC (permalink / raw)
  To: The development of GRUB 2

On Fri, Jun 19, 2009 at 04:32:35PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> >  - lose, and get the C locale messages
> >  - try to set it up using the correct grub device that contains the
> > locales.
> 
> What if partition is in btrfs?

Well, now I think using $prefix/locale is not that bad.

But in general, I'd like to make the point that it is OK to lose sometimes.
Jordi proposed giving up here, and it's not bad IMO.  I think it's good to
always keep in consideration the option of giving up and refuse to provide a
feature or refuse to install on a f*cked up setup.

Sometimes the cost of supporting something is just too high.

> Why can't grub-install just copy them to $prefix/locale like it's done with
> e.g. modules? Not only it makes it consistent with the rest but also makes
> grub OS-independent if needed.

Okay with me.

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 11:07         ` Robert Millan
@ 2009-06-21 17:22           ` Carles Pina i Estany
  2009-06-21 18:42             ` Robert Millan
  0 siblings, 1 reply; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-21 17:22 UTC (permalink / raw)
  To: The development of GRUB 2


Hello,

On Jun/21/2009, Robert Millan wrote:
> On Fri, Jun 19, 2009 at 12:42:26PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> > On Fri, Jun 19, 2009 at 12:37 PM, Robert Millan <rmh@aybabtu.com> wrote:
> > 
> > > On Thu, Jun 18, 2009 at 09:56:07PM +0100, Carles Pina i Estany wrote:
> > > > > >         -Copy ca.mo to /usr/share/locale/ca/LC_MESSAGES/grub.mo
> > > > >
> > > > > Languages files should go to a subdir of $PREFIX. E.g. to
> > > > > $PREFIX/langs/$LANG.mo linux directories may be inaccessible
> > > >
> > > > Now the gettext module will search in $prefix/locale/lang.mo, where lang
> > > > is the variable that the user will setup in grub.cfg (e.g. ca for
> > > > catalan) and $prefix is usually /boot/grub
> > >
> > > Uhm I'm not sure I agree on this one.  Sure, they may be inaccessible, but
> > > only in very rare setups.  On the other hand, we _still_ need a .mo in the
> > > standard directory, because some strings in grub-mkconfig are critical
> > > (they generate text that populates menu entry titles).  So that would mean
> > > installing two .mo files.  Is it really worth the hassle?
> > >
> > It's not a problem. We need two locations anyway: one where make install
> > copies them and the other one where ./grub-install copies them. Would it be
> > possible to use /usr/share/grub/locale/$LANG.mo rather than
> > /usr/share/locale/$LANG/LC_MESSAGES/grub.mo? It would make grub-install
> > easier
> 
> No, for system locales we need to use standard locations, or the userland
> gettext won't find them.

No, for example:
carles@pinux:~/grubprova$ cat test.sh 
#!/bin/bash

export TEXTDOMAIN="testscript"
export TEXTDOMAINDIR="./locale"
echo $(gettext "hello world")

carles@pinux:~/grubprova$ 

carles@pinux:~/grubprova$ tree 
.
|-- locale
|   |-- ca
|   |   `-- LC_MESSAGES
|   |       `-- testscript.mo
|   |-- ca_ES@euro.po
|   `-- test.pot
`-- test.sh

3 directories, 4 files

I mean, the script needs to tell where the locale directory is located.
As far as I know even if it's in the standard locations.

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 17:22           ` Carles Pina i Estany
@ 2009-06-21 18:42             ` Robert Millan
  2009-06-21 19:14               ` Pavel Roskin
  0 siblings, 1 reply; 46+ messages in thread
From: Robert Millan @ 2009-06-21 18:42 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Jun 21, 2009 at 06:22:36PM +0100, Carles Pina i Estany wrote:
> > > It's not a problem. We need two locations anyway: one where make install
> > > copies them and the other one where ./grub-install copies them. Would it be
> > > possible to use /usr/share/grub/locale/$LANG.mo rather than
> > > /usr/share/locale/$LANG/LC_MESSAGES/grub.mo? It would make grub-install
> > > easier
> > 
> > No, for system locales we need to use standard locations, or the userland
> > gettext won't find them.
> 
> No, for example:

Uhm, okay.  But I'd really prefer if we could stick to the standard paths
anyway :-)

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 18:42             ` Robert Millan
@ 2009-06-21 19:14               ` Pavel Roskin
  2009-06-21 21:09                 ` Carles Pina i Estany
                                   ` (2 more replies)
  0 siblings, 3 replies; 46+ messages in thread
From: Pavel Roskin @ 2009-06-21 19:14 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, 2009-06-21 at 20:42 +0200, Robert Millan wrote:
> On Sun, Jun 21, 2009 at 06:22:36PM +0100, Carles Pina i Estany wrote:
> > > > It's not a problem. We need two locations anyway: one where make install
> > > > copies them and the other one where ./grub-install copies them. Would it be
> > > > possible to use /usr/share/grub/locale/$LANG.mo rather than
> > > > /usr/share/locale/$LANG/LC_MESSAGES/grub.mo? It would make grub-install
> > > > easier
> > > 
> > > No, for system locales we need to use standard locations, or the userland
> > > gettext won't find them.
> > 
> > No, for example:
> 
> Uhm, okay.  But I'd really prefer if we could stick to the standard paths
> anyway :-)

Do we really need to localize the bootloader?  I think localization of
the tools should be sufficient.

Even Linux kernel is not localized, and it's more likely to tell the
user something important than the bootloader.  Besides, how would you
ask the user about the preferred language at the boot time?  If anything
goes wrong, it's likely that the translations won't be available, and if
everything is fine, the user would just pick an item from the menu, and
the menu can be localized when it's generated.

As for the tools localization, we should follow the standards.

-- 
Regards,
Pavel Roskin



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 19:14               ` Pavel Roskin
@ 2009-06-21 21:09                 ` Carles Pina i Estany
  2009-06-21 21:18                   ` Robert Millan
                                     ` (2 more replies)
  2009-06-21 21:14                 ` Robert Millan
  2009-06-25 21:20                 ` Carles Pina i Estany
  2 siblings, 3 replies; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-21 21:09 UTC (permalink / raw)
  To: The development of GRUB 2


Hola,

On Jun/21/2009, Pavel Roskin wrote:
> On Sun, 2009-06-21 at 20:42 +0200, Robert Millan wrote:
> > On Sun, Jun 21, 2009 at 06:22:36PM +0100, Carles Pina i Estany wrote:
> > > > > It's not a problem. We need two locations anyway: one where make install
> > > > > copies them and the other one where ./grub-install copies them. Would it be
> > > > > possible to use /usr/share/grub/locale/$LANG.mo rather than
> > > > > /usr/share/locale/$LANG/LC_MESSAGES/grub.mo? It would make grub-install
> > > > > easier
> > > > 
> > > > No, for system locales we need to use standard locations, or the userland
> > > > gettext won't find them.
> > > 
> > > No, for example:
> > 
> > Uhm, okay.  But I'd really prefer if we could stick to the standard paths
> > anyway :-)
> 
> Do we really need to localize the bootloader?  I think localization of
> the tools should be sufficient.

By the moment I translated this string (as an example):
+"      Use the %C and %C keys to select which entry is highlighted.\n"

+"      Press enter to boot the selected OS, 'e' to edit the\n"
+"      commands before booting or 'c' for a command-line."

I think that some users can find themselves more comfortable if this is
in their language. So, they install some distribution in some language,
they restart and the first screen... is in another language.

Even this can be important to say that we have the GNU/Linux
operating system 100% translated.

> Even Linux kernel is not localized, and it's more likely to tell the
> user something important than the bootloader.  Besides, how would you

Kernel, under normal circumstancies, is not talking to the user during
the booting process. Grub does.

> ask the user about the preferred language at the boot time?  If anything
> goes wrong, it's likely that the translations won't be available, and if
> everything is fine, the user would just pick an item from the menu, and
> the menu can be localized when it's generated.

Well, we could have another approach and this is also nice:

_all_ strings that appears in a normal boot process (like the ones that
I showed above) are part of the grub.cfg file. So, when grub.cfg file is
generated we could have:

set updowntext="Use the %C and %C keys to select which entry is
highlighted."
set bootother="Press enter to boot the selected OS, 'e' to edit
the\ncommands before booting or 'c' for a command-line."

So, when we will translate the userland part translated all that the
users will see will be translated.

> As for the tools localization, we should follow the standards.

I think that this is the only thing that everybody agred from the
beginning :-)

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 19:14               ` Pavel Roskin
  2009-06-21 21:09                 ` Carles Pina i Estany
@ 2009-06-21 21:14                 ` Robert Millan
  2009-06-25 21:20                 ` Carles Pina i Estany
  2 siblings, 0 replies; 46+ messages in thread
From: Robert Millan @ 2009-06-21 21:14 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Jun 21, 2009 at 03:14:59PM -0400, Pavel Roskin wrote:
> 
> Do we really need to localize the bootloader?  I think localization of
> the tools should be sufficient.
> 
> Even Linux kernel is not localized, and it's more likely to tell the
> user something important than the bootloader.  Besides, how would you
> ask the user about the preferred language at the boot time?  If anything
> goes wrong, it's likely that the translations won't be available, and if
> everything is fine, the user would just pick an item from the menu, and
> the menu can be localized when it's generated.

I agree that for the most part, it's not necessary to localize a
bootloader.  But there's a big different between GRUB and Linux: GRUB
provides an interactive user interface.

I think the best would be to make a very strict selection of which
strings are worthy of translating.  At the very least, I'd translate
the "Use the %C and %C keys to select which entry is highlighted" type
stuff that Carles has provided as an example.

Perhaps help output in commands would also be useful.

And of course, the user tools.  Well at least the grub-mkconfig
strings, since they end up in the menu.

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 21:09                 ` Carles Pina i Estany
@ 2009-06-21 21:18                   ` Robert Millan
  2009-06-21 21:28                     ` Carles Pina i Estany
  2009-06-22 19:03                     ` Jordi Mallach
  2009-06-21 21:20                   ` Vladimir 'phcoder' Serbinenko
  2009-06-21 23:42                   ` Pavel Roskin
  2 siblings, 2 replies; 46+ messages in thread
From: Robert Millan @ 2009-06-21 21:18 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Jun 21, 2009 at 10:09:14PM +0100, Carles Pina i Estany wrote:
> > 
> > Do we really need to localize the bootloader?  I think localization of
> > the tools should be sufficient.
> 
> By the moment I translated this string (as an example):
> +"      Use the %C and %C keys to select which entry is highlighted.\n"
> 
> +"      Press enter to boot the selected OS, 'e' to edit the\n"
> +"      commands before booting or 'c' for a command-line."

Uhm this string seems problematic.  We shouldn't have a \n there.  I
wonder if there's an easy way to solve this.

> Well, we could have another approach and this is also nice:
> 
> _all_ strings that appears in a normal boot process (like the ones that
> I showed above) are part of the grub.cfg file. So, when grub.cfg file is
> generated we could have:
> 
> set updowntext="Use the %C and %C keys to select which entry is
> highlighted."
> set bootother="Press enter to boot the selected OS, 'e' to edit
> the\ncommands before booting or 'c' for a command-line."
> 
> So, when we will translate the userland part translated all that the
> users will see will be translated.

Sounds like an interesting option.  It's a pity you already spent the effort
on implementing gettext in grub side, though :-(

First of all, we should agree on what we want to translate.  If it's clear
we only want this kind of strings, we could use this approach.

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 21:09                 ` Carles Pina i Estany
  2009-06-21 21:18                   ` Robert Millan
@ 2009-06-21 21:20                   ` Vladimir 'phcoder' Serbinenko
  2009-06-21 23:42                   ` Pavel Roskin
  2 siblings, 0 replies; 46+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-06-21 21:20 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1604 bytes --]

On Sun, Jun 21, 2009 at 11:09 PM, Carles Pina i Estany <carles@pina.cat>wrote:

> Well, we could have another approach and this is also nice:
>
> _all_ strings that appears in a normal boot process (like the ones that
> I showed above) are part of the grub.cfg file. So, when grub.cfg file is
> generated we could have:
>
> set updowntext="Use the %C and %C keys to select which entry is
> highlighted."
> set bootother="Press enter to boot the selected OS, 'e' to edit
> the\ncommands before booting or 'c' for a command-line."
>
> So, when we will translate the userland part translated all that the
> users will see will be translated.
>
There is a parallel discussion of making text-menu themes. I think both can
be integrated together

>
> > As for the tools localization, we should follow the standards.
>
> I think that this is the only thing that everybody agred from the
> beginning :-)
>
Many standards are done for "regular" user-space program. GRUB isn't one so
we need to break standards sometimes.
Additionally because we're GNU project we follow GCS when possible and it
says " In developing a GNU program, you should implement an outside
standard's specifications when that makes the GNU system better overall in
an objective sense. When it doesn't, you shouldn't. "

>
> --
> Carles Pina i Estany
>        http://pinux.info
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git

[-- Attachment #2: Type: text/html, Size: 2704 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 21:18                   ` Robert Millan
@ 2009-06-21 21:28                     ` Carles Pina i Estany
  2009-06-21 22:03                       ` Vladimir 'phcoder' Serbinenko
  2009-06-22 19:03                     ` Jordi Mallach
  1 sibling, 1 reply; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-21 21:28 UTC (permalink / raw)
  To: The development of GRUB 2


Hi,

On Jun/21/2009, Robert Millan wrote:

> Sounds like an interesting option.  It's a pity you already spent the effort
> on implementing gettext in grub side, though :-(

Yes it's pity, but I will not force to use what I implemented if now we
think something better. So we can discuss that I will not get upset for
it.

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 21:28                     ` Carles Pina i Estany
@ 2009-06-21 22:03                       ` Vladimir 'phcoder' Serbinenko
  2009-06-21 22:31                         ` Carles Pina i Estany
  0 siblings, 1 reply; 46+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-06-21 22:03 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]

On Sun, Jun 21, 2009 at 11:28 PM, Carles Pina i Estany <carles@pina.cat>wrote:

>
> Hi,
>
> On Jun/21/2009, Robert Millan wrote:
>
> > Sounds like an interesting option.  It's a pity you already spent the
> effort
> > on implementing gettext in grub side, though :-(
>
> Yes it's pity, but I will not force to use what I implemented if now we
> think something better. So we can discuss that I will not get upset for
> it.
>
Actually I think it would be a good move to provide translations of e.g.
error strings, output and help texts even if I personally will never use
this feature. In other words I would translate the same parts as are
translated in a typical linux counterparts. But I would like to discuss
other possibilities as well.

>
> --
> Carles Pina i Estany
>        http://pinux.info
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git

[-- Attachment #2: Type: text/html, Size: 1912 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 22:03                       ` Vladimir 'phcoder' Serbinenko
@ 2009-06-21 22:31                         ` Carles Pina i Estany
  2009-06-21 22:47                           ` Robert Millan
  0 siblings, 1 reply; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-21 22:31 UTC (permalink / raw)
  To: The development of GRUB 2


Hi,

On Jun/22/2009, Vladimir 'phcoder' Serbinenko wrote:
> On Sun, Jun 21, 2009 at 11:28 PM, Carles Pina i Estany <carles@pina.cat>wrote:
> 
> >
> > Hi,
> >
> > On Jun/21/2009, Robert Millan wrote:
> >
> > > Sounds like an interesting option.  It's a pity you already spent the
> > effort
> > > on implementing gettext in grub side, though :-(
> >
> > Yes it's pity, but I will not force to use what I implemented if now we
> > think something better. So we can discuss that I will not get upset for
> > it.
> >
> Actually I think it would be a good move to provide translations of e.g.
> error strings, output and help texts even if I personally will never use
> this feature. In other words I would translate the same parts as are
> translated in a typical linux counterparts. But I would like to discuss
> other possibilities as well.

same feelings here

Robert, I think that Ubuntu people was interested to translate Grub. Do
they want to translate only the frontcover or all messages? (for
example, to do something as easy as adding init=/bin/bash in one
operating system entry, that users may have to do even if Grub is
working...)

The patch to translate Grub (booting time) is not very big and should
not add problems in terms of Grub mantainability (when it's done). 

Regards,

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 22:31                         ` Carles Pina i Estany
@ 2009-06-21 22:47                           ` Robert Millan
  2009-06-21 22:56                             ` Colin Watson
  0 siblings, 1 reply; 46+ messages in thread
From: Robert Millan @ 2009-06-21 22:47 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: david.planella, cjwatson

On Sun, Jun 21, 2009 at 11:31:57PM +0100, Carles Pina i Estany wrote:
> On Jun/22/2009, Vladimir 'phcoder' Serbinenko wrote:
> > On Sun, Jun 21, 2009 at 11:28 PM, Carles Pina i Estany <carles@pina.cat>wrote:
> > Actually I think it would be a good move to provide translations of e.g.
> > error strings, output and help texts even if I personally will never use
> > this feature. In other words I would translate the same parts as are
> > translated in a typical linux counterparts. But I would like to discuss
> > other possibilities as well.
> 
> same feelings here
> 
> Robert, I think that Ubuntu people was interested to translate Grub. Do
> they want to translate only the frontcover or all messages? (for
> example, to do something as easy as adding init=/bin/bash in one
> operating system entry, that users may have to do even if Grub is
> working...)
> 
> The patch to translate Grub (booting time) is not very big and should
> not add problems in terms of Grub mantainability (when it's done). 

I suppose input from them will be helpful.  Let's CC them.

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 22:47                           ` Robert Millan
@ 2009-06-21 22:56                             ` Colin Watson
  0 siblings, 0 replies; 46+ messages in thread
From: Colin Watson @ 2009-06-21 22:56 UTC (permalink / raw)
  To: Robert Millan; +Cc: david.planella, The development of GRUB 2

On Mon, Jun 22, 2009 at 12:47:15AM +0200, Robert Millan wrote:
> On Sun, Jun 21, 2009 at 11:31:57PM +0100, Carles Pina i Estany wrote:
> > On Jun/22/2009, Vladimir 'phcoder' Serbinenko wrote:
> > > On Sun, Jun 21, 2009 at 11:28 PM, Carles Pina i Estany <carles@pina.cat>wrote:
> > > Actually I think it would be a good move to provide translations of e.g.
> > > error strings, output and help texts even if I personally will never use
> > > this feature. In other words I would translate the same parts as are
> > > translated in a typical linux counterparts. But I would like to discuss
> > > other possibilities as well.
> > 
> > same feelings here
> > 
> > Robert, I think that Ubuntu people was interested to translate Grub. Do
> > they want to translate only the frontcover or all messages? (for
> > example, to do something as easy as adding init=/bin/bash in one
> > operating system entry, that users may have to do even if Grub is
> > working...)
> > 
> > The patch to translate Grub (booting time) is not very big and should
> > not add problems in terms of Grub mantainability (when it's done). 
> 
> I suppose input from them will be helpful.  Let's CC them.

Nobody's given me requirements for this yet so I don't really know for
sure.

I believe that the requirements we have for translation are mainly
requests from OEM distributors who want to tick the boxes for
distribution in various locales, mainly making sure that their standard
setup displays a boot menu that's legible to each target audience. I
would expect that the ability to translate menu text and anything else
displayed in normal code paths (e.g. menu header text, advice on
keystrokes for editing menu entries, etc.) is most important to us, and
anything else is secondary.

I don't really care very much about translation of error messages
myself. If your system fails to boot then there are loads of things
other than the boot loader that might plausibly only be able to give you
errors in English anyway.

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 21:09                 ` Carles Pina i Estany
  2009-06-21 21:18                   ` Robert Millan
  2009-06-21 21:20                   ` Vladimir 'phcoder' Serbinenko
@ 2009-06-21 23:42                   ` Pavel Roskin
  2009-06-22  9:39                     ` Robert Millan
  2 siblings, 1 reply; 46+ messages in thread
From: Pavel Roskin @ 2009-06-21 23:42 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, 2009-06-21 at 22:09 +0100, Carles Pina i Estany wrote:

> > Do we really need to localize the bootloader?  I think localization of
> > the tools should be sufficient.
> 
> By the moment I translated this string (as an example):
> +"      Use the %C and %C keys to select which entry is highlighted.\n"
> 
> +"      Press enter to boot the selected OS, 'e' to edit the\n"
> +"      commands before booting or 'c' for a command-line."

Actually, Colin D Bennett posted a link to a proposal to eliminate that
text.  That's the link to the screenshots:

http://ubuntuforums.org/showpost.php?p=7444286&postcount=24

There are still words to be translated, but it's significantly less text
and even it remains untranslated, it would not be as visible as it is
now.

-- 
Regards,
Pavel Roskin



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 23:42                   ` Pavel Roskin
@ 2009-06-22  9:39                     ` Robert Millan
  2009-06-22 10:16                       ` Colin Watson
  0 siblings, 1 reply; 46+ messages in thread
From: Robert Millan @ 2009-06-22  9:39 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Jun 21, 2009 at 07:42:13PM -0400, Pavel Roskin wrote:
> On Sun, 2009-06-21 at 22:09 +0100, Carles Pina i Estany wrote:
> 
> > > Do we really need to localize the bootloader?  I think localization of
> > > the tools should be sufficient.
> > 
> > By the moment I translated this string (as an example):
> > +"      Use the %C and %C keys to select which entry is highlighted.\n"
> > 
> > +"      Press enter to boot the selected OS, 'e' to edit the\n"
> > +"      commands before booting or 'c' for a command-line."
> 
> Actually, Colin D Bennett posted a link to a proposal to eliminate that
> text.  That's the link to the screenshots:
> 
> http://ubuntuforums.org/showpost.php?p=7444286&postcount=24
> 
> There are still words to be translated, but it's significantly less text
> and even it remains untranslated, it would not be as visible as it is
> now.

It looks awesome, we could switch to that!  What does everyone think?

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-22  9:39                     ` Robert Millan
@ 2009-06-22 10:16                       ` Colin Watson
  0 siblings, 0 replies; 46+ messages in thread
From: Colin Watson @ 2009-06-22 10:16 UTC (permalink / raw)
  To: grub-devel

On Mon, Jun 22, 2009 at 11:39:56AM +0200, Robert Millan wrote:
> On Sun, Jun 21, 2009 at 07:42:13PM -0400, Pavel Roskin wrote:
> > Actually, Colin D Bennett posted a link to a proposal to eliminate that
> > text.  That's the link to the screenshots:
> > 
> > http://ubuntuforums.org/showpost.php?p=7444286&postcount=24
> > 
> > There are still words to be translated, but it's significantly less text
> > and even it remains untranslated, it would not be as visible as it is
> > now.
> 
> It looks awesome, we could switch to that!  What does everyone think?

It's not clear just from the screenshot what I'm supposed to do at that
screen. Hit Tab to get to options? Cursor-key off the bottom? Press O or
H?

I think it's too terse in general.

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 21:18                   ` Robert Millan
  2009-06-21 21:28                     ` Carles Pina i Estany
@ 2009-06-22 19:03                     ` Jordi Mallach
  2009-06-22 19:42                       ` Javier Martín
  1 sibling, 1 reply; 46+ messages in thread
From: Jordi Mallach @ 2009-06-22 19:03 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Jun 21, 2009 at 11:18:08PM +0200, Robert Millan wrote:
> > +"      Use the %C and %C keys to select which entry is highlighted.\n"
> > 
> > +"      Press enter to boot the selected OS, 'e' to edit the\n"
> > +"      commands before booting or 'c' for a command-line."
> Uhm this string seems problematic.  We shouldn't have a \n there.  I
> wonder if there's an easy way to solve this.

It'd be better if this was formed by a long, uncut string, but unless GRUB
will have problems displaying the same using more or less lines than the
original, it's not a very big deal. Translators can place the \n wherever
they find is OK to cut the line. Many other programs have similar stuff.

What is VERY important is that all the \n lines are part of a single msgid.
What would be problematic (really!) would be something like:

msgid "Use the %C and %C keys to select which entry is highlighted."
msgid "Press enter to boot the selected OS, 'e' to edit the"
msgid "commands before booting or 'c' for a command-line."

Or even worse,

msgid "Use the"
msgid "keys to select which entry is highlighted."

Translators are completely lost in these two cases.

Jordi
-- 
Jordi Mallach Pérez  --  Debian developer     http://www.debian.org/
jordi@sindominio.net     jordi@debian.org     http://www.sindominio.net/
GnuPG public key information available at http://oskuro.net/



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-22 19:03                     ` Jordi Mallach
@ 2009-06-22 19:42                       ` Javier Martín
  2009-06-23 10:05                         ` Jordi Mallach
  0 siblings, 1 reply; 46+ messages in thread
From: Javier Martín @ 2009-06-22 19:42 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1268 bytes --]

El lun, 22-06-2009 a las 21:03 +0200, Jordi Mallach escribió:
> What is VERY important is that all the \n lines are part of a single msgid.
> What would be problematic (really!) would be something like:
> 
> msgid "Use the %C and %C keys to select which entry is highlighted."
> msgid "Press enter to boot the selected OS, 'e' to edit the"
> msgid "commands before booting or 'c' for a command-line."

Actually, the first string could stand on its own just fine, but the
second and the third should be joined. Don't forget that the spirit of
gettext is translating full sentences when possible, and semantically
complete messages when not. Otherwise the translators can get lost with
usually ridiculous consequences. By the way, I offer myself for the
Spanish translation;

msgid "Use the %C and %C keys to select which entry is highlighted."
msgstr "Utilize las teclas %C y %C para seleccionar la entrada
resaltada."

msgid ""
"Press enter to boot the selected OS, 'e' to edit the"
"commands before booting or 'c' for a command-line."
msgstr ""
"Pulse Enter para iniciar el SO seleccionado, 'e' para editar la"
"lista de comandos antes de arrancar, ó 'c' para abrir un intérprete."

-- 
-- Lazy, Oblivious, Recurrent Disaster -- Habbit

[-- Attachment #2: Esto es una parte de mensaje firmado digitalmente --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-22 19:42                       ` Javier Martín
@ 2009-06-23 10:05                         ` Jordi Mallach
  2009-06-23 10:45                           ` Javier Martín
  0 siblings, 1 reply; 46+ messages in thread
From: Jordi Mallach @ 2009-06-23 10:05 UTC (permalink / raw)
  To: The development of GRUB 2

On Mon, Jun 22, 2009 at 09:42:17PM +0200, Javier Martín wrote:
> > msgid "Use the %C and %C keys to select which entry is highlighted."
> > msgid "Press enter to boot the selected OS, 'e' to edit the"
> > msgid "commands before booting or 'c' for a command-line."
> Actually, the first string could stand on its own just fine, but the
> second and the third should be joined.

I don't agree. This is part of a full paragraph, and the ideal string would
be just one. It's a mere coincidence that the first example msgid I wrote
ends on a full stop. A translation would possibly span to two lines, and
then you would have a problem, with the first "single" line taking one
complete line and possibly just a few columns of the second, but you wouldn't
be able to add more to the second line, as the msgid ended there.

> msgid "Use the %C and %C keys to select which entry is highlighted."
> msgstr "Utilize las teclas %C y %C para seleccionar la entrada
> resaltada."

Well, s/Utilize/Utilice/

> "Pulse Enter para iniciar el SO seleccionado, 'e' para editar la"
> "lista de comandos antes de arrancar, ó 'c' para abrir un intérprete."

s/Enter/Intro/

 ;)

Jordi
-- 
Jordi Mallach Pérez  --  Debian developer     http://www.debian.org/
jordi@sindominio.net     jordi@debian.org     http://www.sindominio.net/
GnuPG public key information available at http://oskuro.net/



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-23 10:05                         ` Jordi Mallach
@ 2009-06-23 10:45                           ` Javier Martín
  2009-06-24  9:17                             ` Jordi Mallach
  0 siblings, 1 reply; 46+ messages in thread
From: Javier Martín @ 2009-06-23 10:45 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1803 bytes --]

El mar, 23-06-2009 a las 12:05 +0200, Jordi Mallach escribió:
> On Mon, Jun 22, 2009 at 09:42:17PM +0200, Javier Martín wrote:
> > > msgid "Use the %C and %C keys to select which entry is highlighted."
> > > msgid "Press enter to boot the selected OS, 'e' to edit the"
> > > msgid "commands before booting or 'c' for a command-line."
> > Actually, the first string could stand on its own just fine, but the
> > second and the third should be joined.
> 
> I don't agree. This is part of a full paragraph, and the ideal string would
> be just one. It's a mere coincidence that the first example msgid I wrote
> ends on a full stop. A translation would possibly span to two lines, and
> then you would have a problem, with the first "single" line taking one
> complete line and possibly just a few columns of the second, but you wouldn't
> be able to add more to the second line, as the msgid ended there.
Why not? A msgid does not necessarily mean a \n, you can printf("%s %s",
_("first"), _("second")) just OK without an intervening line break. In
this particular case the gettext "directives" [0] don't tell us either
to merge or split: the two sentences are related, yes, but are perfectly
translatable on their own as their particular meaning does not depend on
one another. I guess it's a design decision.

> Well, s/Utilize/Utilice/
> s/Enter/Intro/
> 
>  ;)
Heh... This is cruel and unusual punishment, I'm in exams (rocket
science, literally) and too stressed to be able to use my own native
language properly. Nevertheless, if you want to be a purist, you might
want to s/Enter/Entrar/ or even s/Enter/Retorno de carro/. ;P

-- 
-- Lazy, Oblivious, Recurrent Disaster -- Habbit

[0] -
http://www.gnu.org/software/gettext/manual/gettext.html#Preparing-Strings

[-- Attachment #2: Esto es una parte de mensaje firmado digitalmente --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-23 10:45                           ` Javier Martín
@ 2009-06-24  9:17                             ` Jordi Mallach
  0 siblings, 0 replies; 46+ messages in thread
From: Jordi Mallach @ 2009-06-24  9:17 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, Jun 23, 2009 at 12:45:39PM +0200, Javier Martín wrote:
> Why not? A msgid does not necessarily mean a \n, you can printf("%s %s",
> _("first"), _("second")) just OK without an intervening line break. In
> this particular case the gettext "directives" [0] don't tell us either
> to merge or split: the two sentences are related, yes, but are perfectly
> translatable on their own as their particular meaning does not depend on
> one another. I guess it's a design decision.

What I was trying to say is that in this case, that the two strings are
both part of a full paragraph, and it's better to have them in a single
msgid if possible. Splitting them can cause its own problems for some
languages, if the translated text is just slightly longer than the original.

> > Well, s/Utilize/Utilice/
> > s/Enter/Intro/
> > 
> >  ;)
> Heh... This is cruel and unusual punishment, I'm in exams (rocket
> science, literally) and too stressed to be able to use my own native
> language properly. Nevertheless, if you want to be a purist, you might
> want to s/Enter/Entrar/ or even s/Enter/Retorno de carro/. ;P

Didn't intend to sound as a punishment ;)

Getting a bit offtopic, but I think Enter is one key, Return is another,
so Retorno would be the translation for Return.

Good luck with your exams!

-- 
Jordi Mallach Pérez  --  Debian developer     http://www.debian.org/
jordi@sindominio.net     jordi@debian.org     http://www.sindominio.net/
GnuPG public key information available at http://oskuro.net/



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-21 19:14               ` Pavel Roskin
  2009-06-21 21:09                 ` Carles Pina i Estany
  2009-06-21 21:14                 ` Robert Millan
@ 2009-06-25 21:20                 ` Carles Pina i Estany
  2009-06-26  3:09                   ` Pavel Roskin
  2 siblings, 1 reply; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-25 21:20 UTC (permalink / raw)
  To: The development of GRUB 2


Hello,

On Jun/21/2009, Pavel Roskin wrote:

[picking up your message just to get one]

> Do we really need to localize the bootloader?  I think localization of
> the tools should be sufficient.

So, what we can do?:
a1) add i18n support to the userland scripts

b1) apply (and finish the building support) the patch to add gettext
support in Grub2 (patch is done, it needs to add the the building
support and add the gettext call to all srings -can be done gradually)

OR:

a2) add i18n support to the userland scripts

b2) change a bit Grub2 so the most public strings (initial instructions)
are variables in the grub2.cfg file, and Grub2 will get it from the file

I'm very interested to finish b1 or add support for b2. a1/a2 is the
same, I have done some tests and we needed to decide where the .mo files
will be. I will need some help for building stuff :(

IMHO: b1 looks more professional/nicer and complete than b2, that looks
like a quick-patch, no? But both has similar results.

Next 2 days I will have time to read/answer the mails but not for code.

Any option will take very long, once we have decided :-)

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-25 21:20                 ` Carles Pina i Estany
@ 2009-06-26  3:09                   ` Pavel Roskin
  2009-06-26 12:47                     ` Robert Millan
  0 siblings, 1 reply; 46+ messages in thread
From: Pavel Roskin @ 2009-06-26  3:09 UTC (permalink / raw)
  To: The development of GRUB 2

On Thu, 2009-06-25 at 22:20 +0100, Carles Pina i Estany wrote:

> IMHO: b1 looks more professional/nicer and complete than b2, that looks
> like a quick-patch, no? But both has similar results.

I realize now that the comparison with the kernel was wrong.  The kernel
output can be hidden from the user.  But GRUB is interactive by design.

My main concern is the size of the files we install in /boot/grub.  It's
approaching one megabyte already, without the localization.  That's why
I'm trying to avoid a large number of *.mo files in /boot/grub.

On the other hand, incorporating a dictionary into grub.cfg would be
equivalent to having just one set of strings under /boot/grub.  But we
can achieve the same by having one *.mo file in /boot/grub.

I agree, using gettext is a more solid approach technically.

But installing all *.mo files to /boot/grub would be an overkill in many
cases.  I think copying the file for the current language should be
enough.  The same language should be specified in grub.cfg when it's
generated.

-- 
Regards,
Pavel Roskin



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-26  3:09                   ` Pavel Roskin
@ 2009-06-26 12:47                     ` Robert Millan
  2009-06-26 15:31                       ` Pavel Roskin
  2009-06-26 23:42                       ` Carles Pina i Estany
  0 siblings, 2 replies; 46+ messages in thread
From: Robert Millan @ 2009-06-26 12:47 UTC (permalink / raw)
  To: The development of GRUB 2

On Thu, Jun 25, 2009 at 11:09:02PM -0400, Pavel Roskin wrote:
> 
> My main concern is the size of the files we install in /boot/grub.  It's
> approaching one megabyte already,

We don't need to do that just because of OFW.  I think the approach of
installing /boot/grub/ to that tiny filesystem is just wrong (yes, this
is my fault ;-)).  We could just install core.img there and put
/boot/grub/ in the standard filesystem.

> But installing all *.mo files to /boot/grub would be an overkill in many
> cases.  I think copying the file for the current language should be
> enough.  The same language should be specified in grub.cfg when it's
> generated.

Yes.  We can only support one language anyway (the system-wide language,
which is what grub-mkconfig will use when generating strings for grub.cfg).

Also, if *.mo files contain plain text, compression would work well on
them.  They could be gzipped.

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



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-26 12:47                     ` Robert Millan
@ 2009-06-26 15:31                       ` Pavel Roskin
  2009-06-26 23:42                       ` Carles Pina i Estany
  1 sibling, 0 replies; 46+ messages in thread
From: Pavel Roskin @ 2009-06-26 15:31 UTC (permalink / raw)
  To: The development of GRUB 2

On Fri, 2009-06-26 at 14:47 +0200, Robert Millan wrote:
> On Thu, Jun 25, 2009 at 11:09:02PM -0400, Pavel Roskin wrote:
> > 
> > My main concern is the size of the files we install in /boot/grub.  It's
> > approaching one megabyte already,
> 
> We don't need to do that just because of OFW.  I think the approach of
> installing /boot/grub/ to that tiny filesystem is just wrong (yes, this
> is my fault ;-)).  We could just install core.img there and put
> /boot/grub/ in the standard filesystem.

Yes, I think we'll need to rewrite grub-install to use hfsutils, perhaps
optionally.

> > But installing all *.mo files to /boot/grub would be an overkill in many
> > cases.  I think copying the file for the current language should be
> > enough.  The same language should be specified in grub.cfg when it's
> > generated.
> 
> Yes.  We can only support one language anyway (the system-wide language,
> which is what grub-mkconfig will use when generating strings for grub.cfg).
> 
> Also, if *.mo files contain plain text, compression would work well on
> them.  They could be gzipped.

Good point.

-- 
Regards,
Pavel Roskin



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Fw: gettext support
  2009-06-26 12:47                     ` Robert Millan
  2009-06-26 15:31                       ` Pavel Roskin
@ 2009-06-26 23:42                       ` Carles Pina i Estany
  1 sibling, 0 replies; 46+ messages in thread
From: Carles Pina i Estany @ 2009-06-26 23:42 UTC (permalink / raw)
  To: The development of GRUB 2


Hi,

On Jun/26/2009, Robert Millan wrote:

> Also, if *.mo files contain plain text, compression would work well on
> them.  They could be gzipped.

Yes, they contain plain text.

I implemented gettext without the hashtable (the .mo files usually has a
hashtable for the search). We will not have lot of strings, so we don't
need the hash table to speed up and we safe some space in implementation
and the .mo file.

I haven't counted the overhead of using a .mo file instead a other
solutions, but it's very reasonable.
Actually this file (.po simplified file):
-------------
#: normal/menu.c:90
#, c-format
msgid ""
"\n"
"      Use the %C and %C keys to select which entry is highlighted.\n"
msgstr ""
"\n"
"      Utilitzeu les tecles %C i %C per seleccionar l'entrada.\n"

#: normal/menu.c:93
msgid ""
"      Press enter to boot the selected OS, 'e' to edit the\n"
"      commands before booting or 'c' for a command-line."
msgstr ""
"      Presioneu retorn per arrancar el SO seleccionat, 'e' editar\n"
"      les comandes abans d'arrancar, 'c' per línia d'ordres."

#: util/grub.d/10_linux.in:143
#, sh-format
msgid "${OS}, linux ${version} (recovery mode)"
msgstr "${OS}, linux ${version} (mode recuperació)"

#, sh-format
msgid "hello"
msgstr "hola"
---------------
carles@pinux:~/grub/grub2/po$ msgfmt --no-hash ca.po -o test.mo
carles@pinux:~/grub/grub2/po$ ls -la ca.po  test.mo 
-rw-r--r-- 1 carles carles 680  8 mar 19:08 ca.po
-rw-r--r-- 1 carles carles 562 27 jun 00:42 test.mo
carles@pinux:~/grub/grub2/po$ 

so, in terms of size it's even smaller than the .po file (it avoids the
comments, etc.)


-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2009-06-26 23:43 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-16 21:47 Fw: gettext support Carles Pina i Estany
2009-06-16 22:37 ` Vladimir 'phcoder' Serbinenko
2009-06-17 11:37 ` Vladimir 'phcoder' Serbinenko
2009-06-17 20:29   ` Carles Pina i Estany
2009-06-18 13:38     ` Robert Millan
2009-06-18 14:45       ` Vladimir 'phcoder' Serbinenko
2009-06-18 21:07         ` Carles Pina i Estany
2009-06-19 17:22           ` Vladimir 'phcoder' Serbinenko
2009-06-19 23:13             ` Carles Pina i Estany
2009-06-20  0:17               ` Vladimir 'phcoder' Serbinenko
2009-06-19 10:32         ` Robert Millan
2009-06-18 19:30       ` Carles Pina i Estany
2009-06-18 20:56   ` Carles Pina i Estany
2009-06-19 10:37     ` Robert Millan
2009-06-19 10:42       ` Vladimir 'phcoder' Serbinenko
2009-06-21 11:07         ` Robert Millan
2009-06-21 17:22           ` Carles Pina i Estany
2009-06-21 18:42             ` Robert Millan
2009-06-21 19:14               ` Pavel Roskin
2009-06-21 21:09                 ` Carles Pina i Estany
2009-06-21 21:18                   ` Robert Millan
2009-06-21 21:28                     ` Carles Pina i Estany
2009-06-21 22:03                       ` Vladimir 'phcoder' Serbinenko
2009-06-21 22:31                         ` Carles Pina i Estany
2009-06-21 22:47                           ` Robert Millan
2009-06-21 22:56                             ` Colin Watson
2009-06-22 19:03                     ` Jordi Mallach
2009-06-22 19:42                       ` Javier Martín
2009-06-23 10:05                         ` Jordi Mallach
2009-06-23 10:45                           ` Javier Martín
2009-06-24  9:17                             ` Jordi Mallach
2009-06-21 21:20                   ` Vladimir 'phcoder' Serbinenko
2009-06-21 23:42                   ` Pavel Roskin
2009-06-22  9:39                     ` Robert Millan
2009-06-22 10:16                       ` Colin Watson
2009-06-21 21:14                 ` Robert Millan
2009-06-25 21:20                 ` Carles Pina i Estany
2009-06-26  3:09                   ` Pavel Roskin
2009-06-26 12:47                     ` Robert Millan
2009-06-26 15:31                       ` Pavel Roskin
2009-06-26 23:42                       ` Carles Pina i Estany
2009-06-19 13:55       ` Jordi Mallach
2009-06-19 14:32         ` Vladimir 'phcoder' Serbinenko
2009-06-21 11:17           ` Robert Millan
2009-06-19 23:08       ` Carles Pina i Estany
2009-06-21 11:09         ` Robert Millan

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.