[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/4] fs/hfsplus: Mark error strings for translation
From: |
Lidong Chen |
Subject: |
Re: [PATCH 4/4] fs/hfsplus: Mark error strings for translation |
Date: |
Fri, 21 Apr 2023 18:14:39 +0000 |
> On Apr 21, 2023, at 6:10 AM, Daniel Kiper <daniel.kiper@oracle.com> wrote:
>
> On Fri, Apr 21, 2023 at 12:03:52AM +0200, Vladimir 'phcoder' Serbinenko wrote:
>> Is there any reason to translate those strings? They refer to deep
>> HFS+ structures and problems and to common people they are meaningless
>> even in their language. And someone in IT is likely to understand
>> those concepts in English. I wouldn't know a word for "extent" in my
>> native language. And those errors are very rare as they indicate a
>
> Yeah, I know what you mean... :-)
>
>> corrupted FS in the files GRUB cares about. OTOH translating them
>> requires a lot of effort on translator's side for little benefit. They
>> were not forgotten. They were not marked for translation on purpose.
>> If we mark all errors for translation we will make our already large
>> list of strings 10x larger and 90% of it are hyper-obscure error
>> conditions. Error conditions are translated only if they are likely to
>> occur and indicate a resolution direction like "linux command needs to
>> be run before initrd command"
>
> This patch has been suggested by me because I thought the lack of N_()
> was a mistake. Your comments shed some light to this. Though I still
> think some messages, e.g. "not a HFS+ filesystem", could be translated.
I can revert the changes, except the general messages as mentioned by Daniel.
Thanks,
Lidong
>
> Daniel
>
>> On Thu, Apr 20, 2023 at 8:00 PM Lidong Chen <lidong.chen@oracle.com> wrote:
>>>
>>> Signed-off-by: Lidong Chen <lidong.chen@oracle.com>
>>> ---
>>> grub-core/fs/hfsplus.c | 30 +++++++++++++++---------------
>>> 1 file changed, 15 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c
>>> index cf13e8a63..f91af1477 100644
>>> --- a/grub-core/fs/hfsplus.c
>>> +++ b/grub-core/fs/hfsplus.c
>>> @@ -179,7 +179,7 @@ grub_hfsplus_read_block (grub_fshelp_node_t node,
>>> grub_disk_addr_t fileblock)
>>> if (node->fileid == GRUB_HFSPLUS_FILEID_OVERFLOW)
>>> {
>>> grub_error (GRUB_ERR_READ_ERROR,
>>> - "extra extents found in an extend overflow file");
>>> + N_("extra extents found in an extend overflow file"));
>>> break;
>>> }
>>>
>>> @@ -190,7 +190,7 @@ grub_hfsplus_read_block (grub_fshelp_node_t node,
>>> grub_disk_addr_t fileblock)
>>> if (!node->data->extoverflow_tree_ready)
>>> {
>>> grub_error (GRUB_ERR_BAD_FS,
>>> - "attempted to read extent overflow tree before
>>> loading");
>>> + N_("attempted to read extent overflow tree before
>>> loading"));
>>> break;
>>> }
>>>
>>> @@ -205,8 +205,8 @@ grub_hfsplus_read_block (grub_fshelp_node_t node,
>>> grub_disk_addr_t fileblock)
>>> || !nnode)
>>> {
>>> grub_error (GRUB_ERR_READ_ERROR,
>>> - "no block found for the file id 0x%x and the block"
>>> - " offset 0x%" PRIuGRUB_UINT64_T,
>>> + N_("no block found for the file id 0x%x and the block"
>>> + " offset 0x%" PRIuGRUB_UINT64_T),
>>> node->fileid, fileblock);
>>> break;
>>> }
>>> @@ -277,7 +277,7 @@ grub_hfsplus_mount (grub_disk_t disk)
>>> /* See if there's an embedded HFS+ filesystem. */
>>> if (grub_be_to_cpu16 (volheader.hfs.embed_sig) != GRUB_HFSPLUS_MAGIC)
>>> {
>>> - grub_error (GRUB_ERR_BAD_FS, "not a HFS+ filesystem");
>>> + grub_error (GRUB_ERR_BAD_FS, N_("not a HFS+ filesystem"));
>>> goto fail;
>>> }
>>>
>>> @@ -303,7 +303,7 @@ grub_hfsplus_mount (grub_disk_t disk)
>>> || ((volheader.hfsplus.blksize & (volheader.hfsplus.blksize - 1)) !=
>>> 0)
>>> || grub_be_to_cpu32 (volheader.hfsplus.blksize) <
>>> GRUB_DISK_SECTOR_SIZE)
>>> {
>>> - grub_error (GRUB_ERR_BAD_FS, "not a HFS+ filesystem");
>>> + grub_error (GRUB_ERR_BAD_FS, N_("not a HFS+ filesystem"));
>>> goto fail;
>>> }
>>>
>>> @@ -358,7 +358,7 @@ grub_hfsplus_mount (grub_disk_t disk)
>>>
>>> if (data->catalog_tree.nodesize < 2)
>>> {
>>> - grub_error (GRUB_ERR_BAD_FS, "invalid catalog node size");
>>> + grub_error (GRUB_ERR_BAD_FS, N_("invalid catalog node size"));
>>> goto fail;
>>> }
>>>
>>> @@ -378,7 +378,7 @@ grub_hfsplus_mount (grub_disk_t disk)
>>>
>>> if (data->extoverflow_tree.nodesize < 2)
>>> {
>>> - grub_error (GRUB_ERR_BAD_FS, "invalid extents overflow node size");
>>> + grub_error (GRUB_ERR_BAD_FS, N_("invalid extents overflow node
>>> size"));
>>> goto fail;
>>> }
>>>
>>> @@ -406,7 +406,7 @@ grub_hfsplus_mount (grub_disk_t disk)
>>> fail:
>>>
>>> if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
>>> - grub_error (GRUB_ERR_BAD_FS, "not a HFS+ filesystem");
>>> + grub_error (GRUB_ERR_BAD_FS, N_("not a HFS+ filesystem"));
>>>
>>> grub_free (data);
>>> return 0;
>>> @@ -550,7 +550,7 @@ grub_hfsplus_btree_iterate_node (struct
>>> grub_hfsplus_btree *btree,
>>>
>>> if (node_count && first_node->next == saved_node)
>>> {
>>> - grub_error (GRUB_ERR_BAD_FS, "HFS+ btree loop");
>>> + grub_error (GRUB_ERR_BAD_FS, N_("HFS+ btree loop"));
>>> return 0;
>>> }
>>> if (!(node_count & (node_count - 1)))
>>> @@ -598,7 +598,7 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree
>>> *btree,
>>>
>>> if (btree->nodesize < HFSPLUS_BTNODE_MINSZ ||
>>> btree->nodesize > HFSPLUS_BTNODE_MAXSZ)
>>> - return grub_error (GRUB_ERR_BAD_FS, "invalid HFS+ btree node size");
>>> + return grub_error (GRUB_ERR_BAD_FS, N_("invalid HFS+ btree node
>>> size"));
>>>
>>> node = grub_malloc (btree->nodesize);
>>> if (! node)
>>> @@ -613,7 +613,7 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree
>>> *btree,
>>> if (save_node == currnode)
>>> {
>>> grub_free (node);
>>> - return grub_error (GRUB_ERR_BAD_FS, "HFS+ btree loop");
>>> + return grub_error (GRUB_ERR_BAD_FS, N_("HFS+ btree loop"));
>>> }
>>> if (!(node_count & (node_count - 1)))
>>> save_node = currnode;
>>> @@ -626,7 +626,7 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree
>>> *btree,
>>> btree->nodesize, (char *) node) <= 0)
>>> {
>>> grub_free (node);
>>> - return grub_error (GRUB_ERR_BAD_FS, "couldn't read i-node");
>>> + return grub_error (GRUB_ERR_BAD_FS, N_("couldn't read i-node"));
>>> }
>>>
>>> nodedesc = (struct grub_hfsplus_btnode *) node;
>>> @@ -668,7 +668,7 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree
>>> *btree,
>>> + 2);
>>>
>>> if ((char *) pointer > node + btree->nodesize - 2)
>>> - return grub_error (GRUB_ERR_BAD_FS, "HFS+ key beyond end of
>>> node");
>>> + return grub_error (GRUB_ERR_BAD_FS, N_("HFS+ key beyond end
>>> of node"));
>>>
>>> currnode = grub_be_to_cpu32 (grub_get_unaligned32 (pointer));
>>> match = 1;
>>> @@ -711,7 +711,7 @@ list_nodes (void *record, void *hook_arg)
>>> if (grub_be_to_cpu16 (catkey->keylen) < HFSPLUS_CATKEY_MIN_LEN ||
>>> grub_be_to_cpu16 (catkey->keylen) > HFSPLUS_CATKEY_MAX_LEN)
>>> {
>>> - grub_error (GRUB_ERR_BAD_FS, "catalog key length is out of range");
>>> + grub_error (GRUB_ERR_BAD_FS, N_("catalog key length is out of
>>> range"));
>>> return 1;
>>> }
>>>
>>> --
>>> 2.39.1