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.
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
#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;
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';
}
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);
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);
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
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);
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);
-}