From patchwork Mon Feb 17 23:27:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1239674 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519687-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=k2ZWnGty; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VBzBONnY; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48M0XK2r74z9sPK for ; Tue, 18 Feb 2020 10:28:00 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=ryN ju9+LC45wvxJ2cvmZIOxmsG1DjHq6ju3QS9cRkBsHyo8y+jfopE8cLSIIdIQYtCL e95cls3cpRM6+mlwvkpQV4GJSs4m5MjDsdw7+d9xMpE7KWpIFPxkTP/FNuUjDhLX Mmp3uPwLEna35TDhsfOGLCbQbAvbLeSwYGT6tiB8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type:content-transfer-encoding; s=default; bh=DPI8kZ8GS LjDVkOIhsijJoH+dsI=; b=k2ZWnGtyrfPLq0/LPFAlHD0gjP1Mc8YDn6EKJMzAi 0dAU4XiZ2iYpWOwnwe8OtQFlkF8ySfXAsuaUhBtSehEE8AfuSTdqY9MZucGl3kTe 4zD4XEstTqUnIdR5r7zUkjQa7Bcyu8/tKuv4jQXjPoBICTiDHrvzJKomvgWHnQKN 4w= Received: (qmail 94233 invoked by alias); 17 Feb 2020 23:27:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 94223 invoked by uid 89); 17 Feb 2020 23:27:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=scanning X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 17 Feb 2020 23:27:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581982070; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z57BmNtizRmPoLl+9M3Bg6PoxOsA0WeFpDe0vw9jYHM=; b=VBzBONnYmu2mIMKRYNIhOsKqbIjpRe7nJahSrvT/w5+P0Q9vHap7y1yK9bJR5mJdjge/Lv 0+fxBvHAXi2rPvG8YE0SUxwd/k3jvNkjDLjoLj4l668SC8H4FJ/GVpAn89Dj4EgAuBgGjK GUon5w0syzjOkK0XiYc1GRnwNrGthNU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-6-HMGrqyrNOuyOZxKtG6-6qw-1; Mon, 17 Feb 2020 18:27:48 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9B907189F762; Mon, 17 Feb 2020 23:27:47 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-21.ams2.redhat.com [10.36.116.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B78B88859; Mon, 17 Feb 2020 23:27:46 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 01HNRiKE025973; Tue, 18 Feb 2020 00:27:44 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 01HNRhm5025972; Tue, 18 Feb 2020 00:27:43 +0100 Date: Tue, 18 Feb 2020 00:27:43 +0100 From: Jakub Jelinek To: "Joseph S. Myers" Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] i18n: Fix translation of --help [PR93759] Message-ID: <20200217232743.GP2155@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-IsSubscribed: yes Hi! The first two hunks make sure we actually translate what has been marked for translation, i.e. the cl_options[...].help strings, rather than those strings ammended in various ways, like: _("%s Same as %s."), help, ... or "%s %s", help, _(use_diagnosed_msg) The exgettext changes attempt to make sure that the cl_options[...].help strings are marked as no-c-format, because otherwise if they happen to contain a % character, such as the 90% substring, they will be marked as c-format, which they aren't. Bootstrapped/regtested on x86_64-linux and i686-linux plus tested with make gcc.pot, ok for trunk? 2020-02-17 Jakub Jelinek PR translation/93759 * opts.c (print_filtered_help): Translate help before appending messages to it rather than after that. * exgettext: For *.opt help texts, use __opt_help_text("...") rather than _("...") in the $emsg file and pass options that say that this implies no-c-format. Jakub --- gcc/opts.c.jj 2020-01-27 13:20:40.491649814 +0100 +++ gcc/opts.c 2020-02-17 14:52:56.164212999 +0100 @@ -1309,10 +1309,13 @@ print_filtered_help (unsigned int includ help = undocumented_msg; } + /* Get the translation. */ + help = _(help); + if (option->alias_target < N_OPTS && cl_options [option->alias_target].help) { - if (help == undocumented_msg) + if (option->help == NULL) { /* For undocumented options that are aliases for other options that are documented, point the reader to the other option in @@ -1347,9 +1350,6 @@ print_filtered_help (unsigned int includ help = new_help; } - /* Get the translation. */ - help = _(help); - /* Find the gap between the name of the option and its descriptive text. */ tab = strchr (help, '\t'); --- gcc/po/exgettext.jj 2020-01-12 11:54:36.784407811 +0100 +++ gcc/po/exgettext 2020-02-17 15:34:40.308915980 +0100 @@ -227,6 +227,7 @@ END { } } print emsg > posr + print "--keyword=__opt_help_text\n--flag=__opt_help_text:1:no-c-format" >> kopt }' ) || exit @@ -240,7 +241,7 @@ echo "scanning option files..." >&2 while (getline < file) { if (/^[ \t]*(;|$)/ || !/^[^ \t]/) { if (field > 2) - printf("_(\"%s\")\n", line) + printf("__opt_help_text(\"%s\")\n", line) field = 0 } else { if ((field == 1) && /MissingArgError/) { @@ -287,7 +288,7 @@ echo "scanning option files..." >&2 lineno++; } if (field > 2) - printf("_(\"%s\")\n", line) + printf("__opt_help_text(\"%s\")\n", line) }') >> $emsg # Run the xgettext commands, with temporary added as a file to scan.