public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tsukasa OI <research_trasio@irq.a4lg.com>
To: Tsukasa OI <research_trasio@irq.a4lg.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Andrew Waterman <andrew@sifive.com>,
	Jim Wilson <jim.wilson.gcc@gmail.com>,
	Nelson Chu <nelson.chu@sifive.com>
Cc: binutils@sourceware.org
Subject: [PATCH 0/1] RISC-V: i18n enablement on error messages
Date: Fri, 10 Jun 2022 18:52:49 +0900	[thread overview]
Message-ID: <cover.1654854518.git.research_trasio@irq.a4lg.com> (raw)

Hello,

This patchset contains i18n enablement.

When extensions are missing for an instruction, it will print an error
message like this:

    Error: unrecognized opcode `fence.i', extension `zifencei' required

This is formatted in gas/config/tc-riscv.c:

    as_bad ("%s `%s', extension `%s' required", error.msg,
            error.statement, error.missing_ext);

error.missing_ext is a return value from the function
`riscv_multi_subset_supports_ext' in bfd/elfxx-riscv.c.

If required "extension" IS simple, that's fine.  All we have to do
with i18n is to translate "%s `%s', extension `%s' required".
But if requirementS get complex, that's not that simple.  There are
13 complex strings representing required extensions:

    return "f' and `c";
    return "d' and `c";
    return "f' or `zfinx";
    return "d' or `zdinx";
    return "q' or `zqinx";
    return "zbb' or `zbkb";
    return "zbc' or `zbkc";
    return "zknd' or `zkne";
    return "v' or `zve64x' or `zve32x";
    return "v' or `zve64d' or `zve64f' or `zve32f";
    return "zfh' or 'zhinx";
    return "('d' and 'zfh') or 'zhinx";
    return "('q' and 'zfh') or 'zhinx";

For i18n, we have to translate words like "and" and "or".  In Japanese,
we should translate:
    "f' and `c"
to:
    "f' および `c"

This is simple (I replaced "and" with equivalent Japanese word "および").
But more complex requirements (e.g. involving V or Zfh) will need
natural sentense (that would depend on each language).

This patch wraps such 13 strings with _() for i18n enablement.
It will be a prerequisite to my future submission of quick Zhinx fixes
and larger Z{h,f,d,q}inx fixes.

Thanks,
Tsukasa




Tsukasa OI (1):
  RISC-V: Prepare i18n for required ISA extensions

 bfd/elfxx-riscv.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)


base-commit: 6a72edd8e26c670bbdce7aeae3c0c8f793fc8612
-- 
2.34.1


             reply	other threads:[~2022-06-10  9:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10  9:52 Tsukasa OI [this message]
2022-06-10  9:52 ` [PATCH 1/1] RISC-V: Prepare i18n for required ISA extensions Tsukasa OI
2022-06-22 10:35   ` Nelson Chu

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=cover.1654854518.git.research_trasio@irq.a4lg.com \
    --to=research_trasio@irq.a4lg.com \
    --cc=andrew@sifive.com \
    --cc=binutils@sourceware.org \
    --cc=jim.wilson.gcc@gmail.com \
    --cc=nelson.chu@sifive.com \
    --cc=palmer@dabbelt.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).