From patchwork Thu May 26 14:50:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiang Xin X-Patchwork-Id: 12862494 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9477C433F5 for ; Thu, 26 May 2022 14:51:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243924AbiEZOuo (ORCPT ); Thu, 26 May 2022 10:50:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236989AbiEZOul (ORCPT ); Thu, 26 May 2022 10:50:41 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A41CC5DD1B for ; Thu, 26 May 2022 07:50:40 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id j6so1851368pfe.13 for ; Thu, 26 May 2022 07:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2aaJzHcmlhNRZeWbNf+3yAibcMiyJl+cx3tG1hawCWo=; b=DdZR5iVofHQFvgQFjlvrJ3AFfKm03/LZPAVFQ5qzoF7L6lE6jlJY2KmQNAKaRVRE9r RP0AcN+gLgK55FLTl+vJRVDF8AauvOvnl72YNFZIv35RbAMr4HbdlTaV7jNED4Fqzmw/ 48DoxHEGvhRt7GF5yOpAt8NFKujRQFj8f6UY8i9ap2dj7zGvs2FiTMpvuRR1rr/Sllpi tPaSPP7C8cZZMQ7RQoREWL9VBnQZPMwxG4k16jp6msawIt5jdH1EOQDzAJ52Am0o9UPG jgAPrIkT4ndPWD2V0LM+jcEFJnrS9JOaDWNRXhcMpGB0AvirP8ce/Iz1xaVaYWc6K+nL /pTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2aaJzHcmlhNRZeWbNf+3yAibcMiyJl+cx3tG1hawCWo=; b=JcNPK2F5rf5ouTPy8Hk0jbXKGd+Eyouxvbv9YzrSDGHCwQP9yQOkn25KEOMVbkAJLv 8aF6iIfIzFtJ+C1NaQ+2Ih9G5F5aMV7rR5jbRaNy7u7S+rThUSs5WXjtjzmyiuqKZXSC Gc5I5SDGrAMAAgZ80ipmMmoYncnglv9T59E4oi05rqE9DfFw5CZA7Ex35UQIoR2Z37cI nCECRumjLVSSfJhqb41uFzEYTpcnW4ap9z2kwGMWnMsY/kONySHhVhx3iGRBu3KfpwT8 ZG9JPDJk390dOv6tPKQQ2hf7nVCc4ypeEGiokX4KeM9vrY69SIuHNVjHwzWvDtuVTgHZ rvQw== X-Gm-Message-State: AOAM533mlW/VWdDhhSwqApV2i4NjGk7yAi7a31mvQt8tVQCY6Tek2r8n 9xgfUAGrWTiI23g6pJJOTtk= X-Google-Smtp-Source: ABdhPJycyxMq10CKN5oeo5mP4iCaO9Q2QnI6SeJC+VCNwNALOGzHnW9Wljvb3974a2V3l7i+60X07w== X-Received: by 2002:a63:2365:0:b0:3db:8691:4fb9 with SMTP id u37-20020a632365000000b003db86914fb9mr32799898pgm.261.1653576640200; Thu, 26 May 2022 07:50:40 -0700 (PDT) Received: from tigtog.localdomain.localdomain (144.34.163.219.16clouds.com. [144.34.163.219]) by smtp.gmail.com with ESMTPSA id i16-20020a056a00005000b00518382bceaesm1597480pfk.57.2022.05.26.07.50.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2022 07:50:39 -0700 (PDT) From: Jiang Xin To: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Junio C Hamano , Git List Cc: Jiang Xin , Alexander Shopov , Jordi Mas , =?utf-8?q?Matthias_R=C3=BCster?= , Jimmy Angelakos , =?utf-8?q?Christopher_D=C3=ADaz?= , =?utf-8?q?Jean-No=C3=ABl_Avila?= , Bagas Sanjaya , Alessandro Menti , Gwan-gyeong Mun , Arusekk , Daniel Santos , Dimitriy Ryazantcev , Peter Krefting , Emir SARI , =?utf-8?b?VHLhuqduIE5n4buNYyBRdcOibg==?= , Fangyi Zhou , Yi-Jyun Pan , Jiang Xin Subject: [PATCH v5 01/10] Makefile: sort source files before feeding to xgettext Date: Thu, 26 May 2022 22:50:26 +0800 Message-Id: <20220526145035.18958-2-worldhello.net@gmail.com> X-Mailer: git-send-email 2.32.0.rc3 In-Reply-To: <20220523152128.26380-1-worldhello.net@gmail.com> References: <20220523152128.26380-1-worldhello.net@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jiang Xin We will feed xgettext with more C source files and in different order in subsequent commit. To generate a stable "po/git.pot" regardless of the number and order of input source files, we sort the c, perl, and shell source files in groups before feeding them to xgettext. Ævar suggested that we should not pass the option "--sort-by-file" to xgettext to sort the translatable strings, as it will mix the three groups of source files (c, perl and shell) in the file "po/git.pot", and change the order of translatable strings in the same line of a file. With this update, the newly generated "po/git.pot" will have the same entries while in a different order. With the help of a custom diff driver as shown below, git config --global diff.gettext-fmt.textconv \ "msgcat --no-location --sort-by-file" and appending a new entry "*.pot diff=gettext-fmt" to git attributes, we can see that there are no substantial changes in "po/git.pot". We won't checkin the newly generated "po/git.pot", because we will remove it from tree in a later commit. Suggested-by: Ævar Arnfjörð Bjarmason Signed-off-by: Jiang Xin --- Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f8bccfab5e..7ca95cdb82 100644 --- a/Makefile +++ b/Makefile @@ -2713,10 +2713,9 @@ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \ --keyword=gettextln --keyword=eval_gettextln XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \ --keyword=__ --keyword=N__ --keyword="__n:1,2" -LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H) -LOCALIZED_SH = $(SCRIPT_SH) -LOCALIZED_SH += git-sh-setup.sh -LOCALIZED_PERL = $(SCRIPT_PERL) +LOCALIZED_C = $(sort $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)) +LOCALIZED_SH = $(sort $(SCRIPT_SH) git-sh-setup.sh) +LOCALIZED_PERL = $(sort $(SCRIPT_PERL)) ifdef XGETTEXT_INCLUDE_TESTS LOCALIZED_C += t/t0200/test.c From patchwork Thu May 26 14:50:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Xin X-Patchwork-Id: 12862496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99E79C433EF for ; Thu, 26 May 2022 14:51:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347847AbiEZOus (ORCPT ); Thu, 26 May 2022 10:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345274AbiEZOum (ORCPT ); Thu, 26 May 2022 10:50:42 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF5645622D for ; Thu, 26 May 2022 07:50:41 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id q4so1608805plr.11 for ; Thu, 26 May 2022 07:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QyDPm+LruJahN9f4i52bnVksky7Gx4Gs4izyiWyqMQk=; b=Qx6gYXQP7dxgfnr3gxSjBXOk5moAw3+NSVjZt0GsSUVgiLFlgbLIm4IzvCe1OpDGsr yj+sVDz8zarxdC3FoNxp2XiooljLH5WncpO/z9iZojDF4REo1Itb0kINKReSWikPfV30 aDlYxMaFnaJxVSZ58r11JHEbwG8pTJgLKnQkXZ0hukTuY0D0ODl3Q8M5sL3d0ZG7LJta dKDlEXP5qG5PCRpr6CB76hVcQTRyFYAzryow41WQU7Fk1ja5ZZ0fFc8wXrf5zGldxvFt gRDjnQqaJiw/GiG0dYjp7UJHHQAZJMmbUAC18BAfenvCG994v8E2b0x0u6v9SwlPUyG/ uJBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QyDPm+LruJahN9f4i52bnVksky7Gx4Gs4izyiWyqMQk=; b=dSkj6HA2DDBoZib2jAGdbPw6w3O9rfqxrEazFfbvmgF3Knkzl8CtDPfbQj8eQm/Nz/ kiKw82+s/dKaMcqRg1B/2WK/2bGj3TZw6Pa+iSbMuOu7wbeLzPqFupA2KBya8tG/qoRx +9AWMPYukmIc38avvH0hhvGXf/BsPedw7KWOrpJc/ZuDVNBwxsOvxY534h9fbQcD8Lbn CYwSWaV/YRXXJF01klhVK0kq0fvPhyjVTSdZO5VQHFzFpxmsJMMDyao5xUDGOLoi7F8n Cw7sUL3FKc+UW5ddp7aOXyTMA0oa1N+WzdzgMlOh+5vhA4YjDVLsDD7SN7Ux4Ag/XN0n N4+g== X-Gm-Message-State: AOAM530REyr9XZKpmTkGSyW8cGW4IiFGukJty4gK3VK0NwQWI1BGGee8 Eitrb1fipmmSBRiP7ivjynE= X-Google-Smtp-Source: ABdhPJwJcvqYqyTJd5eqxb90drZtas38U79G620rj+JGSM4bILJvYdlOdM+VqxLSikdN/WXragAfsA== X-Received: by 2002:a17:902:ecca:b0:161:cad8:6ff4 with SMTP id a10-20020a170902ecca00b00161cad86ff4mr37817606plh.111.1653576641382; Thu, 26 May 2022 07:50:41 -0700 (PDT) Received: from tigtog.localdomain.localdomain (144.34.163.219.16clouds.com. [144.34.163.219]) by smtp.gmail.com with ESMTPSA id i16-20020a056a00005000b00518382bceaesm1597480pfk.57.2022.05.26.07.50.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2022 07:50:41 -0700 (PDT) From: Jiang Xin To: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Junio C Hamano , Git List Cc: Jiang Xin , Alexander Shopov , Jordi Mas , =?utf-8?q?Matthias_R=C3=BCster?= , Jimmy Angelakos , =?utf-8?q?Christopher_D=C3=ADaz?= , =?utf-8?q?Jean-No=C3=ABl_Avila?= , Bagas Sanjaya , Alessandro Menti , Gwan-gyeong Mun , Arusekk , Daniel Santos , Dimitriy Ryazantcev , Peter Krefting , Emir SARI , =?utf-8?b?VHLhuqduIE5n4buNYyBRdcOibg==?= , Fangyi Zhou , Yi-Jyun Pan , Jiang Xin Subject: [PATCH v5 02/10] Makefile: generate "po/git.pot" from stable LOCALIZED_C Date: Thu, 26 May 2022 22:50:27 +0800 Message-Id: <20220526145035.18958-3-worldhello.net@gmail.com> X-Mailer: git-send-email 2.32.0.rc3 In-Reply-To: <20220523152128.26380-1-worldhello.net@gmail.com> References: <20220523152128.26380-1-worldhello.net@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jiang Xin Different users may generate a different message template file "po/git.pot". This is because the POT file is generated from "$(LOCALIZED_C)", which is supposed to list all the sources that we extract the strings to be translated from. But "$(LOCALIZED_C)" includes "$(C_OBJ)", which only lists the source files used in the current build for a specific platform and specific compiler conditions. Instead of using "$(C_OBJ)", we use "$(FOUND_C_SOURCES)", which lists all source files we keep track of (or ship in a tarball extract), to form a stable "LOCALIZED_C". We also add "$(SCALAR_SOURCES)", which is part of "$(C_OBJ)" but not included in "$(FOUND_C_SOURCES)". With this update, the newly generated "po/git.pot" will have 30 new entries coming from the following C source files: * compat/fsmonitor/fsm-listen-win32.c * compat/mingw.c * compat/regex/regcomp.c * compat/simple-ipc/ipc-win32.c Signed-off-by: Jiang Xin --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7ca95cdb82..f2f9c9bc81 100644 --- a/Makefile +++ b/Makefile @@ -2713,7 +2713,8 @@ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \ --keyword=gettextln --keyword=eval_gettextln XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \ --keyword=__ --keyword=N__ --keyword="__n:1,2" -LOCALIZED_C = $(sort $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)) +LOCALIZED_C = $(sort $(FOUND_C_SOURCES) $(FOUND_H_SOURCES) $(SCALAR_SOURCES) \ + $(GENERATED_H)) LOCALIZED_SH = $(sort $(SCRIPT_SH) git-sh-setup.sh) LOCALIZED_PERL = $(sort $(SCRIPT_PERL)) From patchwork Thu May 26 14:50:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiang Xin X-Patchwork-Id: 12862505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EB9DC433EF for ; Thu, 26 May 2022 14:52:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243461AbiEZOwg (ORCPT ); Thu, 26 May 2022 10:52:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347839AbiEZOup (ORCPT ); Thu, 26 May 2022 10:50:45 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A0C980207 for ; Thu, 26 May 2022 07:50:43 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id p8so1869899pfh.8 for ; Thu, 26 May 2022 07:50:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OKk6N+aYgoXUBigap2OuunZ3HhgB0/XtEPI/ek/80jM=; b=SPTGidxJrkzT7JPSjnQ756ztfgrIfxDEqwg4ZEzdUKK/R0wzzLaclB2hy9McDSIsGK PgVb9PQVUsBqG98046Gcfaqw+PnEXkvDdgSPsKF0InvyN40s/SbmmvKzzyi+dMWZKsxM Pq4T1O11IPYajpBkMThO5dnUMqs/uPtWnS2RV8mmP/+RgbJgUZvJ500lmjOZCB2rRFt7 EHyrH8xOx95ivoNhiiODCJjsbGw2eNEfPtUhpdSbSiV95Xlh0GG5QSsagGWDUEnZdCEI Jc6TM8WDHnQkI32N+6XPllest1lGhWkWUgBccVaz2imO/yV1Qlf59J6fuw41IV1Jj4z4 hwLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OKk6N+aYgoXUBigap2OuunZ3HhgB0/XtEPI/ek/80jM=; b=n/jvVqsXwUIU/iRg1T4Rc6oxLLu5DteR2L5SoXkBU81O0EZqsOc0LnKhI4PLTYFIxV aMWs9mrEdn/LooX5RR1mAw4alTlhHSvMnOuPB3Wv+BPHeogzPcplzLWN3Q3sWNgBkxW7 hVIkrcgDSUWS1f5NMF5kfJHOvpacYfFSJv8GeBszj+yQ7tR+bXHrW6eJ/icMFt0TUU/q gb8qW4/oA9cCGPGrs+6roG5C93UB7I0gdoXMR/KH0IHQrCTsEoB+H/xqR9SE4PKBts8J AvvvctWdENH1HsPU9tmbGUmtZgvIM1HyIUALXbzBb6XfJ8AUnsbO4SHIJBQ+8KcZEYae YS6w== X-Gm-Message-State: AOAM530arNGBuYDCKbWhH9AVZ6375v9a/egJID5PJG05Ljz2CRGR6leS qsp9MJUkkZUDPLUJUrCMlWw= X-Google-Smtp-Source: ABdhPJwwrg5pXdtuVUhccQgIxTTwri1fjkd79dL67cfd0M43KZH0EFEzLLrLaj1HyKVr1FD1Iy4cKQ== X-Received: by 2002:a63:5304:0:b0:3fb:92eb:8e90 with SMTP id h4-20020a635304000000b003fb92eb8e90mr1057379pgb.36.1653576642643; Thu, 26 May 2022 07:50:42 -0700 (PDT) Received: from tigtog.localdomain.localdomain (144.34.163.219.16clouds.com. [144.34.163.219]) by smtp.gmail.com with ESMTPSA id i16-20020a056a00005000b00518382bceaesm1597480pfk.57.2022.05.26.07.50.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2022 07:50:42 -0700 (PDT) From: Jiang Xin To: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Junio C Hamano , Git List Cc: Alexander Shopov , Jordi Mas , =?utf-8?q?Matthias_R=C3=BCster?= , Jimmy Angelakos , =?utf-8?q?Christopher_D=C3=ADaz?= , =?utf-8?q?Jean-No=C3=ABl_Avila?= , Bagas Sanjaya , Alessandro Menti , Gwan-gyeong Mun , Arusekk , Daniel Santos , Dimitriy Ryazantcev , Peter Krefting , Emir SARI , =?utf-8?b?VHLhuqduIE5n4buNYyBRdcOibg==?= , Fangyi Zhou , Yi-Jyun Pan , Jiang Xin , Jiang Xin Subject: [PATCH v5 03/10] Makefile: have "make pot" not "reset --hard" Date: Thu, 26 May 2022 22:50:28 +0800 Message-Id: <20220526145035.18958-4-worldhello.net@gmail.com> X-Mailer: git-send-email 2.32.0.rc3 In-Reply-To: <20220523152128.26380-1-worldhello.net@gmail.com> References: <20220523152128.26380-1-worldhello.net@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Ævar Arnfjörð Bjarmason Before commit fc0fd5b23b (Makefile: help gettext tools to cope with our custom PRItime format, 2017-07-20), we'd consider source files as-is with gettext, but because we need to understand PRItime in the same way that gettext itself understands PRIuMAX, we'd first check if we had a clean checkout, then munge all of the processed files in-place with "sed", generate "po/git.pot", and then finally "reset --hard" to undo our changes. By generating "pot" snippets in ".build/pot/po" for each source file and rewriting certain source files with PRItime macros to temporary files in ".build/pot/po", we can avoid running "make pot" by altering files in place and doing a "reset --hard" afterwards. This speed of "make pot" is slower than before on an initial run, because we run "xgettext" many times (once per source file), but it can be boosted by parallelization. It is *much* faster for incremental runs, and will allow us to implement related targets in subsequent commits. When the "pot" target was originally added in cd5513a7168 (i18n: Makefile: "pot" target to extract messages marked for translation, 2011-02-22) it behaved like a "normal" target. I.e. we'd skip the re-generation of the po/git.pot if nothing had to be done. Then after po/git.pot was checked in in dce37b66fb0 (l10n: initial git.pot for 1.7.10 upcoming release, 2012-02-13) the target was broken until 1f31963e921 (i18n: treat "make pot" as an explicitly-invoked target, 2014-08-22) when it was made to depend on "FORCE". I.e. the Makefile's dependency resolution inherently can't handle incremental building when the target file may be updated by git (or something else external to "make"). But this case no longer applies, so FORCE is no longer needed. That out of the way, the main logic change here is getting rid of the "reset --hard": We'll generate intermediate ".build/pot/po/%.po" files from "%", which is handy to see at a glance what strings (if any) in a given file are marked for translation: $ make .build/pot/po/pretty.c.po [...] $ cat .build/pot/po/pretty.c.po #: pretty.c:1051 msgid "unable to parse --pretty format" msgstr "" $ For these C source files which contain the PRItime macros, we will create temporary munged "*.c" files in a tree in ".build/pot/po" corresponding to our source tree, and have "xgettext" consider those. The rule needs to be careful to "(cd .build/pot/po && ...)", because otherwise the comments in the po/git.pot file wouldn't refer to the correct source locations (they'd be prefixed with ".build/pot/po"). These temporary munged "*.c” files will be removed immediately after the corresponding po files are generated, because some development tools cannot ignore the duplicate source files in the ".build" directory according to the ".gitignore" file, and that may cause trouble. The output of the generated po/git.pot file is changed in one minor way: Because we're using msgcat(1) instead of xgettext(1) to concatenate the output we'll now disambiguate where "TRANSLATORS" comments come from, in cases where a message is the same in N files, and either only one has a "TRANSLATORS" comment, or they're different. E.g. for the "Your edited hunk[...]" message we'll now apply this change (comment content elided): +#. #-#-#-#-# add-patch.c.po #-#-#-#-# #. TRANSLATORS: do not translate [y/n] [...] +#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-# #. TRANSLATORS: do not translate [y/n] [...] #: add-patch.c:1253 git-add--interactive.perl:1244 msgid "" "Your edited hunk does not apply. Edit again (saying \"no\" discards!) [y/n]? " msgstr "" There are six such changes, and they all make the context more understandable, as msgcat(1) is better at handling these edge cases than xgettext(1)'s previously used "--join-existing" flag. But filenames in the above disambiguation lines of extracted-comments have an extra ".po" extension compared to the filenames at the file locations. While we could rename the intermediate ".build/pot/po/%.po" files without the ".po" extension to use more intuitive filenames in the disambiguation lines of extracted-comments, but that will confuse developer tools with lots of invalid C or other source files in ".build/pot/po" directory. The addition of "--omit-header" option for xgettext makes the "pot" snippets in ".build/pot/po/*.po" smaller. But as we'll see in a subsequent commit this header behavior has been hiding an encoding-related bug from us, so let's carry it forward instead of re-generating it with xgettext(1). The "po/git.pot" file should have a header entry, because a proper header entry will increase the speed of creating a new po file using msginit and set a proper "POT-Creation-Date:" field in the header entry of a "po/XX.po" file. We use xgettext to generate a separate header file at ".build/pot/git.header" from "/dev/null", and use this header to assemble "po/git.pot". Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Jiang Xin --- .gitignore | 1 + Makefile | 80 ++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 60 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index e81de1063a..a452215764 100644 --- a/.gitignore +++ b/.gitignore @@ -200,6 +200,7 @@ *.[aos] *.o.json *.py[co] +.build/ .depend/ *.gcda *.gcno diff --git a/Makefile b/Makefile index f2f9c9bc81..49176822ad 100644 --- a/Makefile +++ b/Makefile @@ -569,6 +569,7 @@ INSTALL = install TCL_PATH = tclsh TCLTK_PATH = wish XGETTEXT = xgettext +MSGCAT = msgcat MSGFMT = msgfmt CURL_CONFIG = curl-config GCOV = gcov @@ -855,6 +856,7 @@ SOURCES_CMD = ( \ -o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \ -o \( -name contrib -type d -prune \) \ -o \( -name build -type d -prune \) \ + -o \( -name .build -type d -prune \) \ -o \( -name 'trash*' -type d -prune \) \ -o \( -name '*.[hcS]' -type f -print \) \ -o \( -name '*.sh' -type f -print \) \ @@ -2706,6 +2708,7 @@ XGETTEXT_FLAGS = \ --force-po \ --add-comments=TRANSLATORS: \ --msgid-bugs-address="Git Mailing List " \ + --package-name=Git \ --from-code=UTF-8 XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \ --keyword=_ --keyword=N_ --keyword="Q_:1,2" @@ -2724,34 +2727,68 @@ LOCALIZED_SH += t/t0200/test.sh LOCALIZED_PERL += t/t0200/test.perl endif -## Note that this is meant to be run only by the localization coordinator -## under a very controlled condition, i.e. (1) it is to be run in a -## Git repository (not a tarball extract), (2) any local modifications -## will be lost. +## We generate intermediate .build/pot/po/%.po files containing a +## extract of the translations we find in each file in the source +## tree. We will assemble them using msgcat to create the final +## "po/git.pot" file. +LOCALIZED_ALL_GEN_PO = + +LOCALIZED_C_GEN_PO = $(LOCALIZED_C:%=.build/pot/po/%.po) +LOCALIZED_ALL_GEN_PO += $(LOCALIZED_C_GEN_PO) + +LOCALIZED_SH_GEN_PO = $(LOCALIZED_SH:%=.build/pot/po/%.po) +LOCALIZED_ALL_GEN_PO += $(LOCALIZED_SH_GEN_PO) + +LOCALIZED_PERL_GEN_PO = $(LOCALIZED_PERL:%=.build/pot/po/%.po) +LOCALIZED_ALL_GEN_PO += $(LOCALIZED_PERL_GEN_PO) + ## Gettext tools cannot work with our own custom PRItime type, so ## we replace PRItime with PRIuMAX. We need to update this to ## PRIdMAX if we switch to a signed type later. +$(LOCALIZED_C_GEN_PO): .build/pot/po/%.po: % + $(call mkdir_p_parent_template) + $(QUIET_XGETTEXT) \ + if grep -q PRItime $<; then \ + (\ + sed -e 's|PRItime|PRIuMAX|g' <$< \ + >.build/pot/po/$< && \ + cd .build/pot/po && \ + $(XGETTEXT) --omit-header \ + -o $(@:.build/pot/po/%=%) \ + $(XGETTEXT_FLAGS_C) $< && \ + rm $<; \ + ); \ + else \ + $(XGETTEXT) --omit-header \ + -o $@ $(XGETTEXT_FLAGS_C) $<; \ + fi -po/git.pot: $(GENERATED_H) FORCE - # All modifications will be reverted at the end, so we do not - # want to have any local change. - git diff --quiet HEAD && git diff --quiet --cached +$(LOCALIZED_SH_GEN_PO): .build/pot/po/%.po: % + $(call mkdir_p_parent_template) + $(QUIET_XGETTEXT)$(XGETTEXT) --omit-header \ + -o$@ $(XGETTEXT_FLAGS_SH) $< - @for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \ - do \ - sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \ - cat "$$s+" >"$$s" && rm "$$s+"; \ - done +$(LOCALIZED_PERL_GEN_PO): .build/pot/po/%.po: % + $(call mkdir_p_parent_template) + $(QUIET_XGETTEXT)$(XGETTEXT) --omit-header \ + -o$@ $(XGETTEXT_FLAGS_PERL) $< + +define gen_pot_header +$(XGETTEXT) $(XGETTEXT_FLAGS_C) \ + -o - /dev/null | \ +sed -e 's|charset=CHARSET|charset=UTF-8|' \ + -e 's|\(Last-Translator: \)FULL NAME <.*>|\1make by the Makefile|' \ + -e 's|\(Language-Team: \)LANGUAGE <.*>|\1Git Mailing List |' \ + >$@ && \ +echo '"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n"' >>$@ +endef - $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C) - $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \ - $(LOCALIZED_SH) - $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \ - $(LOCALIZED_PERL) +.build/pot/git.header: $(LOCALIZED_ALL_GEN_PO) + $(call mkdir_p_parent_template) + $(QUIET_GEN)$(gen_pot_header) - # Reverting the munged source, leaving only the updated $@ - git reset --hard - mv $@+ $@ +po/git.pot: .build/pot/git.header $(LOCALIZED_ALL_GEN_PO) FORCE + $(QUIET_GEN)$(MSGCAT) $(filter-out FORCE,$^) >$@ .PHONY: pot pot: po/git.pot @@ -3290,6 +3327,7 @@ cocciclean: $(RM) contrib/coccinelle/*.cocci.patch* clean: profile-clean coverage-clean cocciclean + $(RM) -r .build $(RM) *.res $(RM) $(OBJECTS) $(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB) From patchwork Thu May 26 14:50:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiang Xin X-Patchwork-Id: 12862498 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B78C7C433FE for ; Thu, 26 May 2022 14:51:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347821AbiEZOvS (ORCPT ); Thu, 26 May 2022 10:51:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347844AbiEZOuq (ORCPT ); Thu, 26 May 2022 10:50:46 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83D2456FB8 for ; Thu, 26 May 2022 07:50:44 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id t28so1501024pga.6 for ; Thu, 26 May 2022 07:50:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rNh1K0IrCoKLiC64vnp3Wd4li3ZP35FqM4O6mSbQAxQ=; b=JVn7f+QEqLDSTJ2CMzLTq9nDieJF5SU7I/eTn7QbNuWVouGPriFUCl+CiYedLQJAXR iOIzWK5gsVZAKN3fIR8n123MkB1iYeqe007nJVTsGYRl/pb/u7Ssuu+NRw4xXy/RoY6p yCAhKviIav1dEUCHdBAFfrNWvkGDcZ91bpvTH3clnBOQYtnVfuiUZIvKChyvffN/nv3r uOrNli6extAuMGb2LzwxULuBkXn2IyYSOBpmvovTZ//0lmoz+Mz3R638JtqTxSzuaeVB t9qi79c8WuMG6CokGq43AczQbZj64qbMNynNmqX1V2nIOsv6v2n+673/QQAQEqqaYlSY 4L2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rNh1K0IrCoKLiC64vnp3Wd4li3ZP35FqM4O6mSbQAxQ=; b=1sfev48/C98nKmrArC5Zr9QRvdqD0Vci3beDjJfs5kOsC5qyVlk/y3LtdDfQr/fWb/ 00FJByFFI1wo5BqDgwPo/xgtBoXiSG9I0k0aztWTxuDjC2KuGbksRXrBpuGiXuauldRD sOBtc4+rumoZKGY6CVjfkBfX0hn4aTMz3DaYSHvthhZszqxW0fIYQJq4U79vUgocxz5v BhBVumDO5FPQaNw9T/f83D8fSOi5YGFlWg+hm+zsfIL9JXvwE/lc5LuE6W9lGUa4lT1G 6e1adhc4PniJ+tRl6OVlBhEllahidrNkaAq2e7EzVzdp+/VQcjPMTT5GEZfvY+ElG5f+ UH0A== X-Gm-Message-State: AOAM530F0cQ5bvBumRm4Pm/d7fN57U+PB9eh9OoJ6IVs5ncd8F1rlJpK qVlJ83qHeL72RlHVZPmVhJw= X-Google-Smtp-Source: ABdhPJxmOUqjMQ2Ao/0cXa7NvHevlVfdTLXsI3e6NcDkLOD9k+CK98aMQdS1iUYlTNDSUY2r/uCWcg== X-Received: by 2002:a63:8448:0:b0:3fa:cc62:d51f with SMTP id k69-20020a638448000000b003facc62d51fmr8820353pgd.417.1653576643946; Thu, 26 May 2022 07:50:43 -0700 (PDT) Received: from tigtog.localdomain.localdomain (144.34.163.219.16clouds.com. [144.34.163.219]) by smtp.gmail.com with ESMTPSA id i16-20020a056a00005000b00518382bceaesm1597480pfk.57.2022.05.26.07.50.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2022 07:50:43 -0700 (PDT) From: Jiang Xin To: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Junio C Hamano , Git List Cc: Alexander Shopov , Jordi Mas , =?utf-8?q?Matthias_R=C3=BCster?= , Jimmy Angelakos , =?utf-8?q?Christopher_D=C3=ADaz?= , =?utf-8?q?Jean-No=C3=ABl_Avila?= , Bagas Sanjaya , Alessandro Menti , Gwan-gyeong Mun , Arusekk , Daniel Santos , Dimitriy Ryazantcev , Peter Krefting , Emir SARI , =?utf-8?b?VHLhuqduIE5n4buNYyBRdcOibg==?= , Fangyi Zhou , Yi-Jyun Pan , Jiang Xin , Jiang Xin Subject: [PATCH v5 04/10] i18n CI: stop allowing non-ASCII source messages in po/git.pot Date: Thu, 26 May 2022 22:50:29 +0800 Message-Id: <20220526145035.18958-5-worldhello.net@gmail.com> X-Mailer: git-send-email 2.32.0.rc3 In-Reply-To: <20220523152128.26380-1-worldhello.net@gmail.com> References: <20220523152128.26380-1-worldhello.net@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Ævar Arnfjörð Bjarmason In the preceding commit we moved away from using xgettext(1) to both generate the po/git.pot, and to merge the incrementally generated po/git.pot+ file as we sourced translations from C, shell and Perl. Doing it this way, which dates back to my initial implementation[1][2][3] was conflating two things: With xgettext(1) the --from-code both controls what encoding is specified in the po/git.pot's header, and what encoding we allow in source messages. We don't ever want to allow non-ASCII in *source messages*, and doing so has hid e.g. a buggy message introduced in a6226fd772b (submodule--helper: convert the bulk of cmd_add() to C, 2021-08-10) from us, we'd warn about it before, but only when running "make pot", but the operation would still succeed. Now we'll error out on it when running "make pot". Since the preceding Makefile changes made this easy: let's add a "make check-pot" target with the same prerequisites as the "po/git.pot" target, but without changing the file "po/git.pot". Running it as part of the "static-analysis" CI target will ensure that we catch any such issues in the future. E.g.: $ make check-pot XGETTEXT .build/pot/po/builtin/submodule--helper.c.po xgettext: Non-ASCII string at builtin/submodule--helper.c:3381. Please specify the source encoding through --from-code. make: *** [.build/pot/po/builtin/submodule--helper.c.po] Error 1 1. cd5513a7168 (i18n: Makefile: "pot" target to extract messages marked for translation, 2011-02-22) 2. adc3b2b2767 (Makefile: add xgettext target for *.sh files, 2011-05-14) 3. 5e9637c6297 (i18n: add infrastructure for translating Git with gettext, 2011-11-18) Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Jiang Xin --- Makefile | 6 ++++-- builtin/submodule--helper.c | 2 +- ci/run-static-analysis.sh | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 49176822ad..72a3ddaed4 100644 --- a/Makefile +++ b/Makefile @@ -2708,8 +2708,7 @@ XGETTEXT_FLAGS = \ --force-po \ --add-comments=TRANSLATORS: \ --msgid-bugs-address="Git Mailing List " \ - --package-name=Git \ - --from-code=UTF-8 + --package-name=Git XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \ --keyword=_ --keyword=N_ --keyword="Q_:1,2" XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \ @@ -2793,6 +2792,9 @@ po/git.pot: .build/pot/git.header $(LOCALIZED_ALL_GEN_PO) FORCE .PHONY: pot pot: po/git.pot +.PHONY: check-pot +check-pot: $(LOCALIZED_ALL_GEN_PO) + ifdef NO_GETTEXT POFILES := MOFILES := diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 2c87ef9364..b97f02eed5 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -3378,7 +3378,7 @@ static int module_add(int argc, const char **argv, const char *prefix) N_("reference repository")), OPT_BOOL(0, "dissociate", &dissociate, N_("borrow the objects from reference repositories")), OPT_STRING(0, "name", &add_data.sm_name, N_("name"), - N_("sets the submodule’s name to the given string " + N_("sets the submodule's name to the given string " "instead of defaulting to its path")), OPT_INTEGER(0, "depth", &add_data.depth, N_("depth for shallow clones")), OPT_END() diff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh index 65bcebda41..0d51e5ce0e 100755 --- a/ci/run-static-analysis.sh +++ b/ci/run-static-analysis.sh @@ -29,4 +29,6 @@ fi make hdr-check || exit 1 +make check-pot + save_good_tree From patchwork Thu May 26 14:50:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Xin X-Patchwork-Id: 12862499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5129AC433F5 for ; Thu, 26 May 2022 14:51:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235601AbiEZOv1 (ORCPT ); Thu, 26 May 2022 10:51:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347842AbiEZOuq (ORCPT ); Thu, 26 May 2022 10:50:46 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ABE3CFE14 for ; Thu, 26 May 2022 07:50:45 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id x2-20020a17090a1f8200b001e07a64c461so4614443pja.4 for ; Thu, 26 May 2022 07:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m0ko1avpeqZg2FSS7TM0qMxohfSNsn/oRPauO+vpuqI=; b=covzC9mo6+6N3KU+HCoYII2QBPDrE/FMXfoVh9A7nx3oPq3x0yB3FIy/l49UX+kRIq E2ly6LgclSxSiU+UrsYaQO2Bb3clIEGJ18Hwjy5/FsK2Zxvsul4OaF65DGWvGBcWeO82 ZiXw5HWgkXga0Dp9zzoZYnAbkuwIJQDxgLR3kxJnwElwUCtdZ2+KVQpaoNeISWUIeX65 GJkqyReaDs6I0pLmtwRtNQU4gudf1Wr15We3lxOf3OSZj+kqWTLrOv9dgWJ4IJEb9vee QZoe3f2Viazu9MD/pfl/biyhgvJpskyI2xa1wLd4ywj5uTZSKc5m2pW7hxv2mQh5ovJv nJ/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m0ko1avpeqZg2FSS7TM0qMxohfSNsn/oRPauO+vpuqI=; b=kkv6A6A3oZzPY9GhM1iQkMXkmFJkbwJl85TrIHFIlywOcM9Cwv3aL31eKrw0r6Qav7 e9qgw/mrJLSh5BJSKsDjq6SlcfDqLXTg2i5K5XpuArtpdwZNGBYzOxQmQ+AUAgSbff83 PgpgWOcn0tkO/XArH1wMjOaeGOAgMCG2bgCmF/cuiMXuy91bdnZFuNiGe5VZ/M5gzrnA Nptvd4baSjd86rIHuNFy2KhCrZAib6BERGBsZuALxGx8rJ5NRI9sFtO5iubNR4Uqac9o v/UtQFmeCXtdfoqY03oBj7hGJMzt0TYj0VGYvZ2sqyer+k2UL2PHMTuknYa/n8OJ6rod TZQA== X-Gm-Message-State: AOAM532u7YFErYeC7Tcyxee8VtGZCRDU7kmc0l2b5WTft0/K/z2zUrPL JfVGT1ZldNFtBSgykGnxvkI= X-Google-Smtp-Source: ABdhPJyzYgY1jfsqLHHKoqODom6GGjiHxc6KfYG2FhYI+2uw2qr8gsgzEWBNtBeLxLJWHVmzoypJeg== X-Received: by 2002:a17:903:2302:b0:163:806b:b4a0 with SMTP id d2-20020a170903230200b00163806bb4a0mr2100478plh.160.1653576645164; Thu, 26 May 2022 07:50:45 -0700 (PDT) Received: from tigtog.localdomain.localdomain (144.34.163.219.16clouds.com. [144.34.163.219]) by smtp.gmail.com with ESMTPSA id i16-20020a056a00005000b00518382bceaesm1597480pfk.57.2022.05.26.07.50.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2022 07:50:44 -0700 (PDT) From: Jiang Xin To: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Junio C Hamano , Git List Cc: Jiang Xin , Alexander Shopov , Jordi Mas , =?utf-8?q?Matthias_R=C3=BCster?= , Jimmy Angelakos , =?utf-8?q?Christopher_D=C3=ADaz?= , =?utf-8?q?Jean-No=C3=ABl_Avila?= , Bagas Sanjaya , Alessandro Menti , Gwan-gyeong Mun , Arusekk , Daniel Santos , Dimitriy Ryazantcev , Peter Krefting , Emir SARI , =?utf-8?b?VHLhuqduIE5n4buNYyBRdcOibg==?= , Fangyi Zhou , Yi-Jyun Pan , Jiang Xin Subject: [PATCH v5 05/10] Makefile: remove duplicate and unwanted files in FOUND_SOURCE_FILES Date: Thu, 26 May 2022 22:50:30 +0800 Message-Id: <20220526145035.18958-6-worldhello.net@gmail.com> X-Mailer: git-send-email 2.32.0.rc3 In-Reply-To: <20220523152128.26380-1-worldhello.net@gmail.com> References: <20220523152128.26380-1-worldhello.net@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jiang Xin We get source files saved in "$(FOUND_SOURCE_FILES)" by running the command "git ls-files" or the command "find". We tried to have the both commands return the same list of files, but apparently the "find" command will return more files, such as the generated headers. We can filter out these generated headers to get closer results. In addition to this, "$(FOUND_SOURCE_FILES)" may contain duplicate files. E.g. "git-ls-files" may have duplicate entries for the same file in different staging areas if there are unresolved conflicts in the working tree. For this case, we can reduce duplicate entries by passing the option "--deduplicate" to git-ls-files. Junio reported that when running "make" in a working tree with unresolved conflicts, "make" may report warnings like below: Makefile:xxxx: target '.build/pot/po/FOO.c.po' given more than once in the same rule The duplicate targets are introduced by the following pattern rule we added in the preceding commit for incremental build of "po/git.pot". $(LOCALIZED_C_GEN_PO): .build/pot/po/%.po: % Although we have resolved this issue by sorting to create a unique $(LOCALIZED_C), other targets may benefit from this. Such as: tags, cscope.out, etc. Reported-by: Junio C Hamano Signed-off-by: Jiang Xin --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 72a3ddaed4..0cc397d214 100644 --- a/Makefile +++ b/Makefile @@ -845,7 +845,7 @@ generated-hdrs: $(GENERATED_H) ## Exhaustive lists of our source files, either dynamically generated, ## or hardcoded. SOURCES_CMD = ( \ - git ls-files \ + git ls-files --deduplicate \ '*.[hcS]' \ '*.sh' \ ':!*[tp][0-9][0-9][0-9][0-9]*' \ @@ -862,7 +862,7 @@ SOURCES_CMD = ( \ -o \( -name '*.sh' -type f -print \) \ | sed -e 's|^\./||' \ ) -FOUND_SOURCE_FILES := $(shell $(SOURCES_CMD)) +FOUND_SOURCE_FILES := $(filter-out $(GENERATED_H),$(shell $(SOURCES_CMD))) FOUND_C_SOURCES = $(filter %.c,$(FOUND_SOURCE_FILES)) FOUND_H_SOURCES = $(filter %.h,$(FOUND_SOURCE_FILES)) From patchwork Thu May 26 14:50:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiang Xin X-Patchwork-Id: 12862501 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CB5CC433EF for ; Thu, 26 May 2022 14:52:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347800AbiEZOvO (ORCPT ); Thu, 26 May 2022 10:51:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347850AbiEZOut (ORCPT ); Thu, 26 May 2022 10:50:49 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FE3B5DA04 for ; Thu, 26 May 2022 07:50:48 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id j21so1483670pga.13 for ; Thu, 26 May 2022 07:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bjgoNcSswCzdBzD+c9PEtXQswDpUmfFrTouBDVbw9PE=; b=p5xA67DlH6s9f0BfkdifwMD+IV0Guh0AnYRi9hSpEEoOEGuiahzo7cSSTHUnUoOdKW ppeAE+4Buk3Ze2x/tHrm/uU/wm4+HeI/ClWCSC839AnoNz3UkIiEpihRmpjkYezDj4Aj plCrgP9LRGPTTK19ryfmiFu4AQ6nA0GrFZIhYGALvl66JahamQty/9Nx84UCmrBTlbQP 0McYwXCpefonm9VB/SIPSCC2WOyVLsp4vvn9l9BJV3irtZaJZd3Qj2s/IerMVEvi8Zos 6p02SJULclcFFzvu/ibZ+5fE39xsTYO93nx0Qkkpngvos6MBSsJ5o7O1iPkz1edi+0ig BJmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bjgoNcSswCzdBzD+c9PEtXQswDpUmfFrTouBDVbw9PE=; b=wO4BVKa4RJS8lEYtw8EZ+49BAktQCnz7lopXIZLitp6R5mikQChIi8Y6EeY7AnWKtl rBtmGQjijIbt7AR1UPdey2e/35dind+l+B9SJc1mK747GsVTmw1Z0+rWCy0xNTo6D1y/ rBvzNUxwr0Idf25UZh5/x12wzm7TsfOzW5gPZ37Hm3wmGvvLmK23iU6aM6zRYaVk9VW2 1xQOPd+S5fXewPHW68grt4cBZxk2zuMy5Cf/JZ9qoD6ShR13N+w0XuzUlWT+YrdSwsqf R1xp/9NXTq+JSZmL5/oSDgM5wIBzvlCe3VW9nMBP5CCnyCBNvnyGk9NCw+wZw19/PHyp Mkpw== X-Gm-Message-State: AOAM530qGd81H4nzK+ZLV8CnP68MRDpR2tM4a0YXCnKyF67V3UiePt9L kaoRQVK5LjPE0pqoRG4AA/hrVxOnczxMcA== X-Google-Smtp-Source: ABdhPJwF8qcCR4dA2RGlVUiZ0+/WW++zQ8Hetbbw4vsKcIAN895FHCa7joRDjsi9tYssBPQ2sQs3nw== X-Received: by 2002:a63:91c8:0:b0:3fa:e410:735d with SMTP id l191-20020a6391c8000000b003fae410735dmr6700482pge.504.1653576647610; Thu, 26 May 2022 07:50:47 -0700 (PDT) Received: from tigtog.localdomain.localdomain (144.34.163.219.16clouds.com. [144.34.163.219]) by smtp.gmail.com with ESMTPSA id i16-20020a056a00005000b00518382bceaesm1597480pfk.57.2022.05.26.07.50.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2022 07:50:47 -0700 (PDT) From: Jiang Xin To: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Junio C Hamano , Git List Cc: Alexander Shopov , Jordi Mas , =?utf-8?q?Matthias_R=C3=BCster?= , Jimmy Angelakos , =?utf-8?q?Christopher_D=C3=ADaz?= , =?utf-8?q?Jean-No=C3=ABl_Avila?= , Bagas Sanjaya , Alessandro Menti , Gwan-gyeong Mun , Arusekk , Daniel Santos , Dimitriy Ryazantcev , Peter Krefting , Emir SARI , =?utf-8?b?VHLhuqduIE5n4buNYyBRdcOibg==?= , Fangyi Zhou , Yi-Jyun Pan , Jiang Xin , Jiang Xin Subject: [PATCH v5 07/10] po/git.pot: don't check in result of "make pot" Date: Thu, 26 May 2022 22:50:32 +0800 Message-Id: <20220526145035.18958-8-worldhello.net@gmail.com> X-Mailer: git-send-email 2.32.0.rc3 In-Reply-To: <20220523152128.26380-1-worldhello.net@gmail.com> References: <20220523152128.26380-1-worldhello.net@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Ævar Arnfjörð Bjarmason Remove the "po/git.pot" file from being tracked, which started with dce37b66fb0 (l10n: initial git.pot for 1.7.10 upcoming release, 2012-02-13). The reason the po/git.pot started being checked in was because the po/*.po files were changed a schema where we'd generate them from a known-good snapshot of po/git.pot, instead of each translator running "make pot" themselves. This makes sense, but we don't need to carry this file in-tree just to achieve that aim, and doing so has resulted in a significant amount of "diff churn" since this method of doing it was introduced: $ git log -p --oneline -- po/git.pot|wc -l 553743 We can instead let l10n contributors to generate "po/git.pot" in runtime to update their own "po/XX.po", and the l10n coordinator can check pull requests using CI pipeline. This reverts to the schema introduced initially in cd5513a7168 (i18n: Makefile: "pot" target to extract messages marked for translation, 2011-02-22). The actual "git rm" of po/git.pot was in preceding commit to make this change easier to review, and to preempt the mailing list from blocking it due to it being too large. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Jiang Xin --- Makefile | 5 +++-- po/.gitignore | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0cc397d214..cc3eb856b2 100644 --- a/Makefile +++ b/Makefile @@ -2786,8 +2786,8 @@ endef $(call mkdir_p_parent_template) $(QUIET_GEN)$(gen_pot_header) -po/git.pot: .build/pot/git.header $(LOCALIZED_ALL_GEN_PO) FORCE - $(QUIET_GEN)$(MSGCAT) $(filter-out FORCE,$^) >$@ +po/git.pot: .build/pot/git.header $(LOCALIZED_ALL_GEN_PO) + $(QUIET_GEN)$(MSGCAT) $^ >$@ .PHONY: pot pot: po/git.pot @@ -3330,6 +3330,7 @@ cocciclean: clean: profile-clean coverage-clean cocciclean $(RM) -r .build + $(RM) po/git.pot $(RM) *.res $(RM) $(OBJECTS) $(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB) diff --git a/po/.gitignore b/po/.gitignore index 796b96d1c4..37d1301b32 100644 --- a/po/.gitignore +++ b/po/.gitignore @@ -1 +1,2 @@ /build +/git.pot From patchwork Thu May 26 14:50:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Xin X-Patchwork-Id: 12862500 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BBDDC433F5 for ; Thu, 26 May 2022 14:52:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347802AbiEZOvP (ORCPT ); Thu, 26 May 2022 10:51:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347851AbiEZOuu (ORCPT ); Thu, 26 May 2022 10:50:50 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42BDC5003F for ; Thu, 26 May 2022 07:50:49 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id o10-20020a17090a4e8a00b001df2fcdc165so4644317pjh.0 for ; Thu, 26 May 2022 07:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P/DicxfJyrhdWtWJobVLtkTcCD+jEZ5GWfGfeF52Iro=; b=lusKASX6Gel8jVAzssGRR0v6mY1D+f6NNoi5Sf/PLb/ULKTe+7m/8Iq6m3m7xvNUiq AAOc9zOXwz2Lq4m67nlPL1R2u7XdaTTjYsTfTrUYysLkpKqtTh7c8+sbBVqxQ+HFVnMG W5WI98EpAC3EQf/EmpnLGJAXkawLCgRHPdpVXYNya8JV9pi5kLFS23oXLsbuE/w7Z9Fb UUcTn8R4mZeP9I6kpNF9HaZNewiEZvgpGMIdxeVRfZ1jvwEqc4MHUZA24I1hvLApLijA B5xKiFLyJ0xdtGijsXpFnH/HlQ0KaU4wuetT2K6wc8EXjeNIHZp16CH5/0jMeyZGLYco pb2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P/DicxfJyrhdWtWJobVLtkTcCD+jEZ5GWfGfeF52Iro=; b=3oxhN9v2IGhKWqEyGqHgEBJShNidLTWRGo68NQ+aaHYACrBS0yxkWbAmvfSDOwNspi U3pjlZrJ8k95J1eha+01cNOdlrd3QeNMkFFbfWxRlvBPYmcFb6ghbyMFSpjReFiSFzv7 AOMGxM4DAyN1mx7dfH3JCXezULxXD4GUAKR3KJPO1VbkSDmPpNKTjY4/XxGoqgOX37qa HjC4ZddViw5STV5O+rsmqA1dHBnD8WTCmqOenir4IBlOVKtLwCxLxXKEwJaNllcMhyBy mHCGkzpf/t8r5f4X52ImeoEpbMi4xPyLLjmXjTOkq5Bk9pwMaaYZJubUuuepM/9vsfyY K8qQ== X-Gm-Message-State: AOAM532X3CxvvgkWSioRt/NS1FC8XVq3bd4mnbfStxzmUC/ZRYw1prfK 2KCUUjazTfC6TAoc2OZqR6Y= X-Google-Smtp-Source: ABdhPJxQze/9tGzd7VtZtM2bBRiaTWi4xLBhT9RV153yf7alC93h60VeCVQpXGh6h3rEr4jxDt5Ung== X-Received: by 2002:a17:90a:e543:b0:1e0:8961:302d with SMTP id ei3-20020a17090ae54300b001e08961302dmr3052018pjb.129.1653576648825; Thu, 26 May 2022 07:50:48 -0700 (PDT) Received: from tigtog.localdomain.localdomain (144.34.163.219.16clouds.com. [144.34.163.219]) by smtp.gmail.com with ESMTPSA id i16-20020a056a00005000b00518382bceaesm1597480pfk.57.2022.05.26.07.50.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2022 07:50:48 -0700 (PDT) From: Jiang Xin To: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Junio C Hamano , Git List Cc: Jiang Xin , Alexander Shopov , Jordi Mas , =?utf-8?q?Matthias_R=C3=BCster?= , Jimmy Angelakos , =?utf-8?q?Christopher_D=C3=ADaz?= , =?utf-8?q?Jean-No=C3=ABl_Avila?= , Bagas Sanjaya , Alessandro Menti , Gwan-gyeong Mun , Arusekk , Daniel Santos , Dimitriy Ryazantcev , Peter Krefting , Emir SARI , =?utf-8?b?VHLhuqduIE5n4buNYyBRdcOibg==?= , Fangyi Zhou , Yi-Jyun Pan , Jiang Xin Subject: [PATCH v5 08/10] Makefile: add "po-update" rule to update po/XX.po Date: Thu, 26 May 2022 22:50:33 +0800 Message-Id: <20220526145035.18958-9-worldhello.net@gmail.com> X-Mailer: git-send-email 2.32.0.rc3 In-Reply-To: <20220523152128.26380-1-worldhello.net@gmail.com> References: <20220523152128.26380-1-worldhello.net@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jiang Xin Since there is no longer a "po/git.pot" file in tree, a l10n team leader has to run several commands to update their "po/XX.po" file: $ make pot $ msgmerge --add-location --backup=off -U po/XX.po po/git.pot To make this process easier, add a new rule so that l10n team leaders can update their "po/XX.po" with one command. E.g.: $ make po-update PO_FILE=po/zh_CN.po Signed-off-by: Jiang Xin --- Makefile | 18 ++++++++++++++++++ shared.mak | 1 + 2 files changed, 19 insertions(+) diff --git a/Makefile b/Makefile index cc3eb856b2..efd242b255 100644 --- a/Makefile +++ b/Makefile @@ -571,6 +571,7 @@ TCLTK_PATH = wish XGETTEXT = xgettext MSGCAT = msgcat MSGFMT = msgfmt +MSGMERGE = msgmerge CURL_CONFIG = curl-config GCOV = gcov STRIP = strip @@ -2715,6 +2716,7 @@ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \ --keyword=gettextln --keyword=eval_gettextln XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \ --keyword=__ --keyword=N__ --keyword="__n:1,2" +MSGMERGE_FLAGS = --add-location --backup=off --update LOCALIZED_C = $(sort $(FOUND_C_SOURCES) $(FOUND_H_SOURCES) $(SCALAR_SOURCES) \ $(GENERATED_H)) LOCALIZED_SH = $(sort $(SCRIPT_SH) git-sh-setup.sh) @@ -2792,6 +2794,22 @@ po/git.pot: .build/pot/git.header $(LOCALIZED_ALL_GEN_PO) .PHONY: pot pot: po/git.pot +define check_po_file_envvar + $(if $(PO_FILE), \ + $(if $(filter po/%.po,$(PO_FILE)), , \ + $(error PO_FILE should match pattern: "po/%.po")), \ + $(error PO_FILE is not defined)) +endef + +.PHONY: po-update +po-update: po/git.pot + $(check_po_file_envvar) + @if test ! -e $(PO_FILE); then \ + echo >&2 "error: $(PO_FILE) does not exist"; \ + exit 1; \ + fi + $(QUIET_MSGMERGE)$(MSGMERGE) $(MSGMERGE_FLAGS) $(PO_FILE) po/git.pot + .PHONY: check-pot check-pot: $(LOCALIZED_ALL_GEN_PO) diff --git a/shared.mak b/shared.mak index 50d4596f0d..8cd170a7e7 100644 --- a/shared.mak +++ b/shared.mak @@ -63,6 +63,7 @@ ifndef V QUIET_LNCP = @echo ' ' LN/CP $@; QUIET_XGETTEXT = @echo ' ' XGETTEXT $@; QUIET_MSGFMT = @echo ' ' MSGFMT $@; + QUIET_MSGMERGE = @echo ' ' MSGMERGE $@; QUIET_GCOV = @echo ' ' GCOV $@; QUIET_SP = @echo ' ' SP $<; QUIET_HDR = @echo ' ' HDR $(<:hcc=h); From patchwork Thu May 26 14:50:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiang Xin X-Patchwork-Id: 12862502 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05C17C433F5 for ; Thu, 26 May 2022 14:52:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244793AbiEZOvN (ORCPT ); Thu, 26 May 2022 10:51:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347853AbiEZOuv (ORCPT ); Thu, 26 May 2022 10:50:51 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 672105622D for ; Thu, 26 May 2022 07:50:50 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id n8so1642935plh.1 for ; Thu, 26 May 2022 07:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OUJiAPQx5PYv6Bh8Z475ByWZJAcSSKSrFJcMH+GNLRU=; b=lJK4fc8KLWdD48U7ac086qL2weHmMHs6fzq8IEidHgQYah4bvCAYQKH0MTymNfujPT ld4bdamRjhZiwE70a5xYdorx+AQUM8raFY8bmxIrBqmjT9h2My5SEY8W4BiaYMSDFgoL CBPaWnaLo9odS/ZMNrfbjB9G5W63oFwGCoZL/PRijm0QCEhDShpKCrUnnkd64+Q8vftE f1JD+1Wx0oh1BG0BAnzOwxT24ki0gQ7niYL55ptU1MFzsfOlhy591DsN3JYAzZtyupaq eKfaI9b2B8tVyOReliUiNpRZ7UCNxw9mKVg1dW7m5nHTIw15kYVVO4ibjYb6Tjf3QLr1 WS3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OUJiAPQx5PYv6Bh8Z475ByWZJAcSSKSrFJcMH+GNLRU=; b=ujprf+VjdD+/9s5Gsw60VluPLlRBegxXzE26ZKlOY8PIqG2+BM/6nrhAHbJn0kQnVa zFDWrdInzZ3bT5mzrAvTkFcqF5+93+cMI6RAOu2Yv52pFvyc3Pa3Cu4NH3r01+1JJHyz wMoWWySI2xKEByF2ARJ9C9XXH657LnZSfHMQlakwb1uLxbI5f8qhjFpD5Klzd8cUiyVa NjUds3ad5S3UpvNtkeWXo1GwrA1c1iXxIQeMkDsgiEY3hMk/pTMGfN2i8iWZyYebnw/S dLgVP4JXX9Z5D9lWSrSv+ABWwzu0bWsMEyqjPcxqnEsfmkUh0+ZgkANV7Isjly8CiVVd +qPQ== X-Gm-Message-State: AOAM530lzMByZMvqeR6AuFNnNy9k+baSyydRjxBpYjR65E8ikDNa9eH8 WQWTZ0wELNAcd4PKT967Pd0= X-Google-Smtp-Source: ABdhPJy6J9kOwgDkcSW5Kc80mNjYWJ0Pn+gm3a6ac5SjJ/hIsHoPZ+pdE0tuPKq1t6imDoFEiyvyxQ== X-Received: by 2002:a17:902:a9ca:b0:161:54a6:af3f with SMTP id b10-20020a170902a9ca00b0016154a6af3fmr39027098plr.48.1653576649951; Thu, 26 May 2022 07:50:49 -0700 (PDT) Received: from tigtog.localdomain.localdomain (144.34.163.219.16clouds.com. [144.34.163.219]) by smtp.gmail.com with ESMTPSA id i16-20020a056a00005000b00518382bceaesm1597480pfk.57.2022.05.26.07.50.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2022 07:50:49 -0700 (PDT) From: Jiang Xin To: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Junio C Hamano , Git List Cc: Alexander Shopov , Jordi Mas , =?utf-8?q?Matthias_R=C3=BCster?= , Jimmy Angelakos , =?utf-8?q?Christopher_D=C3=ADaz?= , =?utf-8?q?Jean-No=C3=ABl_Avila?= , Bagas Sanjaya , Alessandro Menti , Gwan-gyeong Mun , Arusekk , Daniel Santos , Dimitriy Ryazantcev , Peter Krefting , Emir SARI , =?utf-8?b?VHLhuqduIE5n4buNYyBRdcOibg==?= , Fangyi Zhou , Yi-Jyun Pan , Jiang Xin Subject: [PATCH v5 09/10] Makefile: add "po-init" rule to initialize po/XX.po Date: Thu, 26 May 2022 22:50:34 +0800 Message-Id: <20220526145035.18958-10-worldhello.net@gmail.com> X-Mailer: git-send-email 2.32.0.rc3 In-Reply-To: <20220523152128.26380-1-worldhello.net@gmail.com> References: <20220523152128.26380-1-worldhello.net@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Ævar Arnfjörð Bjarmason The core translation is the minimum set of work that must be done for a new language translation. There are over 5000 messages in the template message file "po/git.pot" that need to be translated. It is not a piece of cake for such a huge workload. So we used to define a small set of messages called "core translation" that a new l10n contributor must complete before sending pull request to the l10n coordinator. By pulling in some parts of the git-po-helper[^1] logic, we add a new rule to create this core translation message "po/git-core.pot": make po/git-core.pot To help new l10n contributors to initialized their "po/XX.pot" from "po/git-core.pot", we also add new rules "po-init": make po-init PO_FILE=po/XX.po [^1]: https://github.com/git-l10n/git-po-helper/ Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 40 +++++++++++++++++++++++++++++++++++++++- po/.gitignore | 1 + shared.mak | 1 + 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index efd242b255..0a5b4b4ede 100644 --- a/Makefile +++ b/Makefile @@ -2806,6 +2806,7 @@ po-update: po/git.pot $(check_po_file_envvar) @if test ! -e $(PO_FILE); then \ echo >&2 "error: $(PO_FILE) does not exist"; \ + echo >&2 'To create an initial po file, use: "make po-init PO_FILE=po/XX.po"'; \ exit 1; \ fi $(QUIET_MSGMERGE)$(MSGMERGE) $(MSGMERGE_FLAGS) $(PO_FILE) po/git.pot @@ -2813,6 +2814,43 @@ po-update: po/git.pot .PHONY: check-pot check-pot: $(LOCALIZED_ALL_GEN_PO) +### TODO FIXME: Translating everything in these files is a bad +### heuristic for "core", as we'll translate obscure error() messages +### along with commonly seen i18n messages. A better heuristic would +### be to e.g. use spatch to first remove error/die/warning +### etc. messages. +LOCALIZED_C_CORE = +LOCALIZED_C_CORE += builtin/checkout.c +LOCALIZED_C_CORE += builtin/clone.c +LOCALIZED_C_CORE += builtin/index-pack.c +LOCALIZED_C_CORE += builtin/push.c +LOCALIZED_C_CORE += builtin/reset.c +LOCALIZED_C_CORE += remote.c +LOCALIZED_C_CORE += wt-status.c + +LOCALIZED_C_CORE_GEN_PO = $(LOCALIZED_C_CORE:%=.build/pot/po/%.po) + +.build/pot/git-core.header: $(LOCALIZED_C_CORE_GEN_PO) + $(call mkdir_p_parent_template) + $(QUIET_GEN)$(gen_pot_header) + +po/git-core.pot: .build/pot/git-core.header $(LOCALIZED_C_CORE_GEN_PO) + $(QUIET_GEN)$(MSGCAT) $^ >$@ + +.PHONY: po-init +po-init: po/git-core.pot + $(check_po_file_envvar) + @if test -e $(PO_FILE); then \ + echo >&2 "error: $(PO_FILE) exists already"; \ + exit 1; \ + fi + $(QUIET_MSGINIT)msginit \ + --input=$< \ + --output=$(PO_FILE) \ + --no-translator \ + --locale=$(PO_FILE:po/%.po=%) + +## po/*.po files & their rules ifdef NO_GETTEXT POFILES := MOFILES := @@ -3348,7 +3386,7 @@ cocciclean: clean: profile-clean coverage-clean cocciclean $(RM) -r .build - $(RM) po/git.pot + $(RM) po/git.pot po/git-core.pot $(RM) *.res $(RM) $(OBJECTS) $(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB) diff --git a/po/.gitignore b/po/.gitignore index 37d1301b32..ff0e5176a6 100644 --- a/po/.gitignore +++ b/po/.gitignore @@ -1,2 +1,3 @@ /build /git.pot +/git-core.pot diff --git a/shared.mak b/shared.mak index 8cd170a7e7..4330192e9c 100644 --- a/shared.mak +++ b/shared.mak @@ -62,6 +62,7 @@ ifndef V QUIET_BUILT_IN = @echo ' ' BUILTIN $@; QUIET_LNCP = @echo ' ' LN/CP $@; QUIET_XGETTEXT = @echo ' ' XGETTEXT $@; + QUIET_MSGINIT = @echo ' ' MSGINIT $@; QUIET_MSGFMT = @echo ' ' MSGFMT $@; QUIET_MSGMERGE = @echo ' ' MSGMERGE $@; QUIET_GCOV = @echo ' ' GCOV $@; From patchwork Thu May 26 14:50:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiang Xin X-Patchwork-Id: 12862497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BA01C433EF for ; Thu, 26 May 2022 14:51:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346384AbiEZOvG (ORCPT ); Thu, 26 May 2022 10:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347858AbiEZOux (ORCPT ); Thu, 26 May 2022 10:50:53 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC3995622D for ; Thu, 26 May 2022 07:50:51 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id w2-20020a17090ac98200b001e0519fe5a8so1888707pjt.4 for ; Thu, 26 May 2022 07:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hXZSYY2KaqV0r0lX1jjSzMnzlS1Dq5mFLVufnMfOnPE=; b=j5qzKQVHmnkX9MLD1n6PKW6/fOlXjHE3s1nYqQtuoZO0W4vhxR55FBNgVz3BP4Gzgb YZD6PlBqCGdcjnU/MKrLPAIIhb5WAHsbD/IFbxZ6VZS6T45akP22u+k4mMp4VOs/uL9+ qqPHqyIBFQybfidfV8kzBefZm+egOJayiahQYqdANKLqEesz08H887gnOklNdfCMyDVj BVYiUe2u69+qzpbt+JWth9O7S8pWaoccfhBBEhCUXxxS/rS0ZE9KqhAo6sblIshG9l/r 13fNsVRLSgP79djLBNRgXp4Jdc7YV9jDXy4P6KhicCbOoMNccQEgaKOONLaYeoGAZgAT b9dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hXZSYY2KaqV0r0lX1jjSzMnzlS1Dq5mFLVufnMfOnPE=; b=nvS0qJEDU7u4/J7yVIaQa5X6y3BgEotoZwLt5E9k/6SM4eWDdlzkb9IqLpwfGe8JCw lOaiQeXlH7gnhkLf3AQSGyD3s/kwhAv4Oo40/2mqYVZ7qt/nqnLsM6LsIFvfx5uWyJzt xvtz1OmC+OeSb62oIuIPJTbLAIuQuuUtd4fmwsfkBw26h6E6uXZY/41fJ7pAQ4gX2QVu nbljLCnXmxXHHiFeeRWFPrecY8Oxbg+cRYL85PaUTgc2rQqtILtcIFwc1OkaqI5CsO2M 42B7NCIhdECSSoTJHRaCDLgZQmHTSsRDNxAp+1CKgP0isaJsRaxumHNG651DmW0AWRcW cI6A== X-Gm-Message-State: AOAM5305lLyi25hmR66gvfnYU17JdW+S4pDkhTWlMZs19VYjn/8lIe34 7RwXi4edOynvAu0cJi64YWE= X-Google-Smtp-Source: ABdhPJzyQ8i2t7Rial1ndrYKTOsdzSr8eZBR4xf2ib5X9myiaXJktkb9rBNR4C4bKlhKUFUkxJ84tw== X-Received: by 2002:a17:902:f789:b0:156:5f56:ddff with SMTP id q9-20020a170902f78900b001565f56ddffmr38088332pln.116.1653576651153; Thu, 26 May 2022 07:50:51 -0700 (PDT) Received: from tigtog.localdomain.localdomain (144.34.163.219.16clouds.com. [144.34.163.219]) by smtp.gmail.com with ESMTPSA id i16-20020a056a00005000b00518382bceaesm1597480pfk.57.2022.05.26.07.50.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2022 07:50:50 -0700 (PDT) From: Jiang Xin To: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Junio C Hamano , Git List Cc: Alexander Shopov , Jordi Mas , =?utf-8?q?Matthias_R=C3=BCster?= , Jimmy Angelakos , =?utf-8?q?Christopher_D=C3=ADaz?= , =?utf-8?q?Jean-No=C3=ABl_Avila?= , Bagas Sanjaya , Alessandro Menti , Gwan-gyeong Mun , Arusekk , Daniel Santos , Dimitriy Ryazantcev , Peter Krefting , Emir SARI , =?utf-8?b?VHLhuqduIE5n4buNYyBRdcOibg==?= , Fangyi Zhou , Yi-Jyun Pan , Jiang Xin , Jiang Xin Subject: [PATCH v5 10/10] l10n: Document the new l10n workflow Date: Thu, 26 May 2022 22:50:35 +0800 Message-Id: <20220526145035.18958-11-worldhello.net@gmail.com> X-Mailer: git-send-email 2.32.0.rc3 In-Reply-To: <20220523152128.26380-1-worldhello.net@gmail.com> References: <20220523152128.26380-1-worldhello.net@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Ævar Arnfjörð Bjarmason Change the "flow" of how translators interact with the l10n repository at [1] to adjust it for a new workflow of not having a po/git.pot file in-tree at all, and to not commit line numbers to the po/*.po files that we do track in tree. The current workflow was added in a combination of dce37b66fb0 (l10n: initial git.pot for 1.7.10 upcoming release, 2012-02-13) and 271ce198cd0 (Update l10n guide, 2012-02-29). As noted in preceding commits I think that it came about due to technical debt I'd left behind in how the "po/git.pot" file was created, and a mis-impression that the file:line comments were needed as anything more than a transitory translation aid. As the updated po/README.md shows the new workflow is substantially the same, the difference is that translators no longer need to initially pull from the l10n coordinator for a new po/git.pot, they can simply use git.git's canonical source repository. The l10n coordinator is still expected to announce a release to translate, which presumably would always be Junio's latest release tag. I'm not certain if this part of the process is actually important. I.e. the delta translation-wise between that tag and "master" is usually pretty small, so perhaps translators can just work on "master" instead. 1. https://github.com/git-l10n/git-po/ Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Jiang Xin --- po/README.md | 230 ++++++++++++++++++++++++++------------------------- 1 file changed, 117 insertions(+), 113 deletions(-) diff --git a/po/README.md b/po/README.md index 19fabb4acf..74856ca5bf 100644 --- a/po/README.md +++ b/po/README.md @@ -9,8 +9,14 @@ coordinates our localization effort in the l10 coordinator repository: https://github.com/git-l10n/git-po/ -The two character language translation codes are defined by ISO\_639-1, as -stated in the gettext(1) full manual, appendix A.1, Usual Language Codes. +We will use XX as an alias to refer to the language translation code in +the following paragraphs, for example we use "po/XX.po" to refer to the +translation file for a specific language. But this doesn't mean that +the language code has only two letters. The language code can be in one +of two forms: "ll" or "ll\_CC". Here "ll" is the ISO 639 two-letter +language code and "CC" is the ISO 3166 two-letter code for country names +and subdivisions. For example: "de" for German language code, "zh\_CN" +for Simplified Chinese language code. ## Contributing to an existing translation @@ -39,72 +45,74 @@ language, so that the l10n coordinator only needs to interact with one person per language. -## Core translation +## Translation Process Flow -The core translation is the smallest set of work that must be completed -for a new language translation. Because there are more than 5000 messages -in the template message file "po/git.pot" that need to be translated, -this is not a piece of cake for the contributor for a new language. +The overall data-flow looks like this: -The core template message file which contains a small set of messages -will be generated in "po-core/core.pot" automatically by running a helper -program named "git-po-helper" (described later). + +-------------------+ +------------------+ + | Git source code | ----(2)---> | L10n coordinator | + | repository | <---(5)---- | repository | + +-------------------+ +------------------+ + | | ^ + (1) (3) (4) + V v | + +----------------------------------+ + | Language Team XX | + +----------------------------------+ -```shell -git-po-helper init --core XX.po -``` +- Translatable strings are marked in the source file. +- Language teams can start translation iterations at any time, even + before the l10n window opens: -After translating the generated "po-core/XX.po", you can merge it to -"po/XX.po" using the following commands: + + Pull from the master branch of the source (1) + + Update the message file by running "make po-update PO\_FILE=po/XX.po" + + Translate the message file "po/XX.po" -```shell -msgcat po-core/XX.po po/XX.po -s -o /tmp/XX.po -mv /tmp/XX.po po/XX.po -git-po-helper update XX.po -``` +- The L10n coordinator pulls from source and announces the l10n window + open (2) +- Language team pulls from the l10n coordinator, starts another + translation iteration against the l10n coordinator's tree (3) -Edit "po/XX.po" by hand to fix "fuzzy" messages, which may have misplaced -translated messages and duplicate messages. + + Run "git pull --rebase" from the l10n coordinator + + Update the message file by running "make po-update PO\_FILE=po/XX.po" + + Translate the message file "po/XX.po" + + Squash trivial l10n git commits using "git rebase -i" +- Language team sends pull request to the l10n coordinator (4) +- L10n coordinator checks and merges +- L10n coordinator asks the result to be pulled (5). -## Translation Process Flow -The overall data-flow looks like this: +## Dynamically generated POT files - +-------------------+ +------------------+ - | Git source code | ---(1)---> | L10n coordinator | - | repository | <---(4)--- | repository | - +-------------------+ +------------------+ - | ^ - (2) (3) - V | - +------------------+ - | Language Team XX | - +------------------+ +POT files are templates for l10n contributors to create or update their +translation files. We used to have the "po/git.pot" file which was +generated by the l10n coordinator, but this file had been removed from +the tree. -- Translatable strings are marked in the source file. -- L10n coordinator pulls from the source (1) -- L10n coordinator updates the message template "po/git.pot" -- Language team pulls from L10n coordinator (2) -- Language team updates the message file "po/XX.po" -- L10n coordinator pulls from Language team (3) -- L10n coordinator asks the result to be pulled (4). +The two POT files "po/git.pot" and "po/git-core.pot" can be created +dynamically when necessary. +L10n contributors use "po/git.pot" to prepare translations for their +languages, but they are not expected to modify it. The "po/git.pot" file +can be generated manually with the following command: -## Maintaining the "po/git.pot" file +```shell +make po/git.pot +``` -(This is done by the l10n coordinator). +The "po/git-core.pot" file is the template for core translations. A core +translation is the minimum set of work necessary to complete a +translation of a new language. Since there are more than 5000 messages +in the full set of template message file "po/git.pot" that need to be +translated, this is not a piece of cake for new language contributors. -The "po/git.pot" file contains a message catalog extracted from Git's -sources. The l10n coordinator maintains it by adding new translations with -msginit(1), or update existing ones with msgmerge(1). In order to update -the Git sources to extract the messages from, the l10n coordinator is -expected to pull from the main git repository at strategic point in -history (e.g. when a major release and release candidates are tagged), -and then run "make pot" at the top-level directory. +The "core" template file "po/git-core.pot" can be generated manually +by running: -Language contributors use this file to prepare translations for their -language, but they are not expected to modify it. +```shell +make po/git-core.pot +``` ## Initializing a "XX.po" file @@ -115,32 +123,14 @@ If your language XX does not have translated message file "po/XX.po" yet, you add a translation for the first time by running: ```shell -msginit --locale=XX +make po-init PO_FILE=po/XX.po ``` -in the "po/" directory, where XX is the locale, e.g. "de", "is", "pt\_BR", -"zh\_CN", etc. - -Then edit the automatically generated copyright info in your new "XX.po" -to be correct, e.g. for Icelandic: - -```diff -@@ -1,6 +1,6 @@ --# Icelandic translations for PACKAGE package. --# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER --# This file is distributed under the same license as the PACKAGE package. -+# Icelandic translations for Git. -+# Copyright (C) 2010 Ævar Arnfjörð Bjarmason -+# This file is distributed under the same license as the Git package. - # Ævar Arnfjörð Bjarmason , 2010. -``` - -And change references to PACKAGE VERSION in the PO Header Entry to -just "Git": +where XX is the locale, e.g. "de", "is", "pt\_BR", "zh\_CN", etc. -```shell -perl -pi -e 's/(?<="Project-Id-Version: )PACKAGE VERSION/Git/' XX.po -``` +The newly generated message file "po/XX.po" is based on the core pot +file "po/git-core.pot", so it contains only a minimal set of messages +and it's a good start for a new language contribution. Once you are done testing the translation (see below), commit the result and ask the l10n coordinator to pull from you. @@ -153,19 +143,53 @@ and ask the l10n coordinator to pull from you. If you are replacing translation strings in an existing "XX.po" file to improve the translation, just edit the file. -If there's an existing "XX.po" file for your language, but the repository -of the l10n coordinator has newer "po/git.pot" file, you would need to first -pull from the l10n coordinator (see the beginning of this document for its -URL), and then update the existing translation by running: +If you want to find new translatable strings in source files of upstream +repository and propagate them to your "po/XX.po", run command: ```shell -msgmerge --add-location --backup=off -U XX.po git.pot +make po-update PO_FILE=po/XX.po ``` -in the "po/" directory, where "XX.po" is the file you want to update. +It will: -Once you are done testing the translation (see below), commit the result -and ask the l10n coordinator to pull from you. +- Call "make po/git.pot" to generate new "po/git.pot" file +- Call "msgmerge --add-location --backup=off -U po/XX.po po/git.pot" + to update your "po/XX.po" +- The "--add-location" option for msgmerge will add location lines, + and these location lines will help translation tools to locate + translation context easily. + +Once you are done testing the translation (see below), it's better +to commit a location-less "po/XX.po" file to save repository space +and make a user-friendly patch for review. + +To save a location-less "po/XX.po" automatically in repository, you +can: + +First define a new attribute for "po/XX.po" by appending the following +line in ".git/info/attributes": + +``` +/po/XX.po filter=gettext-no-location +``` + +Then define the driver for the "gettext-no-location" clean filter to +strip out both filenames and locations from the contents as follows: + +```shell +git config --global filter.gettext-no-location.clean \ + "msgcat --no-location -" +``` + +For users who have gettext version 0.20 or higher, it is also possible +to define a clean filter to preserve filenames but not locations: + +```shell +git config --global filter.gettext-no-location.clean \ + "msgcat --add-location=file -" +``` + +You're now ready to ask the l10n coordinator to pull from you. ## Fuzzy translation @@ -196,6 +220,14 @@ common errors, e.g. missing printf format strings, or translated messages that deviate from the originals in whether they begin/end with a newline or not. +L10n coordinator will check your contributions using a helper program +(see "PO helper" section below): + +```shell +git-po-helper check-po po/XX.po +git-po-helper check-commits +``` + ## Marking strings for translation @@ -370,29 +402,6 @@ l10n workflow. To build and install the helper program from source, see [git-po-helper/README][]. -Usage for git-po-helper: - -- To start a new language translation: - - ```shell - git-po-helper init XX.po - ``` - -- To update your "XX.po" file: - - ```shell - git-po-helper update XX.po - ``` - -- To check commit log and syntax of "XX.po": - - ```shell - git-po-helper check-po XX.po - git-po-helper check-commits - ``` - -Run "git-po-helper" without arguments to show usage. - ## Conventions @@ -436,13 +445,8 @@ additional conventions: - Initialize proper filename of the "XX.po" file conforming to iso-639 and iso-3166. -- Must complete a minimal translation based on the "po-core/core.pot" - template. Using the following command to initialize the minimal - "po-core/XX.po" file: - - ```shell - git-po-helper init --core - ``` +- Must complete a minimal translation based on the "Core + translation". See that section above. - Add a new entry in the "po/TEAMS" file with proper format, and check the syntax of "po/TEAMS" by running the following command: