mirror of
https://git.proxmox.com/git/grub2
synced 2025-07-16 18:41:29 +00:00
i18n: Format large integers before the translation message
The GNU gettext only supports the ISO C99 macros for integral types. If there is a need to use unsupported formatting macros, e.g. PRIuGRUB_UINT64_T, according to [1] the number to a string conversion should be separated from the code printing message requiring the internationalization. So, the function grub_snprintf() is used to print the numeric values to an intermediate buffer and the internationalized message contains a string format directive. [1] https://www.gnu.org/software/gettext/manual/html_node/Preparing-Strings.html#No-string-concatenation Signed-off-by: Miguel Ángel Arruga Vivas <rosen644835@gmail.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
e48fc8880d
commit
837fe48deb
@ -612,6 +612,7 @@ luks2_recover_key (grub_disk_t source,
|
||||
/* Try all keyslot */
|
||||
for (json_idx = 0; json_idx < size; json_idx++)
|
||||
{
|
||||
char indexstr[21]; /* log10(2^64) ~ 20, plus NUL character. */
|
||||
typeof (source->total_sectors) max_crypt_sectors = 0;
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
@ -732,11 +733,12 @@ luks2_recover_key (grub_disk_t source,
|
||||
continue;
|
||||
}
|
||||
|
||||
grub_snprintf (indexstr, sizeof (indexstr) - 1, "%" PRIuGRUB_UINT64_T, keyslot.idx);
|
||||
/*
|
||||
* TRANSLATORS: It's a cryptographic key slot: one element of an array
|
||||
* where each element is either empty or holds a key.
|
||||
*/
|
||||
grub_printf_ (N_("Slot \"%" PRIuGRUB_UINT64_T "\" opened\n"), keyslot.idx);
|
||||
grub_printf_ (N_("Slot \"%s\" opened\n"), indexstr);
|
||||
|
||||
candidate_key_len = keyslot.key_size;
|
||||
break;
|
||||
|
@ -121,10 +121,14 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs,
|
||||
return err;
|
||||
break;
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%" PRIxGRUB_UINT64_T
|
||||
" is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
{
|
||||
char rel_info[17]; /* log16(2^64) = 16, plus NUL. */
|
||||
|
||||
grub_snprintf (rel_info, sizeof (rel_info) - 1, "%" PRIxGRUB_UINT64_T,
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%s is not implemented yet"), rel_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,10 +183,14 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||
break;
|
||||
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%" PRIxGRUB_UINT64_T
|
||||
" is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
{
|
||||
char rel_info[17]; /* log16(2^64) = 16, plus NUL. */
|
||||
|
||||
grub_snprintf (rel_info, sizeof (rel_info) - 1, "%" PRIxGRUB_UINT64_T,
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%s is not implemented yet"), rel_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,10 +136,14 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||
case R_IA64_LDXMOV:
|
||||
break;
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%" PRIxGRUB_UINT64_T
|
||||
" is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
{
|
||||
char rel_info[17]; /* log16(2^64) = 16, plus NUL. */
|
||||
|
||||
grub_snprintf (rel_info, sizeof (rel_info) - 1, "%" PRIxGRUB_UINT64_T,
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%s is not implemented yet"), rel_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
|
@ -330,10 +330,14 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||
case R_RISCV_RELAX:
|
||||
break;
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%" PRIxGRUB_UINT64_T
|
||||
" is not implemented yet"),
|
||||
(grub_uint64_t) ELF_R_TYPE (rel->r_info));
|
||||
{
|
||||
char rel_info[17]; /* log16(2^64) = 16, plus NUL. */
|
||||
|
||||
grub_snprintf (rel_info, sizeof (rel_info) - 1, "%" PRIxGRUB_UINT64_T,
|
||||
(grub_uint64_t) ELF_R_TYPE (rel->r_info));
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%s is not implemented yet"), rel_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,10 +176,14 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||
& 0x1fff);
|
||||
break;
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%" PRIxGRUB_UINT64_T
|
||||
" is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
{
|
||||
char rel_info[17]; /* log16(2^64) = 16, plus NUL. */
|
||||
|
||||
grub_snprintf (rel_info, sizeof (rel_info) - 1, "%" PRIxGRUB_UINT64_T,
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%s is not implemented yet"), rel_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,10 +106,14 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||
break;
|
||||
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%" PRIxGRUB_UINT64_T
|
||||
" is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
{
|
||||
char rel_info[17]; /* log16(2^64) = 16, plus NUL. */
|
||||
|
||||
grub_snprintf (rel_info, sizeof (rel_info) - 1, "%" PRIxGRUB_UINT64_T,
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%s is not implemented yet"), rel_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user