merging of gettext branch
Hello,
My gettext branch:
bzr.savannah.gnu.org/srv/bzr/grub/people/cpina/gettext/
Is currently synchronized with Robert's changes and working.
To test it I usually do:
-----
cp po/ca.mo ../img/boot/grub/locale
rm /tmp/grub-rescue-cdrom.iso
./grub-mkrescue --override-directory=pwd --output=/tmp/grub-rescue-cdrom.iso ../img/ qemu -cdrom /tmp/grub-rescue-cdrom.iso
-----
And the sentence "Use the %C and %C keys to select which entry is highlighted." appears in catalan, if the grub.cfg contains:
-----
set locale_dir=/boot/grub/locale
set lang=ca
insmod gettext
-----
(mmm... locale_dir could be hard coded)
Some suggestions before merging? Once merged I will gettize more string in the loader and other utilities. And fix whatever is needed that we have not spotted :-/
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Hi,
Quoted 2 lines · Carles Pina i Estany
My gettext branch:
bzr.savannah.gnu.org/srv/bzr/grub/people/cpina/gettext/
If the branch wants to be merged I suggest to use this ChangeLog:
--------
YYYY-MM-DD Carles Pina i Estany <[email protected]>
* 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
--------
Since the commits of the branch doesn't follow the rules correctly
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 7 lines · Carles Pina i Estany
Hello,
My gettext branch:
bzr.savannah.gnu.org/srv/bzr/grub/people/cpina/gettext/Is currently synchronized with Robert's changes and working.
Great. Could you please attach it as a patch? This makes it easier to review.
Quoted 1 line
(mmm...
locale_dircould be hard coded)
Better let the user specify it. $prefix points to the module load dir and may not always be what user expects (this happens e.g. with grub-mkrescue).
Quoted 2 lines
Once merged I will gettize more string
in the loader and other utilities.
Gettext support for utilities can be done already; you're welcome to add it to more of the stuff in util/, see:
http://lists.gnu.org/archive/html/grub-devel/2009-11/msg00273.html
For strings in GRUB itself, we need to be more selective. There are a few strings which we obviously want to translate, and some for which it isn't so clear. We can talk about this after the merge.
Signature · 5 lines
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."
Hello,
Quoted 11 lines · Robert Millan
Quoted 7 lines · Carles Pina i Estany
Hello,
My gettext branch:
bzr.savannah.gnu.org/srv/bzr/grub/people/cpina/gettext/Is currently synchronized with Robert's changes and working.
Great. Could you please attach it as a patch? This makes it easier to review.
find attached
Quoted 5 lines
Quoted 1 line
(mmm...
locale_dircould be hard coded)Better let the user specify it. $prefix points to the module load dir and may not always be what user expects (this happens e.g. with grub-mkrescue).
yes, I realised of this case ($prefix in grub-mkrescue). Actually before I was using $prefix/locale and I've changed it.
Quoted 6 lines
Quoted 2 lines
Once merged I will gettize more string
in the loader and other utilities.Gettext support for utilities can be done already; you're welcome to add it to more of the stuff in util/, see:
http://lists.gnu.org/archive/html/grub-devel/2009-11/msg00273.html
I will do soon, I just want to finish ASAP the other part and feel relieved :-)
Quoted 3 lines
For strings in GRUB itself, we need to be more selective. There are a few strings which we obviously want to translate, and some for which it isn't so clear. We can talk about this after the merge.
When it's merged I will gettize the common sense ones (menu ones) and we will think about the other ones.
Signature · 2 lines
Carles Pina i Estany http://pinux.info
=== modified file 'conf/common.rmk'
common.rmk +12 -1
@@ -163,6 +163,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 $@
@@ -179,7 +185,7 @@ 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 gettext.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c
@@ -610,6 +616,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
=== added directory 'gettext'
=== added file 'gettext/gettext.c'
gettext.c +286 -0
286 lines not on this page · raw message
=== added file 'include/grub/i18n_grub.h'
grub/i18n_grub.h +24 -0
@@ -0,0 +1,24 @@ +/* +* 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/>. +*/ + +#ifndef GRUB_I18N_GRUB_H +#define GRUB_I18N_GRUB_H 1 + +# define _ (str) grub_gettext(str) + +#endif /* GRUB_I18N_GRUB_H */
=== modified file 'include/grub/misc.h'
grub/misc.h +4 -1
@@ -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
@@ -191,6 +191,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
=== modified file 'kern/misc.c'
misc.c +9 -0
@@ -30,6 +30,8 @@return (grub_isspace (c) || c ==',' || c ==';' || c =='|' || c =='&' ); } +const char * (*grub_gettext) (const char *s) = grub_gettext_dummy; +void *grub_memmove (void *dest,const void *src,grub_size_t n) {
@@ -984,6 +986,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 )
=== modified file 'normal/menu_text.c'
menu_text.c +3 -2
@@ -25,6 +25,7 @@#include <grub/time.h> #include <grub/env.h> #include <grub/menu_viewer.h> +#include <grub/i18n_grub.h> /* Time to delay after displaying an error message about a default/fallback entry failing to boot. */
@@ -93,8 +94,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\
=== modified file 'po/POTFILES'
POTFILES +2 -0
@@ -10,3 +10,5 @@ util/mkisofs/rock.c util/mkisofs/tree.c util/mkisofs/write.c + +normal/menu_text.c
=== modified file 'po/ca.po'
ca.po +10 -1
@@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: GNU GRUB\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-11-19 00:16+0100\n" +"POT-Creation-Date: 2009-11-19 21:37+0000\n" "PO-Revision-Date: 2009-11-17 12:26+0100\n" "Last-Translator: Robert Millan <[email protected]>\n" "Language-Team: None <[email protected]>\n"
@@ -882,6 +882,15 @@ msgid "Path table size(bytes): %d\n" msgstr "" +#: normal/menu_text.c:97 +#, 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 a seleccionar l'entrada.\n" + #: util/grub.d/10_kfreebsd.in:40 msgid "%s, with kFreeBSD %s" msgstr ""
=== modified file 'util/grub.d/00_header.in'
grub.d/00_header.in +9 -0
@@ -22,6 +22,8 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ grub_prefix=`echo /boot/grub | sed ${transform}` +locale_dir=`echo /boot/grub/locale | sed ${transform}` +grub_lang=`echo $LANG | cut -d _ -f 1` . ${libdir}/grub/grub-mkconfig_lib
@@ -100,6 +102,13 @@ ;; esac +# Gettext variables and module +cat << EOF +set locale_dir=${locale_dir} +set lang=${grub_lang} +insmod gettext +EOF + if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then verbose=
YYYY-MM-DD Carles Pina i Estany <[email protected]>
* 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
Quoted 10 lines · Carles Pina i Estany
common.rmk +1
-1@@ -179,7 +185,7 @@ 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 gettext.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c
common.rmk line 622
Quoted 7 lines
common.rmk +4
-0@@ -610,6 +616,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)
I haven't switched the old declarations, but for new modules please use something like:
pkglib_MODULES += gettext.modgettext_mod_SOURCES = gettext/gettext.cgettext_mod_CFLAGS = $(COMMON_CFLAGS)gettext_mod_LDFLAGS = $(COMMON_LDFLAGS)
this way it is easier to move declarations around, etc.
gettext.c line 35
Quoted 1 line
gettext.c +1
-0+static grub_file_t grub_mofile_open (const char *name);
We usually skip declarations for static functions (when all its users are placed after its implementation, of course).
gettext.c line 47
Quoted 5 lines
gettext.c +5
-0+#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
These would look much prettier with some tabs ;-)
Review
Quoted 2 lines
(quoted diff) +2
-0+ grub_file_seek (fd_mo, offset); + grub_file_read (fd_mo, translation, length);
You do a lot of grub_file_seek + grub_file_read throurough the code. Maybe grub_file_pread() would be more appropiate? (for space saving)
gettext.c line 161
Quoted 7 lines
gettext.c +5
-0+grub_free (current_string); + min=current; + current = (max+min)/2 ; + ret =grub_malloc (grub_strlen (orig) +1 ); +grub_strcpy (ret,orig);
Missing spaces (between function name and parenthesis, around '=', etc).
I suggest you use indent(1), this will automatically adjust to our coding style.
gettext.c line 210
Quoted 10 lines
gettext.c +10
-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; +} +*/
Uhm I wonder if we could answer this question before the code is merged; what does everyone think about .mo.gz?
Quoted 1 line
+
locale_dir=grub_env_get("locale_dir");
This needs to be checked for NULL.
Quoted 1 line
+ //
mo_filee.g.:/boot/grub/locale/ca.mo
Please use C-style comments (/* */).
Quoted 1 line
+
mo_file=grub_malloc(grub_strlen(locale_dir) + sizeof ("/") +grub_strlen(lang) +sizeof(".mo"));
Note that sizeof ("/") equals 2 ('/' + '\0').
gettext.c line 236
Quoted 3 lines
gettext.c +3
-0+grub_dprintf ("gettext" ,"Will try to open file: %s " ,mo_file); + + fd_mo =grub_mofile_open (mo_file);
In this case I think error handling would be more useful than debug print (i.e. if file can't be opened, rise an error).
gettext.c line 271
Quoted 4 lines
gettext.c +4
-0+/* Testing: +grub_register_command ("_", grub_cmd_translate, GRUB_COMMAND_FLAG_BOTH, +"_", "internalization support trans", 0); +*/
We could define this interface unconditionally, but it'd be more consistent as `gettext' command (like the one in GNU gettext package).
grub/i18n_grub.h line 24
Quoted 10 lines
=== added file '
include/grub/i18n_grub.h'grub/i18n_grub.h +6
-0+#ifndef GRUB_I18N_GRUB_H +#define GRUB_I18N_GRUB_H 1 + +# define _ (str) grub_gettext(str) + +#endif /* GRUB_I18N_GRUB_H */
You can use <grub/i18n.h> for this (in fact it already defines _ to a noop stub for non-util and would just need to be modified).
grub/i18n_grub.h
Quoted 2 lines
grub/i18n_grub.h +2
-0+const char *EXPORT_FUNC (grub_gettext_dummy ) (const char *s); +extern const char *(*EXPORT_VAR (grub_gettext )) (const char *s);// = grub_gettext_dummy;
This could be in i18n.h too (except the comment ;-)).
Btw, is it necessary to export grub_gettext_dummy symbol? If we avoid it it's a few less bytes in kernel :-)
grub/i18n_grub.h
Quoted 6 lines
grub/i18n_grub.h +6
-0+# Gettext variables and module +cat << EOF +set locale_dir=${locale_dir} +set lang=${grub_lang} +insmod gettext +EOF
We could avoid loading the module at all for non-utf8 capable setups (when this happens, grub-mkconfig exports LANG=C, so this can be easily detected).
Signature · 5 lines
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."
Quoted 12 lines · Robert Millan
gettext.c line 210
Quoted 11 lines
gettext.c +10
-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; +} +*/
Quoted 4 lines
Uhm I wonder if we could answer this question before the code is merged; what does everyone think about .mo.gz?
If it doesn't hurt to support them, then we should. BTW it's
file = grub_gzfile_open (argv[0], 1);
actually. But what with seeking in .gz ? Is it efficient?
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 4 lines · Vladimir 'φ-coder/phcoder' Serbinenko
If it doesn't hurt to support them, then we should. BTW it's
file =grub_gzfile_open(argv[0], 1);
actually. But what with seeking in .gz ? Is it efficient?
Let's enable it in the code, but not make the user scripts use it untill someone has time to verify efficiency.
Signature · 5 lines
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."
Hello,
Briefly: applied the suggested changes, and new patch attached. Don't hesitate to say anything back (I know that you don't :-) ). Later I will spend some time with it again.
Cheers,
Quoted 22 lines · Robert Millan
Quoted 10 lines · Carles Pina i Estany
(quoted diff) +1
-1@@ -179,7 +185,7 @@ 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 gettext.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.cReview line 622
Quoted 7 lines
(quoted diff) +4
-0@@ -610,6 +616,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)I haven't switched the old declarations, but for new modules please use something like:
Quoted 4 lines
pkglib_MODULES+= gettext.modgettext_mod_SOURCES=gettext/gettext.cgettext_mod_CFLAGS= $(COMMON_CFLAGS)gettext_mod_LDFLAGS= $(COMMON_LDFLAGS)
Done!
Quoted 6 lines
this way it is easier to move declarations around, etc.
Review line 623
Quoted 1 line
(quoted diff) +1
-0+static grub_file_t grub_mofile_open (const char *name);We usually skip declarations for static functions (when all its users are placed after its implementation, of course).
Done!
Quoted 7 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+#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 16These would look much prettier with some tabs ;-)
Done!
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ grub_file_seek (fd_mo, offset); + grub_file_read (fd_mo, translation, length);You do a lot of
grub_file_seek+grub_file_readthrourough the code. Maybegrub_file_pread()would be more appropiate? (for space saving)
Done!
Quoted 8 lines
Review
Quoted 7 lines
(quoted diff) +5
-0+ grub_free(current_string); + min=current; + current = (max+min)/2; + ret = grub_malloc(grub_strlen(orig) + 1); + grub_strcpy(ret,orig);
Quoted 4 lines
Missing spaces (between function name and parenthesis, around '=', etc).
I suggest you use indent(1), this will automatically adjust to our coding style.
used indent, Done!
Quoted 11 lines
Review
Quoted 10 lines
(quoted diff) +10
-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; + } + */
Quoted 6 lines
Uhm I wonder if we could answer this question before the code is merged; what does everyone think about .mo.gz?
Quoted 1 line
+
locale_dir=grub_env_get("locale_dir");This needs to be checked for NULL.
Why? If it's NULL it will try to open a .mo file that doesn't exist (probably) and will print the path. So the user will notice that somethiing is missing.
I've added a check, grub_printf saying that the variable is not setted up and a return but not sure if this should happen.
Quoted 3 lines
Quoted 1 line
+ //
mo_filee.g.:/boot/grub/locale/ca.moPlease use C-style comments (/* */).
Done!
Quoted 3 lines
Quoted 1 line
+
mo_file=grub_malloc(grub_strlen(locale_dir) + sizeof ("/") +grub_strlen(lang) +sizeof(".mo"));Note that sizeof ("/") equals 2 ('/' + '\0').
changed "/" by '/', you are right. Done!
Quoted 6 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ grub_dprintf("gettext", "Will try to open file: %s " ,mo_file); + + fd_mo = grub_mofile_open(mo_file);In this case I think error handling would be more useful than debug print (i.e. if file can't be opened, rise an error).
I don't remember the details, but if grub_mofile_open cannot open it it raise an error:
fd_mo = grub_file_open (filename);
if (!fd_mo)
{
grub_error (GRUB_ERR_FILE_READ_ERROR, "Cannot read %s", filename);
return 0;
}and the caller will not do anything if it returns 0.
Quoted 7 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+ /* Testing: + grub_register_command ("_", grub_cmd_translate, GRUB_COMMAND_FLAG_BOTH, + "_", "internalization support trans", 0); + */We could define this interface unconditionally, but it'd be more consistent as `gettext' command (like the one in GNU gettext package).
We didn't include anything to not populate the standard shell with superflous commands. By the moment I've removed above lines, we can add it later.
Quoted 14 lines
grub/i18n_grub.h
Quoted 11 lines
=== added file '
include/grub/i18n_grub.h'grub/i18n_grub.h +6
-0+#ifndef GRUB_I18N_GRUB_H +#define GRUB_I18N_GRUB_H 1 + +# define _ (str) grub_gettext(str) + +#endif /* GRUB_I18N_GRUB_H */ You can use <
grub/i18n.h> for this (in fact it already defines _ to a noop stub for non-util and would just need to be modified).
Changed, I didn't read it properly some days ago. So... Done!
Quoted 7 lines
grub/i18n_grub.h
Quoted 2 lines
grub/i18n_grub.h +2
-0+const char *EXPORT_FUNC (grub_gettext_dummy ) (const char *s); +extern const char *(*EXPORT_VAR (grub_gettext )) (const char *s);// = grub_gettext_dummy; This could be in
i18n.htoo (except the comment ;-)).Btw, is it necessary to export
grub_gettext_dummysymbol? If we avoid it it's a few less bytes in kernel :-)
if it's not exported it doesn't compile:kern/misc.c:33: error: 'grub_gettext_dummy' undeclared here (not in a function)
Quoted 9 lines
grub/i18n_grub.h
Quoted 6 lines
grub/i18n_grub.h +6
-0+# Gettext variables and module +cat << EOF +set locale_dir=${locale_dir} +set lang=${grub_lang} +insmod gettext +EOFWe could avoid loading the module at all for non-utf8 capable setups (when this happens, grub-mkconfig exports LANG=C, so this can be easily detected).
Done!
Signature · 2 lines
Carles Pina i Estany http://pinux.info
=== added file 'ChangeLog.gettext'
ChangeLog.gettext +18 -0
@@ -0,0 +1,18 @@ +YYYY-MM-DD Carles Pina i Estany <[email protected]> + + * 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.
=== modified file 'conf/common.rmk'
common.rmk +12 -0
@@ -163,6 +163,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 $@
@@ -610,6 +616,12 @@ bufio_mod_CFLAGS = $(COMMON_CFLAGS) bufio_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For gettext.mod. +pkglib_MODULES += gettext.mod +gettext_mod_SOURCES = gettext/gettext.c +gettext_mod_CFLAGS = $(COMMON_CFLAGS) +gettext_mod_LDFLAGS = $(COMMON_LDFLAGS) + # Misc. pkglib_MODULES += xnu_uuid.mod
=== added directory 'gettext'
=== added file 'gettext/gettext.c'
gettext.c +296 -0
296 lines not on this page · raw message
=== modified file 'include/grub/i18n.h'
grub/i18n.h +1 -1
@@ -24,7 +24,7 @@# include <libintl.h> # define _ (str) gettext(str)#else -# define _ (str) str +# define _ (str) grub_gettext(str)#endif #endif /* GRUB_I18N_H */
=== modified file 'include/grub/misc.h'
grub/misc.h +4 -1
@@ -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
@@ -191,6 +191,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); +#ifdef NEED_ENABLE_EXECUTE_STACK void EXPORT_FUNC (__enable_execute_stack ) (void *addr);#endif
=== modified file 'kern/misc.c'
misc.c +9 -0
@@ -30,6 +30,8 @@return (grub_isspace (c) || c ==',' || c ==';' || c =='|' || c =='&' ); } +const char * (*grub_gettext) (const char *s) = grub_gettext_dummy; +void *grub_memmove (void *dest,const void *src,grub_size_t n) {
@@ -984,6 +986,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 )
=== modified file 'normal/menu_text.c'
menu_text.c +4 -3
@@ -25,6 +25,7 @@#include <grub/time.h> #include <grub/env.h> #include <grub/menu_viewer.h> +#include <grub/i18n.h> /* Time to delay after displaying an error message about a default/fallback entry failing to boot. */
@@ -93,8 +94,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\
@@ -266,7 +267,7 @@ {/* NOTE: Do not remove the trailing space characters. They are required to clear the line. */ -char *msg =" The highlighted entry will be booted automatically in %ds. " ; +const char *msg =_ (" The highlighted entry will be booted automatically in %ds. " );char *msg_end =grub_strchr (msg,'%' );grub_gotoxy (second_stage ? (msg_end - msg) :0 ,GRUB_TERM_HEIGHT -3 );
=== modified file 'po/POTFILES'
POTFILES +2 -0
@@ -10,3 +10,5 @@ util/mkisofs/rock.c util/mkisofs/tree.c util/mkisofs/write.c + +normal/menu_text.c
=== modified file 'po/ca.po'
ca.po +15 -1
@@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: GNU GRUB\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-11-19 00:16+0100\n" +"POT-Creation-Date: 2009-11-22 11:45+0000\n" "PO-Revision-Date: 2009-11-17 12:26+0100\n" "Last-Translator: Robert Millan <[email protected]>\n" "Language-Team: None <[email protected]>\n"
@@ -882,6 +882,20 @@ msgid "Path table size(bytes): %d\n" msgstr "" +#: normal/menu_text.c:97 +#, 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 a seleccionar l'entrada.\n" + +#: normal/menu_text.c:270 +#, c-format +msgid " The highlighted entry will be booted automatically in %ds. " +msgstr " L entrada seleccionada sera arrancada automaticament en %ds. " + #: util/grub.d/10_kfreebsd.in:40 msgid "%s, with kFreeBSD %s" msgstr ""
=== modified file 'util/grub.d/00_header.in'
grub.d/00_header.in +11 -0
@@ -22,6 +22,8 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ grub_prefix=`echo /boot/grub | sed ${transform}` +locale_dir=`echo /boot/grub/locale | sed ${transform}` +grub_lang=`echo $LANG | cut -d _ -f 1` . ${libdir}/grub/grub-mkconfig_lib
@@ -100,6 +102,15 @@ ;; esac +# Gettext variables and module +if [ "x${LANG}" != "xC" ] ; then + cat << EOF +set locale_dir=${locale_dir} +set lang=${grub_lang} +insmod gettext +EOF +fi + if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then verbose=
Hi,
Quoted 8 lines · Robert Millan
Quoted 4 lines · Vladimir '??-coder/phcoder' Serbinenko
If it doesn't hurt to support them, then we should. BTW it's
file =grub_gzfile_open(argv[0], 1);
actually. But what with seeking in .gz ? Is it efficient?Let's enable it in the code, but not make the user scripts use it untill someone has time to verify efficiency.
this is included in gettext08.patch (tries to open without .gz and if it fails with .gz)
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Hi,
Quoted 6 lines · Carles Pina i Estany
Hello,
Briefly: applied the suggested changes, and new patch attached. Don't hesitate to say anything back (I know that you don't :-) ). Later I will spend some time with it again.
I send attached gettext09.patch. It's the same than before but not using a temporary variable that I used for some debugging.
Signature · 2 lines
Carles Pina i Estany http://pinux.info
=== added file 'ChangeLog.gettext'
ChangeLog.gettext +18 -0
@@ -0,0 +1,18 @@ +YYYY-MM-DD Carles Pina i Estany <[email protected]> + + * 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.
=== modified file 'conf/common.rmk'
common.rmk +12 -0
@@ -163,6 +163,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 $@
@@ -610,6 +616,12 @@ bufio_mod_CFLAGS = $(COMMON_CFLAGS) bufio_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For gettext.mod. +pkglib_MODULES += gettext.mod +gettext_mod_SOURCES = gettext/gettext.c +gettext_mod_CFLAGS = $(COMMON_CFLAGS) +gettext_mod_LDFLAGS = $(COMMON_LDFLAGS) + # Misc. pkglib_MODULES += xnu_uuid.mod
=== added directory 'gettext'
=== added file 'gettext/gettext.c'
gettext.c +293 -0
293 lines not on this page · raw message
=== modified file 'include/grub/i18n.h'
grub/i18n.h +1 -1
@@ -24,7 +24,7 @@# include <libintl.h> # define _ (str) gettext(str)#else -# define _ (str) str +# define _ (str) grub_gettext(str)#endif #endif /* GRUB_I18N_H */
=== modified file 'include/grub/misc.h'
grub/misc.h +4 -1
@@ -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
@@ -191,6 +191,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); +#ifdef NEED_ENABLE_EXECUTE_STACK void EXPORT_FUNC (__enable_execute_stack ) (void *addr);#endif
=== modified file 'kern/misc.c'
misc.c +9 -0
@@ -30,6 +30,8 @@return (grub_isspace (c) || c ==',' || c ==';' || c =='|' || c =='&' ); } +const char * (*grub_gettext) (const char *s) = grub_gettext_dummy; +void *grub_memmove (void *dest,const void *src,grub_size_t n) {
@@ -984,6 +986,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 )
=== modified file 'normal/menu_text.c'
menu_text.c +4 -3
@@ -25,6 +25,7 @@#include <grub/time.h> #include <grub/env.h> #include <grub/menu_viewer.h> +#include <grub/i18n.h> /* Time to delay after displaying an error message about a default/fallback entry failing to boot. */
@@ -93,8 +94,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\
@@ -266,7 +267,7 @@ {/* NOTE: Do not remove the trailing space characters. They are required to clear the line. */ -char *msg =" The highlighted entry will be booted automatically in %ds. " ; +const char *msg =_ (" The highlighted entry will be booted automatically in %ds. " );char *msg_end =grub_strchr (msg,'%' );grub_gotoxy (second_stage ? (msg_end - msg) :0 ,GRUB_TERM_HEIGHT -3 );
=== modified file 'po/POTFILES'
POTFILES +2 -0
@@ -10,3 +10,5 @@ util/mkisofs/rock.c util/mkisofs/tree.c util/mkisofs/write.c + +normal/menu_text.c
=== modified file 'po/ca.po'
ca.po +16 -2
@@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: GNU GRUB\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-11-19 00:16+0100\n" +"POT-Creation-Date: 2009-11-22 11:45+0000\n" "PO-Revision-Date: 2009-11-17 12:26+0100\n" "Last-Translator: Robert Millan <[email protected]>\n" "Language-Team: None <[email protected]>\n"
@@ -63,7 +63,7 @@ #: util/i386/pc/grub-mkimage.c:321 util/i386/pc/grub-setup.c:587 #, c-format msgid "Try ``%s --help'' for more information.\n" -msgstr "Proveu «%s --help» per a obtenir més informació.\n" +msgstr "Proveu «%s --help» per a obtenir més informació.\n" #: util/i386/pc/grub-mkimage.c:323 #, c-format
@@ -882,6 +882,20 @@ msgid "Path table size(bytes): %d\n" msgstr "" +#: normal/menu_text.c:97 +#, 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 a seleccionar l'entrada.\n" + +#: normal/menu_text.c:270 +#, c-format +msgid " The highlighted entry will be booted automatically in %ds. " +msgstr " L' entrada seleccionada sera arrancada automaticament en %ds. " + #: util/grub.d/10_kfreebsd.in:40 msgid "%s, with kFreeBSD %s" msgstr ""
=== modified file 'util/grub.d/00_header.in'
grub.d/00_header.in +11 -0
@@ -22,6 +22,8 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ grub_prefix=`echo /boot/grub | sed ${transform}` +locale_dir=`echo /boot/grub/locale | sed ${transform}` +grub_lang=`echo $LANG | cut -d _ -f 1` . ${libdir}/grub/grub-mkconfig_lib
@@ -100,6 +102,15 @@ ;; esac +# Gettext variables and module +if [ "x${LANG}" != "xC" ] ; then + cat << EOF +set locale_dir=${locale_dir} +set lang=${grub_lang} +insmod gettext +EOF +fi + if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then verbose=
Hi,
Quoted 5 lines · Carles Pina i Estany
Hi,
Quoted 1 line · Carles Pina i Estany
Quoted 8 lines
Quoted 5 lines
Hello,
Briefly: applied the suggested changes, and new patch attached. Don't hesitate to say anything back (I know that you don't :-) ). Later I will spend some time with it again.
I send attached gettext09.patch. It's the same than before but not using a temporary variable that I used for some debugging.
same with gettext command registered so test the gettext module. The only syntax is gettext "string to be translated". So, right now, without domains, -h, -s, etc. like the standard gettext command. I don't think that it's needed but I can implement if we decide that it's needed.
Signature · 2 lines
Carles Pina i Estany http://pinux.info
=== added file 'ChangeLog.gettext'
ChangeLog.gettext +18 -0
@@ -0,0 +1,18 @@ +YYYY-MM-DD Carles Pina i Estany <[email protected]> + + * 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.
=== modified file 'conf/common.rmk'
common.rmk +12 -0
@@ -163,6 +163,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 $@
@@ -610,6 +616,12 @@ bufio_mod_CFLAGS = $(COMMON_CFLAGS) bufio_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For gettext.mod. +pkglib_MODULES += gettext.mod +gettext_mod_SOURCES = gettext/gettext.c +gettext_mod_CFLAGS = $(COMMON_CFLAGS) +gettext_mod_LDFLAGS = $(COMMON_LDFLAGS) + # Misc. pkglib_MODULES += xnu_uuid.mod
=== added directory 'gettext'
=== added file 'gettext/gettext.c'
gettext.c +310 -0
310 lines not on this page · raw message
=== modified file 'include/grub/i18n.h'
grub/i18n.h +1 -1
@@ -24,7 +24,7 @@# include <libintl.h> # define _ (str) gettext(str)#else -# define _ (str) str +# define _ (str) grub_gettext(str)#endif #endif /* GRUB_I18N_H */
=== modified file 'include/grub/misc.h'
grub/misc.h +4 -1
@@ -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
@@ -191,6 +191,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); +#ifdef NEED_ENABLE_EXECUTE_STACK void EXPORT_FUNC (__enable_execute_stack ) (void *addr);#endif
=== modified file 'kern/misc.c'
misc.c +9 -0
@@ -30,6 +30,8 @@return (grub_isspace (c) || c ==',' || c ==';' || c =='|' || c =='&' ); } +const char * (*grub_gettext) (const char *s) = grub_gettext_dummy; +void *grub_memmove (void *dest,const void *src,grub_size_t n) {
@@ -984,6 +986,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 )
=== modified file 'normal/menu_text.c'
menu_text.c +4 -3
@@ -25,6 +25,7 @@#include <grub/time.h> #include <grub/env.h> #include <grub/menu_viewer.h> +#include <grub/i18n.h> /* Time to delay after displaying an error message about a default/fallback entry failing to boot. */
@@ -93,8 +94,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\
@@ -266,7 +267,7 @@ {/* NOTE: Do not remove the trailing space characters. They are required to clear the line. */ -char *msg =" The highlighted entry will be booted automatically in %ds. " ; +const char *msg =_ (" The highlighted entry will be booted automatically in %ds. " );char *msg_end =grub_strchr (msg,'%' );grub_gotoxy (second_stage ? (msg_end - msg) :0 ,GRUB_TERM_HEIGHT -3 );
=== modified file 'po/POTFILES'
POTFILES +2 -0
@@ -10,3 +10,5 @@ util/mkisofs/rock.c util/mkisofs/tree.c util/mkisofs/write.c + +normal/menu_text.c
=== modified file 'po/ca.po'
ca.po +15 -1
@@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: GNU GRUB\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-11-19 00:16+0100\n" +"POT-Creation-Date: 2009-11-22 11:45+0000\n" "PO-Revision-Date: 2009-11-17 12:26+0100\n" "Last-Translator: Robert Millan <[email protected]>\n" "Language-Team: None <[email protected]>\n"
@@ -882,6 +882,20 @@ msgid "Path table size(bytes): %d\n" msgstr "" +#: normal/menu_text.c:97 +#, 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 a seleccionar l'entrada ressaltada.\n" + +#: normal/menu_text.c:270 +#, c-format +msgid " The highlighted entry will be booted automatically in %ds. " +msgstr " L' entrada seleccionada arrencarà automà ticament en %ds. " + #: util/grub.d/10_kfreebsd.in:40 msgid "%s, with kFreeBSD %s" msgstr ""
=== modified file 'util/grub.d/00_header.in'
grub.d/00_header.in +11 -0
@@ -22,6 +22,8 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ grub_prefix=`echo /boot/grub | sed ${transform}` +locale_dir=`echo /boot/grub/locale | sed ${transform}` +grub_lang=`echo $LANG | cut -d _ -f 1` . ${libdir}/grub/grub-mkconfig_lib
@@ -100,6 +102,15 @@ ;; esac +# Gettext variables and module +if [ "x${LANG}" != "xC" ] ; then + cat << EOF +set locale_dir=${locale_dir} +set lang=${grub_lang} +insmod gettext +EOF +fi + if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then verbose=
menu_text.c line 271
Quoted 5 lines · Carles Pina i Estany
/* NOTE: Do not remove the trailing space characters.
They are required to clear the line. */menu_text.c +1
-1-char *msg =" The highlighted entry will be booted automatically in %ds. " ; +const char *msg =_ (" The highlighted entry will be booted automatically in %ds. " );char *msg_end =grub_strchr (msg,'%' );
This string isn't suitable for translation in its current state. Someone should split the "trailing space hack" from the actual translatable string first.
(I suggest that you just exclude this from your initial merge, it can be fixed later when we want to enable it).
gettext.c line 226
Quoted 5 lines
gettext.c +5
-0+if (locale_dir ==NULL ) + { +grub_printf ("locale_dir variable is not setted up." ); +return ; + }
s/setted/set/g
The rest is fine. Once this is fixed it can be merged in trunk. Nice work, Carles.
Signature · 5 lines
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."
Hello,
Quoted 10 lines · Robert Millan
menu_text.c line 271
Quoted 5 lines · Carles Pina i Estany
/* NOTE: Do not remove the trailing space characters.
They are required to clear the line. */menu_text.c +1
-1-char *msg =" The highlighted entry will be booted automatically in %ds. " ; +const char *msg =_ (" The highlighted entry will be booted automatically in %ds. " );char *msg_end =grub_strchr (msg,'%' );This string isn't suitable for translation in its current state. Someone should split the "trailing space hack" from the actual translatable string first.
Ok, I will do it soon.
Quoted 2 lines
(I suggest that you just exclude this from your initial merge, it can be fixed later when we want to enable it).
yeap!
Quoted 10 lines
gettext.c line 226
Quoted 5 lines
gettext.c +5
-0+if (locale_dir ==NULL ) + { +grub_printf ("locale_dir variable is not setted up." ); +return ; + }s/setted/set/g
The rest is fine. Once this is fixed it can be merged in trunk. Nice work, Carles.
merged. Thanks!
Signature · 2 lines
Carles Pina i Estany http://pinux.info