]> git.proxmox.com Git - grub2.git/commitdiff
This commit is the same than gettext08.patch (see mailing list)
authorCarles Pina i Estany <carles@pina.cat>
Sun, 22 Nov 2009 12:50:46 +0000 (12:50 +0000)
committerCarles Pina i Estany <carles@pina.cat>
Sun, 22 Nov 2009 12:50:46 +0000 (12:50 +0000)
ChangeLog.gettext
conf/common.rmk
gettext/gettext.c
include/grub/file.h
include/grub/misc.h
kern/file.c

index 6bce3f38b7023856f808f671ec09bfae9e37c1d3..a62869861c35a7685d843cdeaf6e9d4f42097f2d 100644 (file)
@@ -1,15 +1,18 @@
 YYYY-MM-DD  Carles Pina i Estany <carles@pina.cat>
 
-       * conf/common.rmk: Add grub-gettext_lib target, dependency and
-         SOURCES, CFLAGS, LDFLAGS
-       * gettext/gettext.c: New file with gettext implementation
-       * include/grub/i18n_grub.h: New file with grub_gettext macros
-       * include/grub/misc.h: Define macro _(char *s). Declare
-         grub_gettext_dummy and grub_gettext
-       * kern/misc.c: Define grub_gettext symbol implementation of the
-         grub_gettext_dummy function
-       * normal/menu_text.c: Gettextize one message in print_message
-       * po/POTFILES: Adds normal/menu_text.c
-       * po/ca.po: Adds the new string
-       * util/grub.d/00_header.in: defines gettext variables and loads
-         the module
+       * conf/common.rmk: Add grub-gettext_lib target and updates
+         lib_DATA and CLEANFILES. Adds gettext.mod SOURCES, CFLAGS,
+         LDFLAGS.
+       * gettext/gettext.c: New file. (Reads mo files).
+       * include/grub/file.h (grub_file_pread): New prototype.
+       * include/grub/i18n.h (_): New prototype.
+       * include/grub/misc.h (grub_gettext_dummy, grub_gettext): New 
+         prototypes.
+       * kern/misc.c (grub_gettext_dummy): New function.
+       * menu/menu_text.c: Include <grub/i18n.h>.
+       * menu/menu_text.c (print_timeout): Gettexttize string.
+       * menu/menu_text.c (print_message): Gettexttize string.
+       * po/POTFILES: Add `normal/menu_text.c'.
+       * po/ca.po: Add new translations.
+       * util/grub.d/00_header.in: Define locale_dir and lang. insmod 
+         gettext module and defines locale_dir and lang in grub.cfg.
index a4c3c80e8f5826671b953099275dbfd0f3258c5c..be0543d834666729ea9da35510f5eb36d87d0fb2 100644 (file)
@@ -185,7 +185,7 @@ grub-mkconfig_DATA += util/grub.d/README
 pkglib_MODULES += fshelp.mod fat.mod ufs1.mod ufs2.mod ext2.mod ntfs.mod \
        ntfscomp.mod minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod      \
        affs.mod sfs.mod hfsplus.mod reiserfs.mod cpio.mod tar.mod      \
-       udf.mod afs.mod afs_be.mod befs.mod befs_be.mod 
+       udf.mod afs.mod afs_be.mod befs.mod befs_be.mod
 
 # For fshelp.mod.
 fshelp_mod_SOURCES = fs/fshelp.c
index c488f0e50152f45b3a40d11869d82e39e5fbfc3d..799d8a0371992abc05230f2ba7f839f5baec9d05 100644 (file)
@@ -48,12 +48,23 @@ static const char *(*grub_gettext_original) (const char *s);
 
 #define MO_MAGIC_NUMBER                0x950412de
 
+static grub_ssize_t
+grub_gettext_pread (grub_file_t file, void *buf, grub_size_t len,
+                   grub_off_t offset)
+{
+  if (grub_file_seek (file, offset) == (grub_off_t) - 1)
+    {
+      return -1;
+    }
+  return grub_file_read (file, buf, len);
+}
+
 static grub_uint32_t
 grub_gettext_get_info (int offset)
 {
   grub_uint32_t value;
 
-  grub_file_pread (fd_mo, (char *) &value, 4, offset);
+  grub_gettext_pread (fd_mo, (char *) &value, 4, offset);
 
   value = grub_cpu_to_le32 (value);
   return value;
@@ -63,7 +74,7 @@ static void
 grub_gettext_getstring_from_offset (grub_uint32_t offset,
                                    grub_uint32_t length, char *translation)
 {
-  grub_file_pread (fd_mo, translation, length, offset);
+  grub_gettext_pread (fd_mo, translation, length, offset);
   translation[length] = '\0';
 }
 
@@ -79,10 +90,10 @@ grub_gettext_gettranslation_from_position (int position)
 
   internal_position = offsettranslation + position * 8;
 
-  grub_file_pread (fd_mo, (char *) &length, 4, internal_position);
+  grub_gettext_pread (fd_mo, (char *) &length, 4, internal_position);
   length = grub_cpu_to_le32 (length);
 
-  grub_file_pread (fd_mo, (char *) &offset, 4, internal_position + 4);
+  grub_gettext_pread (fd_mo, (char *) &offset, 4, internal_position + 4);
   offset = grub_cpu_to_le32 (offset);
 
   translation = grub_malloc (length + 1);
@@ -102,10 +113,10 @@ grub_gettext_getstring_from_position (int position)
   internal_position = grub_gettext_offsetoriginal + (position * 8);
 
   /* Get the length of the string i.  */
-  grub_file_pread (fd_mo, (char *) &length, 4, internal_position);
+  grub_gettext_pread (fd_mo, (char *) &length, 4, internal_position);
 
   /* Get the offset of the string i.  */
-  grub_file_pread (fd_mo, (char *) &offset, 4, internal_position + 4);
+  grub_gettext_pread (fd_mo, (char *) &offset, 4, internal_position + 4);
 
   /* Get the string i.  */
   original = grub_malloc (length + 1);
index 6625e045dd6dfb01fe9dd13ae5d7e2d5380f2234..2aacf936f9fa3e8b1f15b91ad007c4b20c05e037 100644 (file)
@@ -55,8 +55,6 @@ grub_file_t EXPORT_FUNC(grub_file_open) (const char *name);
 grub_ssize_t EXPORT_FUNC(grub_file_read) (grub_file_t file, void *buf,
                                          grub_size_t len);
 grub_off_t EXPORT_FUNC(grub_file_seek) (grub_file_t file, grub_off_t offset);
-grub_ssize_t EXPORT_FUNC(grub_file_pread) (grub_file_t file, void *buf, grub_size_t len, grub_off_t offset);
-
 grub_err_t EXPORT_FUNC(grub_file_close) (grub_file_t file);
 
 static inline grub_off_t
index bc725f9cadaabc1d4f669043810906c538394355..8ec8ad822da753ebfff6f751877d94dbea65d6d0 100644 (file)
@@ -192,7 +192,7 @@ 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;
+extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
 
 #ifdef NEED_ENABLE_EXECUTE_STACK
 void EXPORT_FUNC(__enable_execute_stack) (void *addr);
index 00f69f05db9f423038e10a47559f9fc76c63c348..f713acbcadae02f499cd81609761cfc64e409c6c 100644 (file)
@@ -164,13 +164,3 @@ grub_file_seek (grub_file_t file, grub_off_t offset)
   file->offset = offset;
   return old;
 }
-
-grub_ssize_t
-grub_file_pread (grub_file_t file, void *buf, grub_size_t len, grub_off_t offset)
-{
-  if (grub_file_seek (file, offset) == (grub_off_t)-1)
-  {
-    return -1;
-  }
-  return grub_file_read (file, buf, len);
-}