From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] Add a --locale-directory option to grub-install and related tools.
Date: Fri, 22 Nov 2013 04:29:47 +0100 [thread overview]
Message-ID: <528ECFAB.7050609@gmail.com> (raw)
In-Reply-To: <20131121183206.GA1595@riva.ucam.org>
[-- Attachment #1: Type: text/plain, Size: 2099 bytes --]
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);
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]
prev parent reply other threads:[~2013-11-22 3:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-21 18:32 [PATCH] Add a --locale-directory option to grub-install and related tools Colin Watson
2013-11-22 3:29 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=528ECFAB.7050609@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.