gettext support
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?
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Makefile.in +6 -0
@@ -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
common.rmk +12 -1
@@ -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
misc.c +9 -0
@@ -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 )
ca.po +25 -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"
TODO +5 -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
grub/misc.h +6 -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
@@ -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
gettext.c +300 -0
300 lines not on this page · raw message
menu_text.c +2 -2
@@ -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\
grub.d/10_linux.in +4 -4
@@ -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
grub.d/00_header.in +16 -0
@@ -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
grub-gettext_lib.in +23 -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
grub-mkconfig_lib.in +11 -0
@@ -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 +}
Hello. Welcome back and your work is appreciated. I will look at the patch later (In couple minutes I go to sleep)
Quoted 48 lines · Carles Pina i Estany
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 useslocale_prefixand lang variables to locate the .mo fileb) 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 loadedgettext 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 instructionsIn 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/sharedirectory, 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
)
Quoted 5 lines
Comments for next steps to commit the patch are welcomed. (maybe I need to setup the "path" to access to
/usr/share/localein 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)
Quoted 15 lines
Thanks,
PS: any Grub developer living/working in London?
--
Carles Pina i Estany
http://pinux.info_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
Hello
Quoted 1 line
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
Quoted 19 lines
(maybe I need to setup the "path" to access to
/usr/share/localein 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
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
Hi,
Quoted 7 lines · Vladimir 'phcoder' Serbinenko
Hello
Quoted 1 line
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!
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 7 lines · Carles Pina i Estany
Hi,
Quoted 3 lines · Vladimir 'phcoder' Serbinenko
Hello
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
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.htmlRight, 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!
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 17 lines · Robert Millan
Quoted 7 lines · Carles Pina i Estany
Hi,
Quoted 3 lines · Vladimir 'phcoder' Serbinenko
Hello
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
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.htmlRight, 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...)
Quoted 5 lines
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.
Quoted 18 lines
P.S: Please keep David on CCThanks!
--
Robert MillanThe 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
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
Hi,
Quoted 1 line · Vladimir 'phcoder' Serbinenko
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?
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 11 lines · Carles Pina i Estany
Hi,
Quoted 1 line · Vladimir 'phcoder' Serbinenko
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:
Quoted 7 lines
-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
Quoted 7 lines
-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
Quoted 4 lines
(first line generates the new po template from the *.c files and otehr one from the grub.d scripts)
Quoted 9 lines
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
Quoted 11 lines
--
Carles Pina i Estany
http://pinux.info_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Hi,
Quoted 16 lines · Vladimir 'phcoder' Serbinenko
Quoted 14 lines · Carles Pina i Estany
Hi,
Quoted 1 line · Vladimir 'phcoder' Serbinenko
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?)
Quoted 6 lines
Quoted 4 lines
-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)
Quoted 1 line
for-carles). There is a possibility with minimal modification to copy
thanks :-)
Quoted 6 lines
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/platformis inappropriate. But you can already get the idea Would it be ok if it will go to/usr/local/share/gruband $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)
Quoted 6 lines
Quoted 5 lines
-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.potThis will need to be adjusted to use DISTLIST
I leave it to you since I'm not familiar with DISTLIST, etc.
Quoted 9 lines
Quoted 9 lines
(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).
Quoted 4 lines
Quoted 3 lines
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.
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 28 lines · Carles Pina i Estany
Hi,
Quoted 17 lines · Vladimir 'phcoder' Serbinenko
Quoted 14 lines · On Thu, Jun 18, 2009 at 11:07 PM, Carles Pina i Estany <[email protected] wrote:
Hi,
Quoted 1 line · Vladimir 'phcoder' Serbinenko
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?)
Quoted 6 lines
Quoted 4 lines
-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
Quoted 2 lines
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
Quoted 24 lines
Quoted 3 lines
for-carles). There is a possibility with minimal modification to copy
thanks :-)
Quoted 1 line
languages to both ls /usr/local/lib/grub/<platform>/ and $prefix like
it's
Quoted 3 lines
the case with modules. It still needs work because I haven't updated non i386-pc scripts yet and because putting to
lib/grub/platformis inappropriate. But you can already get the idea Would it be ok if it willgo
Quoted 2 lines
to
/usr/local/share/gruband $prefix/locale ? Can you make gettext in utilities to use/usr/local/share/grub/$LANG.moAs 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/grubexists and failback to/usr/share/locale/grub, etc.
(I can do something like this during the weekend)Quoted 3 lines
Quoted 3 lines
-Make uptrans should execute:
uptrans:xgettext -k_ -LC -o - `find "$(srcdir)/" -name '*.c'` -o
Quoted 7 lines
po/grub.pot
Quoted 3 lines
Quoted 2 lines
xgettext -k_ -Lshell -o - $(GRUBD)/* -j -o po/grub.potThis 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
Quoted 11 lines
Quoted 8 lines
Quoted 8 lines
(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
Quoted 2 lines
Quoted 2 lines
is a generic script that comes with gettext-base package).
Quoted 9 lines
Quoted 4 lines
Quoted 3 lines
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
Quoted 11 lines
--
Carles Pina i Estany
http://pinux.info_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Makefile.in +2 -0
@@ -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.
conf/common.rmk +7 -0
@@ -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
configure.ac +172 -22
247 lines not on this page · raw message
disk/scsi.c +58 -57
123 lines not on this page · raw message
genmk.rb +3 -1
@@ -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 [email protected] | sed 's/@pkglib_DATA@/$(pkglib_DATA)/g;' > $@ + -rm -f [email protected] chmod +x $@ "
util/i386/pc/grub-install.in +6 -3
@@ -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
Quoted 1 line · Vladimir 'phcoder' Serbinenko
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).
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."
Hi,
Quoted 17 lines · Robert Millan
Quoted 7 lines · Carles Pina i Estany
Hi,
Quoted 3 lines · Vladimir 'phcoder' Serbinenko
Hello
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
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.htmlRight, 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...)
Quoted 5 lines
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.
Quoted 1 line
P.S: Please keep David on CC
done :)
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Hello,
Quoted 7 lines · Vladimir 'phcoder' Serbinenko
Hello
Quoted 1 line
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)
Quoted 4 lines
Quoted 1 line
-Copy ca.mo to
/usr/share/locale/ca/LC_MESSAGES/grub.moLanguages 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
Quoted 8 lines
Quoted 2 lines
-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)
Quoted 10 lines
gettext.c (revision 0)
Quoted 8 lines
Index:
gettext/gettext.c
===================================================================gettext.c (revision 0) +4
-0+static int +grub_gettext_get_info (int offset) +{ + int buf;Use
grub_uint32_there. Also be aware of endianness. It should be
Done!
Quoted 2 lines
Quoted 2 lines
grub_gettext_translation_numberis 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...
Quoted 3 lines
Quoted 1 line
+ position=offsettranslation+i*8;
Please respect GCS. This should be position = offsettranslation + i * 8;
Done!
Quoted 4 lines
gettext.c (revision 0)
Quoted 3 lines
gettext.c (revision 0) +3
-0+ 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.
Quoted 2 lines
Quoted 1 line
+ if (magic !=
0x950412de)A define instead of hardcoded number is suggested
Done!
Quoted 3 lines
Quoted 1 line
+
locale_prefix=grub_env_get("locale_prefix");You need to treat the case when no
locale_prefixis defined. I suggest to put a default $prefix/locale
Done!
Quoted 9 lines
Quoted 4 lines
+
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 allLC_MESSAGEis 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 :-)
Signature · 2 lines
Carles Pina i Estany http://pinux.info
common.rmk +12 -1
@@ -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
misc.c +9 -0
@@ -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 )
ca.po +25 -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"
TODO +5 -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
grub/misc.h +6 -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
@@ -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
gettext.c +285 -0
285 lines not on this page · raw message
menu_text.c +2 -2
@@ -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\
grub.d/10_linux.in +4 -4
@@ -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
grub.d/00_header.in +16 -0
@@ -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
grub-gettext_lib.in +23 -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
grub-mkconfig_lib.in +11 -0
@@ -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 +}
Quoted 8 lines · Carles Pina i Estany
Quoted 4 lines
Quoted 1 line
-Copy ca.mo to
/usr/share/locale/ca/LC_MESSAGES/grub.moLanguages 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?
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 10 lines · Robert Millan
Quoted 8 lines · Carles Pina i Estany
Quoted 4 lines
Quoted 1 line
-Copy ca.mo to
/usr/share/locale/ca/LC_MESSAGES/grub.moLanguages 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
Quoted 6 lines
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
Quoted 16 lines
What does everyone else think about this?
--
Robert MillanThe 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
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
Quoted 18 lines · Vladimir 'phcoder' Serbinenko
Quoted 10 lines · Robert Millan
Quoted 8 lines · Carles Pina i Estany
Quoted 4 lines
Quoted 1 line
-Copy ca.mo to
/usr/share/locale/ca/LC_MESSAGES/grub.moLanguages 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/grubQuoted 6 lines
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?
Quoted 5 lines
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.morather 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.
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 19 lines · Robert Millan
Quoted 18 lines · Vladimir 'phcoder' Serbinenko
Quoted 16 lines · Robert Millan
Quoted 8 lines · Carles Pina i Estany
Quoted 4 lines
Quoted 1 line
-Copy ca.mo to
/usr/share/locale/ca/LC_MESSAGES/grub.moLanguages 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/grubUhm 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?
Quoted 8 lines
Quoted 5 lines
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.morather than/usr/share/locale/$LANG/LC_MESSAGES/grub.mo? It would make grub-install easierNo, 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 | |-- [email protected] | `-- 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.
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 10 lines · Carles Pina i Estany
Quoted 8 lines
Quoted 5 lines
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.morather than/usr/share/locale/$LANG/LC_MESSAGES/grub.mo? It would make grub-install easierNo, 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 :-)
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 7 lines · Robert Millan
Quoted 6 lines · Carles Pina i Estany
Quoted 6 lines
Quoted 5 lines
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.morather than/usr/share/locale/$LANG/LC_MESSAGES/grub.mo? It would make grub-install easier
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
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.
Signature · 2 lines
Regards, Pavel Roskin
Hola,
Quoted 11 lines · Pavel Roskin
Quoted 10 lines · Robert Millan
Quoted 9 lines · Carles Pina i Estany
Quoted 8 lines
Quoted 5 lines
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.morather than/usr/share/locale/$LANG/LC_MESSAGES/grub.mo? It would make grub-install easierNo, for system locales we need to use standard locations, or the userland gettext won't find them.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
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.
Quoted 2 lines
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.
Quoted 4 lines
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.
Quoted 1 line
As for the tools localization, we should follow the standards.
I think that this is the only thing that everybody agred from the beginning :-)
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 9 lines · Carles Pina i Estany
Quoted 3 lines
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.
Quoted 6 lines
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:
Quoted 7 lines
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.
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."
Hi,
Quoted 2 lines · Robert Millan
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.
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 5 lines · Carles Pina i Estany
Hi,
On Jun/21/2009, Robert Millan wrote:
Quoted 8 lines
Quoted 1 line
Sounds like an interesting option. It's a pity you already spent the
effort
Quoted 1 line
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.
Quoted 11 lines
--
Carles Pina i Estany
http://pinux.info_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Hi,
Quoted 15 lines · Vladimir 'phcoder' Serbinenko
Quoted 5 lines · Carles Pina i Estany
Hi,
On Jun/21/2009, Robert Millan wrote:
Quoted 8 lines
Quoted 1 line
Sounds like an interesting option. It's a pity you already spent the
effort
Quoted 1 line
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.
Quoted 5 lines
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,
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 10 lines · Carles Pina i Estany
Quoted 6 lines · Vladimir 'phcoder' Serbinenko
On Sun, Jun 21, 2009 at 11:28 PM, Carles Pina i Estany <[email protected]>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
Quoted 8 lines
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.
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 17 lines · Robert Millan
Quoted 16 lines · Carles Pina i Estany
Quoted 6 lines · Vladimir 'phcoder' Serbinenko
On Sun, Jun 21, 2009 at 11:28 PM, Carles Pina i Estany <[email protected]>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...)
Quoted 4 lines
Quoted 2 lines
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,
Signature · 1 line
Colin Watson [[email protected]]
Quoted 6 lines · Robert Millan
Quoted 4 lines
+" 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
Signature · 3 lines
Jordi Mallach Pérez -- Debian developer http://www.debian.org/ [email protected] [email protected] http://www.sindominio.net/ GnuPG public key information available at http://oskuro.net/
Quoted 6 lines · Jordi Mallach
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."
Signature · 1 line
-- Lazy, Oblivious, Recurrent Disaster -- Habbit
Quoted 5 lines · Javier Martín
Quoted 3 lines
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.
Quoted 3 lines
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/
Quoted 2 lines
"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
Signature · 3 lines
Jordi Mallach Pérez -- Debian developer http://www.debian.org/ [email protected] [email protected] http://www.sindominio.net/ GnuPG public key information available at http://oskuro.net/
Quoted 7 lines · Jordi Mallach
Quoted 5 lines · Javier Martín
Quoted 3 lines
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.
Quoted 6 lines
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.
Quoted 4 lines
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
Signature · 4 lines
-- Lazy, Oblivious, Recurrent Disaster -- Habbit [0] - http://www.gnu.org/software/gettext/manual/gettext.html#Preparing-Strings
Quoted 6 lines · Javier Martín
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.
Quoted 8 lines
Quoted 4 lines
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!
Signature · 3 lines
Jordi Mallach Pérez -- Debian developer http://www.debian.org/ [email protected] [email protected] http://www.sindominio.net/ GnuPG public key information available at http://oskuro.net/
Quoted 6 lines · Carles Pina i Estany
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:
Quoted 8 lines
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
Quoted 6 lines
Quoted 2 lines
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. "
Quoted 11 lines
--
Carles Pina i Estany
http://pinux.info_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Quoted 8 lines · Carles Pina i Estany
Quoted 2 lines
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.
Signature · 2 lines
Regards, Pavel Roskin
Quoted 11 lines · Pavel Roskin
Quoted 8 lines · Carles Pina i Estany
Quoted 2 lines
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."
Quoted 8 lines
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?
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 11 lines · Robert Millan
Quoted 8 lines · Pavel Roskin
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.
Signature · 1 line
Colin Watson [[email protected]]
Quoted 10 lines · Pavel Roskin
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.
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,
On Jun/21/2009, Pavel Roskin wrote:
[picking up your message just to get one]
Quoted 2 lines
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 :-)
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 2 lines · Carles Pina i Estany
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.
Signature · 2 lines
Regards, Pavel Roskin
Quoted 3 lines · Pavel Roskin
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.
Quoted 4 lines
But installing all *.mo files to
/boot/grubwould 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.
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 9 lines · Robert Millan
Quoted 3 lines · Pavel Roskin
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.
Quoted 10 lines
Quoted 4 lines
But installing all *.mo files to
/boot/grubwould 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.
Signature · 2 lines
Regards, Pavel Roskin
Hi,
Quoted 2 lines · Robert Millan
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.)
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 8 lines · Robert Millan
Quoted 3 lines
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/grubUhm 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.
Signature · 3 lines
Jordi Mallach Pérez -- Debian developer http://www.debian.org/ [email protected] [email protected] http://www.sindominio.net/ GnuPG public key information available at http://oskuro.net/
Quoted 20 lines · Jordi Mallach
Quoted 1 line · Robert Millan
Quoted 1 line
Now the gettext module will search in $prefix/locale/lang.mo, where
lang
Quoted 3 lines
Quoted 2 lines
is the variable that the user will setup in grub.cfg (e.g. ca for catalan) and $prefix is usually
/boot/grubUhm I'm not sure I agree on this one. Sure, they may be inaccessible,
but
Quoted 1 line
only in very rare setups. On the other hand, we _still_ need a .mo in
the
Quoted 2 lines
standard directory, because some strings in grub-mkconfig are critical (they generate text that populates menu entry titles). So that would
mean
Quoted 1 line
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:
Quoted 3 lines
- 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?
Quoted 3 lines
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
Quoted 12 lines
--
Jordi Mallach Pérez -- Debian developer http://www.debian.org/
[email protected] [email protected] http://www.sindominio.net/
GnuPG public key information available at http://oskuro.net/_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
Quoted 5 lines · Vladimir 'phcoder' Serbinenko
Quoted 3 lines
- 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.
Quoted 3 lines
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.
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."
Hi,
Quoted 10 lines · Robert Millan
Quoted 8 lines · Carles Pina i Estany
Quoted 4 lines
Quoted 1 line
-Copy ca.mo to
/usr/share/locale/ca/LC_MESSAGES/grub.moLanguages 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
Quoted 6 lines
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,
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 4 lines · Carles Pina i Estany
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.
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."