* grub-core/gettext/gettext.c (grub_gettext_init_ext): Factor out
.mo/.mo.gz opening sequence to ... (grub_mofile_open_lang): ... here. (grub_gettext_init_ext): If opening ll_CC fails, try ll. * util/grub.d/00_header.in (grub_lang): Include country part of locale. Reported by: Mario Limonciello.
This commit is contained in:
parent
a94a667185
commit
1fb430f865
3 changed files with 47 additions and 13 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2010-12-10 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* grub-core/gettext/gettext.c (grub_gettext_init_ext): Factor out
|
||||||
|
.mo/.mo.gz opening sequence to ...
|
||||||
|
(grub_mofile_open_lang): ... here.
|
||||||
|
(grub_gettext_init_ext): If opening ll_CC fails, try ll.
|
||||||
|
* util/grub.d/00_header.in (grub_lang): Include country part of
|
||||||
|
locale.
|
||||||
|
Reported by: Mario Limonciello.
|
||||||
|
|
||||||
2010-12-09 Robert Millan <rmh@gnu.org>
|
2010-12-09 Robert Millan <rmh@gnu.org>
|
||||||
|
|
||||||
* NEWS: Document addition of ZFS support.
|
* NEWS: Document addition of ZFS support.
|
||||||
|
|
|
@ -261,24 +261,16 @@ grub_mofile_open (const char *filename)
|
||||||
return fd_mo;
|
return fd_mo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returning grub_file_t would be more natural, but grub_mofile_open assigns
|
||||||
|
to fd_mo anyway ... */
|
||||||
static void
|
static void
|
||||||
grub_gettext_init_ext (const char *lang)
|
grub_mofile_open_lang (const char *locale_dir, const char *locale)
|
||||||
{
|
{
|
||||||
char *mo_file;
|
char *mo_file;
|
||||||
char *locale_dir;
|
|
||||||
|
|
||||||
locale_dir = grub_env_get ("locale_dir");
|
|
||||||
if (locale_dir == NULL)
|
|
||||||
{
|
|
||||||
grub_dprintf ("gettext", "locale_dir variable is not set up.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fd_mo = NULL;
|
|
||||||
|
|
||||||
/* mo_file e.g.: /boot/grub/locale/ca.mo */
|
/* mo_file e.g.: /boot/grub/locale/ca.mo */
|
||||||
|
|
||||||
mo_file = grub_xasprintf ("%s/%s.mo", locale_dir, lang);
|
mo_file = grub_xasprintf ("%s/%s.mo", locale_dir, locale);
|
||||||
if (!mo_file)
|
if (!mo_file)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -295,6 +287,38 @@ grub_gettext_init_ext (const char *lang)
|
||||||
return;
|
return;
|
||||||
fd_mo = grub_mofile_open (mo_file);
|
fd_mo = grub_mofile_open (mo_file);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
grub_gettext_init_ext (const char *locale)
|
||||||
|
{
|
||||||
|
char *locale_dir;
|
||||||
|
|
||||||
|
locale_dir = grub_env_get ("locale_dir");
|
||||||
|
if (locale_dir == NULL)
|
||||||
|
{
|
||||||
|
grub_dprintf ("gettext", "locale_dir variable is not set up.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fd_mo = NULL;
|
||||||
|
|
||||||
|
grub_mofile_open_lang (locale_dir, locale);
|
||||||
|
|
||||||
|
/* ll_CC didn't work, so try ll. */
|
||||||
|
if (fd_mo == NULL)
|
||||||
|
{
|
||||||
|
char *lang = grub_strdup (locale);
|
||||||
|
char *underscore = grub_strchr (lang, '_');
|
||||||
|
|
||||||
|
if (underscore)
|
||||||
|
{
|
||||||
|
*underscore = '\0';
|
||||||
|
grub_mofile_open_lang (locale_dir, lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_free (lang);
|
||||||
|
}
|
||||||
|
|
||||||
if (fd_mo)
|
if (fd_mo)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,7 @@ prefix=@prefix@
|
||||||
exec_prefix=@exec_prefix@
|
exec_prefix=@exec_prefix@
|
||||||
libdir=@libdir@
|
libdir=@libdir@
|
||||||
locale_dir=`echo ${GRUB_PREFIX}/locale | sed ${transform}`
|
locale_dir=`echo ${GRUB_PREFIX}/locale | sed ${transform}`
|
||||||
grub_lang=`echo $LANG | cut -d _ -f 1`
|
grub_lang=`echo $LANG | cut -d . -f 1`
|
||||||
|
|
||||||
. ${libdir}/grub/grub-mkconfig_lib
|
. ${libdir}/grub/grub-mkconfig_lib
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue