From patchwork Sun Oct 28 06:51:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10658497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 393CB13BF for ; Sun, 28 Oct 2018 06:52:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AA452980B for ; Sun, 28 Oct 2018 06:52:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F0492A075; Sun, 28 Oct 2018 06:52:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A141D2980B for ; Sun, 28 Oct 2018 06:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727876AbeJ1Pf7 (ORCPT ); Sun, 28 Oct 2018 11:35:59 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:34828 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725791AbeJ1Pf6 (ORCPT ); Sun, 28 Oct 2018 11:35:58 -0400 Received: by mail-lf1-f67.google.com with SMTP id d7-v6so3739145lfi.2 for ; Sat, 27 Oct 2018 23:52:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hfx0wHo+aJ95DheRDp+HrVz7WyEbzRBR3cUux7hu0I4=; b=lK//xKM7MoRPvNvHu80+CuCufCdzGk52QFj5klhf+n60cbsV6O2QwIl4NSO4v0dubD /higWU2qWifX+BQhUwHU0RzeLsiGLyFothDSHhna5ydgwPr65KH3ImG6AnSz9Gn2toT/ 1na+kFSkcGc/ZNm+UcxSfkgx9fF6Hdr/PpRx0ZYKeK5h7/YgOkqsX2elRDW0l8EKgrHx FAVbpTJVr4I72f0nZHnlDJTsphMksW4wOoNRuLUF8nUE1C6lkhLjbG787dTdalRaddcJ IR8iLhnUTBqguRXZ04qcxZgvop+1D71uzeG7WLQdROazkww5fbZZON/BjirsyXpqjH8e jLzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hfx0wHo+aJ95DheRDp+HrVz7WyEbzRBR3cUux7hu0I4=; b=bl2XMaKZ3KTDH22Coo/g0WRiTuNrTWRjMmK+XzlFAzKIOM12FgIJRfGYpYzkLJpBKi ZAZBKhCcoidphUnpeEV5J67nVvGDQDyCkiemIbeUa+KwTk6Hzt6n3l1M1pBDWqrmvWzR On+nBYS5ch24wZc9mYj4C35AbNYJfQ7kH/8juYNLKS70t1pFyFlcwXTGc4DPQahOzIFu QM/NcfkPlRdqj+P/trc522Mhu1N6mLw8OIYtxe4Jotalx9V5u958DkXT1gTY2MAX0wCf 6ocaC7YFQBZJnp6jZ1H4jkvF2yK3OGmqfErZJr/Xz5G8YeUantIlpjTs57d2258eh53f QPEQ== X-Gm-Message-State: AGRZ1gJEn4T+YcUw3TLd+8i78flt1wfgnl3ggyD8iF9FnKnZqxE+xGs+ eMRZ2RgJlsaL0Cc2d2of3krHE3iI X-Google-Smtp-Source: AJdET5f2FWqLTVLdTjvoxu+g5mdNTArwCoSxXqaRSa8jVuEJe6CbXqIAnMuP8bouXmpJTWmbKFbZlw== X-Received: by 2002:a19:59d3:: with SMTP id n202-v6mr5456397lfb.125.1540709534120; Sat, 27 Oct 2018 23:52:14 -0700 (PDT) Received: from localhost.localdomain (c80-216-12-205.bredband.comhem.se. [80.216.12.205]) by smtp.gmail.com with ESMTPSA id v23-v6sm148847ljd.70.2018.10.27.23.52.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Oct 2018 23:52:13 -0700 (PDT) From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= Subject: [PATCH 11/12] parse-options.c: mark more strings for translation Date: Sun, 28 Oct 2018 07:51:56 +0100 Message-Id: <20181028065157.26727-12-pclouds@gmail.com> X-Mailer: git-send-email 2.19.1.647.g708186aaf9 In-Reply-To: <20181028065157.26727-1-pclouds@gmail.com> References: <20181028065157.26727-1-pclouds@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Nguyễn Thái Ngọc Duy --- parse-options.c | 18 +++++++++--------- t/t0040-parse-options.sh | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/parse-options.c b/parse-options.c index 0bf817193d..949aac287f 100644 --- a/parse-options.c +++ b/parse-options.c @@ -197,7 +197,7 @@ static int get_value(struct parse_opt_ctx_t *p, return 0; default: - die("should not happen, someone must be hit on the forehead"); + BUG("opt->type %d should not happen, someone must be hit on the forehead", opt->type); } } @@ -319,8 +319,8 @@ static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg, } if (ambiguous_option) { - error("Ambiguous option: %s " - "(could be --%s%s or --%s%s)", + error(_("ambiguous option: %s " + "(could be --%s%s or --%s%s)"), arg, (ambiguous_flags & OPT_UNSET) ? "no-" : "", ambiguous_option->long_name, @@ -353,7 +353,7 @@ static void check_typos(const char *arg, const struct option *options) return; if (starts_with(arg, "no-")) { - error ("did you mean `--%s` (with two dashes ?)", arg); + error(_("did you mean `--%s` (with two dashes ?)"), arg); exit(129); } @@ -361,7 +361,7 @@ static void check_typos(const char *arg, const struct option *options) if (!options->long_name) continue; if (starts_with(options->long_name, arg)) { - error ("did you mean `--%s` (with two dashes ?)", arg); + error(_("did you mean `--%s` (with two dashes ?)"), arg); exit(129); } } @@ -424,7 +424,7 @@ void parse_options_start(struct parse_opt_ctx_t *ctx, ctx->flags = flags; if ((flags & PARSE_OPT_KEEP_UNKNOWN) && (flags & PARSE_OPT_STOP_AT_NON_OPTION)) - die("STOP_AT_NON_OPTION and KEEP_UNKNOWN don't go together"); + BUG("STOP_AT_NON_OPTION and KEEP_UNKNOWN don't go together"); parse_options_check(options); } @@ -644,11 +644,11 @@ int parse_options(int argc, const char **argv, const char *prefix, break; default: /* PARSE_OPT_UNKNOWN */ if (ctx.argv[0][1] == '-') { - error("unknown option `%s'", ctx.argv[0] + 2); + error(_("unknown option `%s'"), ctx.argv[0] + 2); } else if (isascii(*ctx.opt)) { - error("unknown switch `%c'", *ctx.opt); + error(_("unknown switch `%c'"), *ctx.opt); } else { - error("unknown non-ascii option in string: `%s'", + error(_("unknown non-ascii option in string: `%s'"), ctx.argv[0]); } usage_with_options(usagestr, options); diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh index 17d0c18feb..e46b1e02f0 100755 --- a/t/t0040-parse-options.sh +++ b/t/t0040-parse-options.sh @@ -228,7 +228,7 @@ EOF test_expect_success 'detect possible typos' ' test_must_fail test-tool parse-options -boolean >output 2>output.err && test_must_be_empty output && - test_cmp typo.err output.err + test_i18ncmp typo.err output.err ' cat >typo.err <<\EOF @@ -238,7 +238,7 @@ EOF test_expect_success 'detect possible typos' ' test_must_fail test-tool parse-options -ambiguous >output 2>output.err && test_must_be_empty output && - test_cmp typo.err output.err + test_i18ncmp typo.err output.err ' test_expect_success 'keep some options as arguments' '