[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add a --locale-directory option to grub-install and related
From: |
Vladimir 'φ-coder/phcoder' Serbinenko |
Subject: |
Re: [PATCH] Add a --locale-directory option to grub-install and related tools. |
Date: |
Fri, 22 Nov 2013 04:29:47 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131005 Icedove/17.0.9 |
On 21.11.2013 19:32, Colin Watson wrote:
> * include/grub/util/install.h (GRUB_INSTALL_OPTIONS): Add
> --locale-directory option.
> (enum grub_install_options): Add
> GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY.
> * util/grub-install-common.c (grub_install_help_filter): Handle
> GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY.
> (grub_install_parse): Likewise.
> (get_localedir): New function to check for a user-provided option
> before trying grub_util_get_localedir.
> (copy_locales): Use get_localedir rather than
> grub_util_get_localedir.
> (grub_install_copy_files): Likewise.
I think you need an addition to look for all of
$localedir/$lang{.mo,.gmo} and $localedir/$lang/LC_MESSAGES/grub.mo.
Like following (not tested):
diff --git a/util/grub-install-common.c b/util/grub-install-common.c
diff --git a/util/grub-install-common.c b/util/grub-install-common.c
index 4e1d41a..bf722da 100644
--- a/util/grub-install-common.c
+++ b/util/grub-install-common.c
@@ -570,13 +586,26 @@ copy_locales (const char *dstd)
{
char *srcf;
char *dstf;
+ char *ext;
if (strcmp (de->d_name, ".") == 0)
continue;
if (strcmp (de->d_name, "..") == 0)
continue;
- srcf = grub_util_path_concat_ext (4, locale_dir, de->d_name,
+ ext = grub_strrchr (de->d_name, '.');
+ if (ext && (grub_strcmp (ext, ".mo") == 0
+ || grub_strcmp (ext, ".gmo") == 0))
+ {
+ srcf = grub_util_path_concat (2, locale_dir, de->d_name);
+ dstf = grub_util_path_concat (2, dstd, de->d_name);
+ ext = grub_strrchr (dstf, '.');
+ grub_strcpy (ext, ".mo");
+ }
+ else
+ {
+ srcf = grub_util_path_concat_ext (4, locale_dir, de->d_name,
"LC_MESSAGES", PACKAGE, ".mo");
- dstf = grub_util_path_concat_ext (2, dstd, de->d_name, ".mo");
+ dstf = grub_util_path_concat_ext (2, dstd, de->d_name, ".mo");
+ }
grub_install_compress_file (srcf, dstf, 0);
free (srcf);
free (dstf);
signature.asc
Description: OpenPGP digital signature