This possible change was alluded to in the meson thread at [0].

The proposal is to move the list of available languages from nls.mk into a separate file called po/LINGUAS. Advantages:

- It keeps the parts notionally managed by programmers (nls.mk)
  separate from the parts notionally managed by translators (LINGUAS).

- It's the standard practice recommended by the Gettext manual
  nowadays.

- The Meson build system also supports this layout (and of course
  doesn't know anything about our custom nls.mk), so this would enable
  sharing the list of languages between the two build systems.

(The MSVC build system currently finds all po files by globbing, so it is not affected by this change.)

In practice, the list of languages is updated mostly by means of the cp-po script that I use to update the translations before releases [1], and I have a small patch ready for that to adapt to this change. (In any case, that wouldn't be needed until the beta of PG16.)


[0]: https://www.postgresql.org/message-id/bfcd5353-0fb3-a05c-6f62-164d98c56...@enterprisedb.com

[1]: https://git.postgresql.org/gitweb/?p=pgtranslation/admin.git;a=blob;f=cp-po;h=d4ae9285697ba110228b6e01c8339b1d0f8c3458;hb=HEAD
From 6191a75c8d56cd524c505b371cb82705b676f026 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 22 Jun 2022 12:38:29 +0200
Subject: [PATCH] NLS: Put list of available languages into LINGUAS files

This moves the list of available languages from nls.mk into a separate
file called po/LINGUAS.  Advantages:

- It keeps the parts notionally managed by programmers (nls.mk)
  separate from the parts notionally managed by translators (LINGUAS).

- It's the standard practice recommended by the Gettext manual
  nowadays.

- The Meson build system also supports this layout (and of course
  doesn't know anything about our custom nls.mk), so this would enable
  sharing the list of languages between the two build systems.

(The MSVC build system currently finds all po files by globbing, so it
is not affected by this change.)
---
 doc/src/sgml/nls.sgml                  | 23 ++++++++++-------------
 src/backend/nls.mk                     |  1 -
 src/backend/po/LINGUAS                 |  1 +
 src/bin/initdb/nls.mk                  |  1 -
 src/bin/initdb/po/LINGUAS              |  1 +
 src/bin/pg_amcheck/nls.mk              |  1 -
 src/bin/pg_amcheck/po/LINGUAS          |  1 +
 src/bin/pg_archivecleanup/nls.mk       |  1 -
 src/bin/pg_archivecleanup/po/LINGUAS   |  1 +
 src/bin/pg_basebackup/nls.mk           |  1 -
 src/bin/pg_basebackup/po/LINGUAS       |  1 +
 src/bin/pg_checksums/nls.mk            |  1 -
 src/bin/pg_checksums/po/LINGUAS        |  1 +
 src/bin/pg_config/nls.mk               |  1 -
 src/bin/pg_config/po/LINGUAS           |  1 +
 src/bin/pg_controldata/nls.mk          |  1 -
 src/bin/pg_controldata/po/LINGUAS      |  1 +
 src/bin/pg_ctl/nls.mk                  |  1 -
 src/bin/pg_ctl/po/LINGUAS              |  1 +
 src/bin/pg_dump/nls.mk                 |  1 -
 src/bin/pg_dump/po/LINGUAS             |  1 +
 src/bin/pg_resetwal/nls.mk             |  1 -
 src/bin/pg_resetwal/po/LINGUAS         |  1 +
 src/bin/pg_rewind/nls.mk               |  1 -
 src/bin/pg_rewind/po/LINGUAS           |  1 +
 src/bin/pg_test_fsync/nls.mk           |  1 -
 src/bin/pg_test_fsync/po/LINGUAS       |  1 +
 src/bin/pg_test_timing/nls.mk          |  1 -
 src/bin/pg_test_timing/po/LINGUAS      |  1 +
 src/bin/pg_upgrade/nls.mk              |  1 -
 src/bin/pg_upgrade/po/LINGUAS          |  1 +
 src/bin/pg_verifybackup/nls.mk         |  1 -
 src/bin/pg_verifybackup/po/LINGUAS     |  1 +
 src/bin/pg_waldump/nls.mk              |  1 -
 src/bin/pg_waldump/po/LINGUAS          |  1 +
 src/bin/psql/nls.mk                    |  1 -
 src/bin/psql/po/LINGUAS                |  1 +
 src/bin/scripts/nls.mk                 |  1 -
 src/bin/scripts/po/LINGUAS             |  1 +
 src/interfaces/ecpg/ecpglib/nls.mk     |  1 -
 src/interfaces/ecpg/ecpglib/po/LINGUAS |  1 +
 src/interfaces/ecpg/preproc/nls.mk     |  1 -
 src/interfaces/ecpg/preproc/po/LINGUAS |  1 +
 src/interfaces/libpq/nls.mk            |  1 -
 src/interfaces/libpq/po/LINGUAS        |  1 +
 src/nls-global.mk                      |  6 +++++-
 src/pl/plperl/nls.mk                   |  1 -
 src/pl/plperl/po/LINGUAS               |  1 +
 src/pl/plpgsql/src/nls.mk              |  1 -
 src/pl/plpgsql/src/po/LINGUAS          |  1 +
 src/pl/plpython/nls.mk                 |  1 -
 src/pl/plpython/po/LINGUAS             |  1 +
 src/pl/tcl/nls.mk                      |  1 -
 src/pl/tcl/po/LINGUAS                  |  1 +
 54 files changed, 41 insertions(+), 40 deletions(-)
 create mode 100644 src/backend/po/LINGUAS
 create mode 100644 src/bin/initdb/po/LINGUAS
 create mode 100644 src/bin/pg_amcheck/po/LINGUAS
 create mode 100644 src/bin/pg_archivecleanup/po/LINGUAS
 create mode 100644 src/bin/pg_basebackup/po/LINGUAS
 create mode 100644 src/bin/pg_checksums/po/LINGUAS
 create mode 100644 src/bin/pg_config/po/LINGUAS
 create mode 100644 src/bin/pg_controldata/po/LINGUAS
 create mode 100644 src/bin/pg_ctl/po/LINGUAS
 create mode 100644 src/bin/pg_dump/po/LINGUAS
 create mode 100644 src/bin/pg_resetwal/po/LINGUAS
 create mode 100644 src/bin/pg_rewind/po/LINGUAS
 create mode 100644 src/bin/pg_test_fsync/po/LINGUAS
 create mode 100644 src/bin/pg_test_timing/po/LINGUAS
 create mode 100644 src/bin/pg_upgrade/po/LINGUAS
 create mode 100644 src/bin/pg_verifybackup/po/LINGUAS
 create mode 100644 src/bin/pg_waldump/po/LINGUAS
 create mode 100644 src/bin/psql/po/LINGUAS
 create mode 100644 src/bin/scripts/po/LINGUAS
 create mode 100644 src/interfaces/ecpg/ecpglib/po/LINGUAS
 create mode 100644 src/interfaces/ecpg/preproc/po/LINGUAS
 create mode 100644 src/interfaces/libpq/po/LINGUAS
 create mode 100644 src/pl/plperl/po/LINGUAS
 create mode 100644 src/pl/plpgsql/src/po/LINGUAS
 create mode 100644 src/pl/plpython/po/LINGUAS
 create mode 100644 src/pl/tcl/po/LINGUAS

diff --git a/doc/src/sgml/nls.sgml b/doc/src/sgml/nls.sgml
index d49f44f3f2..4b683458f9 100644
--- a/doc/src/sgml/nls.sgml
+++ b/doc/src/sgml/nls.sgml
@@ -175,10 +175,11 @@ <title>Creating and Maintaining Message Catalogs</title>
     Copy this file to
     <filename><replaceable>language</replaceable>.po</filename> and
     edit it.  To make it known that the new language is available,
-    also edit the file <filename>nls.mk</filename> and add the
-    language (or language and country) code to the line that looks like:
+    also edit the file <filename>po/LINGUAS</filename> and add the
+    language (or language and country) code next to languages already listed,
+    like:
 <programlisting>
-AVAIL_LANGUAGES := de fr
+de fr
 </programlisting>
     (Other languages can appear, of course.)
    </para>
@@ -375,16 +376,6 @@ <title>Adding NLS Support to a Program</title>
        </listitem>
       </varlistentry>
 
-      <varlistentry>
-       <term><varname>AVAIL_LANGUAGES</varname></term>
-
-       <listitem>
-        <para>
-         List of provided translations &mdash; initially empty.
-        </para>
-       </listitem>
-      </varlistentry>
-
       <varlistentry>
        <term><varname>GETTEXT_FILES</varname></term>
 
@@ -424,6 +415,12 @@ <title>Adding NLS Support to a Program</title>
     </para>
    </step>
 
+   <step>
+    <para>
+     Add a file <filename>po/LINGUAS</filename>, which will contain the list
+     of provided translations &mdash; initially empty.
+    </para>
+   </step>
   </procedure>
 
   <para>
diff --git a/src/backend/nls.mk b/src/backend/nls.mk
index 355299804f..c31339be31 100644
--- a/src/backend/nls.mk
+++ b/src/backend/nls.mk
@@ -1,6 +1,5 @@
 # src/backend/nls.mk
 CATALOG_NAME     = postgres
-AVAIL_LANGUAGES  = de es fr id it ja ko pl pt_BR ru sv tr uk zh_CN
 GETTEXT_FILES    = + gettext-files
 GETTEXT_TRIGGERS = $(BACKEND_COMMON_GETTEXT_TRIGGERS) \
     GUC_check_errmsg \
diff --git a/src/backend/po/LINGUAS b/src/backend/po/LINGUAS
new file mode 100644
index 0000000000..a27ddd5cea
--- /dev/null
+++ b/src/backend/po/LINGUAS
@@ -0,0 +1 @@
+de es fr id it ja ko pl pt_BR ru sv tr uk zh_CN
diff --git a/src/bin/initdb/nls.mk b/src/bin/initdb/nls.mk
index fe7bdfc04a..19c9136849 100644
--- a/src/bin/initdb/nls.mk
+++ b/src/bin/initdb/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/initdb/nls.mk
 CATALOG_NAME     = initdb
-AVAIL_LANGUAGES  = cs de el es fr he it ja ko pl pt_BR ru sv tr uk vi zh_CN
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) findtimezone.c initdb.c 
../../common/exec.c ../../common/fe_memutils.c ../../common/file_utils.c 
../../common/pgfnames.c ../../common/restricted_token.c ../../common/rmtree.c 
../../common/username.c ../../common/wait_error.c ../../port/dirmod.c
 GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS) simple_prompt
 GETTEXT_FLAGS    = $(FRONTEND_COMMON_GETTEXT_FLAGS)
diff --git a/src/bin/initdb/po/LINGUAS b/src/bin/initdb/po/LINGUAS
new file mode 100644
index 0000000000..3a24184a0e
--- /dev/null
+++ b/src/bin/initdb/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr he it ja ko pl pt_BR ru sv tr uk vi zh_CN
diff --git a/src/bin/pg_amcheck/nls.mk b/src/bin/pg_amcheck/nls.mk
index 0813fe1cec..5e6171952c 100644
--- a/src/bin/pg_amcheck/nls.mk
+++ b/src/bin/pg_amcheck/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/pg_amcheck/nls.mk
 CATALOG_NAME     = pg_amcheck
-AVAIL_LANGUAGES  = de el es fr ja ru sv uk zh_CN
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) \
                    pg_amcheck.c \
                    ../../fe_utils/cancel.c \
diff --git a/src/bin/pg_amcheck/po/LINGUAS b/src/bin/pg_amcheck/po/LINGUAS
new file mode 100644
index 0000000000..7595b76a60
--- /dev/null
+++ b/src/bin/pg_amcheck/po/LINGUAS
@@ -0,0 +1 @@
+de el es fr ja ru sv uk zh_CN
diff --git a/src/bin/pg_archivecleanup/nls.mk b/src/bin/pg_archivecleanup/nls.mk
index 51a6767d8d..801cf1c51e 100644
--- a/src/bin/pg_archivecleanup/nls.mk
+++ b/src/bin/pg_archivecleanup/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/pg_archivecleanup/nls.mk
 CATALOG_NAME     = pg_archivecleanup
-AVAIL_LANGUAGES  = cs de el es fr ja ko pl ru sv tr uk vi zh_CN
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) pg_archivecleanup.c
 GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS)
 GETTEXT_FLAGS    = $(FRONTEND_COMMON_GETTEXT_FLAGS)
diff --git a/src/bin/pg_archivecleanup/po/LINGUAS 
b/src/bin/pg_archivecleanup/po/LINGUAS
new file mode 100644
index 0000000000..f0979eabee
--- /dev/null
+++ b/src/bin/pg_archivecleanup/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr ja ko pl ru sv tr uk vi zh_CN
diff --git a/src/bin/pg_basebackup/nls.mk b/src/bin/pg_basebackup/nls.mk
index ec7393d321..8d28e249de 100644
--- a/src/bin/pg_basebackup/nls.mk
+++ b/src/bin/pg_basebackup/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/pg_basebackup/nls.mk
 CATALOG_NAME     = pg_basebackup
-AVAIL_LANGUAGES  = cs de es fr he it ja ko pl pt_BR ru sv tr uk vi zh_CN
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) \
                    bbstreamer_file.c \
                    bbstreamer_gzip.c \
diff --git a/src/bin/pg_basebackup/po/LINGUAS b/src/bin/pg_basebackup/po/LINGUAS
new file mode 100644
index 0000000000..9852f707fc
--- /dev/null
+++ b/src/bin/pg_basebackup/po/LINGUAS
@@ -0,0 +1 @@
+cs de es fr he it ja ko pl pt_BR ru sv tr uk vi zh_CN
diff --git a/src/bin/pg_checksums/nls.mk b/src/bin/pg_checksums/nls.mk
index 5d8fd7e7cc..f7cd2a5ee9 100644
--- a/src/bin/pg_checksums/nls.mk
+++ b/src/bin/pg_checksums/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/pg_checksums/nls.mk
 CATALOG_NAME     = pg_checksums
-AVAIL_LANGUAGES  = cs de el es fr ja ko ru sv tr uk zh_CN
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) \
                    pg_checksums.c \
                    ../../fe_utils/option_utils.c
diff --git a/src/bin/pg_checksums/po/LINGUAS b/src/bin/pg_checksums/po/LINGUAS
new file mode 100644
index 0000000000..78db9aeb22
--- /dev/null
+++ b/src/bin/pg_checksums/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr ja ko ru sv tr uk zh_CN
diff --git a/src/bin/pg_config/nls.mk b/src/bin/pg_config/nls.mk
index 77680fa23c..d86c28c404 100644
--- a/src/bin/pg_config/nls.mk
+++ b/src/bin/pg_config/nls.mk
@@ -1,4 +1,3 @@
 # src/bin/pg_config/nls.mk
 CATALOG_NAME     = pg_config
-AVAIL_LANGUAGES  = cs de el es fr he it ja ko nb pl pt_BR ro ru sv ta tr uk vi 
zh_CN zh_TW
 GETTEXT_FILES    = pg_config.c ../../common/config_info.c ../../common/exec.c
diff --git a/src/bin/pg_config/po/LINGUAS b/src/bin/pg_config/po/LINGUAS
new file mode 100644
index 0000000000..8736ee6d49
--- /dev/null
+++ b/src/bin/pg_config/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr he it ja ko nb pl pt_BR ro ru sv ta tr uk vi zh_CN zh_TW
diff --git a/src/bin/pg_controldata/nls.mk b/src/bin/pg_controldata/nls.mk
index 5c0e33e91a..ab34205b96 100644
--- a/src/bin/pg_controldata/nls.mk
+++ b/src/bin/pg_controldata/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/pg_controldata/nls.mk
 CATALOG_NAME     = pg_controldata
-AVAIL_LANGUAGES  = cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN
 GETTEXT_FILES    = pg_controldata.c ../../common/controldata_utils.c
 GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS)
 GETTEXT_FLAGS    = $(FRONTEND_COMMON_GETTEXT_FLAGS)
diff --git a/src/bin/pg_controldata/po/LINGUAS 
b/src/bin/pg_controldata/po/LINGUAS
new file mode 100644
index 0000000000..a13bb1a2ca
--- /dev/null
+++ b/src/bin/pg_controldata/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN
diff --git a/src/bin/pg_ctl/nls.mk b/src/bin/pg_ctl/nls.mk
index 15b5b4851a..84e7fb4e56 100644
--- a/src/bin/pg_ctl/nls.mk
+++ b/src/bin/pg_ctl/nls.mk
@@ -1,4 +1,3 @@
 # src/bin/pg_ctl/nls.mk
 CATALOG_NAME     = pg_ctl
-AVAIL_LANGUAGES  = cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN
 GETTEXT_FILES    = pg_ctl.c ../../common/exec.c ../../common/fe_memutils.c 
../../common/wait_error.c ../../port/path.c
diff --git a/src/bin/pg_ctl/po/LINGUAS b/src/bin/pg_ctl/po/LINGUAS
new file mode 100644
index 0000000000..508771c97c
--- /dev/null
+++ b/src/bin/pg_ctl/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN
diff --git a/src/bin/pg_dump/nls.mk b/src/bin/pg_dump/nls.mk
index dc7360db48..3054f93fad 100644
--- a/src/bin/pg_dump/nls.mk
+++ b/src/bin/pg_dump/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/pg_dump/nls.mk
 CATALOG_NAME     = pg_dump
-AVAIL_LANGUAGES  = cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) \
                    pg_backup_archiver.c pg_backup_db.c pg_backup_custom.c \
                    pg_backup_null.c pg_backup_tar.c \
diff --git a/src/bin/pg_dump/po/LINGUAS b/src/bin/pg_dump/po/LINGUAS
new file mode 100644
index 0000000000..508771c97c
--- /dev/null
+++ b/src/bin/pg_dump/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN
diff --git a/src/bin/pg_resetwal/nls.mk b/src/bin/pg_resetwal/nls.mk
index 6b85a78828..bc25482f2c 100644
--- a/src/bin/pg_resetwal/nls.mk
+++ b/src/bin/pg_resetwal/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/pg_resetwal/nls.mk
 CATALOG_NAME     = pg_resetwal
-AVAIL_LANGUAGES  = cs de el es fr it ja ko pl pt_BR ru sv tr uk zh_CN
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) pg_resetwal.c 
../../common/restricted_token.c
 GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS)
 GETTEXT_FLAGS    = $(FRONTEND_COMMON_GETTEXT_FLAGS)
diff --git a/src/bin/pg_resetwal/po/LINGUAS b/src/bin/pg_resetwal/po/LINGUAS
new file mode 100644
index 0000000000..7a718f6be5
--- /dev/null
+++ b/src/bin/pg_resetwal/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr it ja ko pl pt_BR ru sv tr uk zh_CN
diff --git a/src/bin/pg_rewind/nls.mk b/src/bin/pg_rewind/nls.mk
index e9d91a39cb..0618cb8c2c 100644
--- a/src/bin/pg_rewind/nls.mk
+++ b/src/bin/pg_rewind/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/pg_rewind/nls.mk
 CATALOG_NAME     = pg_rewind
-AVAIL_LANGUAGES  = cs de el es fr it ja ko pl pt_BR ru sv tr uk zh_CN
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) datapagemap.c file_ops.c 
filemap.c libpq_source.c local_source.c parsexlog.c pg_rewind.c timeline.c 
xlogreader.c ../../common/fe_memutils.c ../../common/restricted_token.c 
../../fe_utils/archive.c ../../fe_utils/recovery_gen.c
 GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS) report_invalid_record:2
 GETTEXT_FLAGS    = $(FRONTEND_COMMON_GETTEXT_FLAGS) \
diff --git a/src/bin/pg_rewind/po/LINGUAS b/src/bin/pg_rewind/po/LINGUAS
new file mode 100644
index 0000000000..7a718f6be5
--- /dev/null
+++ b/src/bin/pg_rewind/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr it ja ko pl pt_BR ru sv tr uk zh_CN
diff --git a/src/bin/pg_test_fsync/nls.mk b/src/bin/pg_test_fsync/nls.mk
index 4b4d33b95a..a50782036c 100644
--- a/src/bin/pg_test_fsync/nls.mk
+++ b/src/bin/pg_test_fsync/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/pg_test_fsync/nls.mk
 CATALOG_NAME     = pg_test_fsync
-AVAIL_LANGUAGES  = cs de el es fr ja ko pl ru sv tr uk vi zh_CN
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) pg_test_fsync.c
 GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS) die
 GETTEXT_FLAGS    = $(FRONTEND_COMMON_GETTEXT_FLAGS)
diff --git a/src/bin/pg_test_fsync/po/LINGUAS b/src/bin/pg_test_fsync/po/LINGUAS
new file mode 100644
index 0000000000..f0979eabee
--- /dev/null
+++ b/src/bin/pg_test_fsync/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr ja ko pl ru sv tr uk vi zh_CN
diff --git a/src/bin/pg_test_timing/nls.mk b/src/bin/pg_test_timing/nls.mk
index 126f45e2cb..331931c591 100644
--- a/src/bin/pg_test_timing/nls.mk
+++ b/src/bin/pg_test_timing/nls.mk
@@ -1,4 +1,3 @@
 # src/bin/pg_test_timing/nls.mk
 CATALOG_NAME     = pg_test_timing
-AVAIL_LANGUAGES  = cs de el es fr ja ko pl ru sv tr uk vi zh_CN
 GETTEXT_FILES    = pg_test_timing.c
diff --git a/src/bin/pg_test_timing/po/LINGUAS 
b/src/bin/pg_test_timing/po/LINGUAS
new file mode 100644
index 0000000000..f0979eabee
--- /dev/null
+++ b/src/bin/pg_test_timing/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr ja ko pl ru sv tr uk vi zh_CN
diff --git a/src/bin/pg_upgrade/nls.mk b/src/bin/pg_upgrade/nls.mk
index bfaacfbb7c..8a4ebbcbe9 100644
--- a/src/bin/pg_upgrade/nls.mk
+++ b/src/bin/pg_upgrade/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/pg_upgrade/nls.mk
 CATALOG_NAME     = pg_upgrade
-AVAIL_LANGUAGES  = cs de es fr ja ko ru sv tr uk zh_CN
 GETTEXT_FILES    = check.c controldata.c dump.c exec.c file.c function.c \
                    info.c option.c parallel.c pg_upgrade.c relfilenode.c \
                    server.c tablespace.c util.c version.c
diff --git a/src/bin/pg_upgrade/po/LINGUAS b/src/bin/pg_upgrade/po/LINGUAS
new file mode 100644
index 0000000000..ac603aedb2
--- /dev/null
+++ b/src/bin/pg_upgrade/po/LINGUAS
@@ -0,0 +1 @@
+cs de es fr ja ko ru sv tr uk zh_CN
diff --git a/src/bin/pg_verifybackup/nls.mk b/src/bin/pg_verifybackup/nls.mk
index 81b96356da..eba73a2c05 100644
--- a/src/bin/pg_verifybackup/nls.mk
+++ b/src/bin/pg_verifybackup/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/pg_verifybackup/nls.mk
 CATALOG_NAME     = pg_verifybackup
-AVAIL_LANGUAGES  = de el es fr ja ko ru sv uk zh_CN
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) \
                    parse_manifest.c \
                    pg_verifybackup.c \
diff --git a/src/bin/pg_verifybackup/po/LINGUAS 
b/src/bin/pg_verifybackup/po/LINGUAS
new file mode 100644
index 0000000000..6db2f24356
--- /dev/null
+++ b/src/bin/pg_verifybackup/po/LINGUAS
@@ -0,0 +1 @@
+de el es fr ja ko ru sv uk zh_CN
diff --git a/src/bin/pg_waldump/nls.mk b/src/bin/pg_waldump/nls.mk
index 159638fc00..a9eeb6712b 100644
--- a/src/bin/pg_waldump/nls.mk
+++ b/src/bin/pg_waldump/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/pg_waldump/nls.mk
 CATALOG_NAME     = pg_waldump
-AVAIL_LANGUAGES  = cs de el es fr ja ko ru sv tr uk vi zh_CN
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) pg_waldump.c
 GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS)
 GETTEXT_FLAGS    = $(FRONTEND_COMMON_GETTEXT_FLAGS)
diff --git a/src/bin/pg_waldump/po/LINGUAS b/src/bin/pg_waldump/po/LINGUAS
new file mode 100644
index 0000000000..3a64d2e74c
--- /dev/null
+++ b/src/bin/pg_waldump/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr ja ko ru sv tr uk vi zh_CN
diff --git a/src/bin/psql/nls.mk b/src/bin/psql/nls.mk
index e34bb9bc91..9ea193fda7 100644
--- a/src/bin/psql/nls.mk
+++ b/src/bin/psql/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/psql/nls.mk
 CATALOG_NAME     = psql
-AVAIL_LANGUAGES  = cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN zh_TW
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) \
                    command.c common.c copy.c crosstabview.c help.c input.c 
large_obj.c \
                    mainloop.c psqlscanslash.c startup.c \
diff --git a/src/bin/psql/po/LINGUAS b/src/bin/psql/po/LINGUAS
new file mode 100644
index 0000000000..6704d6f4b3
--- /dev/null
+++ b/src/bin/psql/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN zh_TW
diff --git a/src/bin/scripts/nls.mk b/src/bin/scripts/nls.mk
index f61ff79396..f4638a06f0 100644
--- a/src/bin/scripts/nls.mk
+++ b/src/bin/scripts/nls.mk
@@ -1,6 +1,5 @@
 # src/bin/scripts/nls.mk
 CATALOG_NAME     = pgscripts
-AVAIL_LANGUAGES  = cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN
 GETTEXT_FILES    = $(FRONTEND_COMMON_GETTEXT_FILES) \
                    createdb.c createuser.c \
                    dropdb.c dropuser.c \
diff --git a/src/bin/scripts/po/LINGUAS b/src/bin/scripts/po/LINGUAS
new file mode 100644
index 0000000000..508771c97c
--- /dev/null
+++ b/src/bin/scripts/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN
diff --git a/src/interfaces/ecpg/ecpglib/nls.mk 
b/src/interfaces/ecpg/ecpglib/nls.mk
index 2f6b0895f5..77eecc98f3 100644
--- a/src/interfaces/ecpg/ecpglib/nls.mk
+++ b/src/interfaces/ecpg/ecpglib/nls.mk
@@ -1,6 +1,5 @@
 # src/interfaces/ecpg/ecpglib/nls.mk
 CATALOG_NAME     = ecpglib
-AVAIL_LANGUAGES  = cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN
 GETTEXT_FILES    = connect.c descriptor.c error.c execute.c misc.c
 GETTEXT_TRIGGERS = ecpg_gettext
 GETTEXT_FLAGS    = ecpg_gettext:1:pass-c-format
diff --git a/src/interfaces/ecpg/ecpglib/po/LINGUAS 
b/src/interfaces/ecpg/ecpglib/po/LINGUAS
new file mode 100644
index 0000000000..a13bb1a2ca
--- /dev/null
+++ b/src/interfaces/ecpg/ecpglib/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN
diff --git a/src/interfaces/ecpg/preproc/nls.mk 
b/src/interfaces/ecpg/preproc/nls.mk
index fed0f7c9e5..55ea19a44e 100644
--- a/src/interfaces/ecpg/preproc/nls.mk
+++ b/src/interfaces/ecpg/preproc/nls.mk
@@ -1,6 +1,5 @@
 # src/interfaces/ecpg/preproc/nls.mk
 CATALOG_NAME     = ecpg
-AVAIL_LANGUAGES  = cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN zh_TW
 GETTEXT_FILES    = descriptor.c ecpg.c pgc.c preproc.c type.c variable.c
 GETTEXT_TRIGGERS = mmerror:3 mmfatal:2
 GETTEXT_FLAGS    = mmerror:3:c-format mmfatal:2:c-format
diff --git a/src/interfaces/ecpg/preproc/po/LINGUAS 
b/src/interfaces/ecpg/preproc/po/LINGUAS
new file mode 100644
index 0000000000..991612cffe
--- /dev/null
+++ b/src/interfaces/ecpg/preproc/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN zh_TW
diff --git a/src/interfaces/libpq/nls.mk b/src/interfaces/libpq/nls.mk
index 1f62ba1b57..9256b426c1 100644
--- a/src/interfaces/libpq/nls.mk
+++ b/src/interfaces/libpq/nls.mk
@@ -1,6 +1,5 @@
 # src/interfaces/libpq/nls.mk
 CATALOG_NAME     = libpq
-AVAIL_LANGUAGES  = cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN zh_TW
 GETTEXT_FILES    = fe-auth.c fe-auth-scram.c fe-connect.c fe-exec.c 
fe-gssapi-common.c fe-lobj.c fe-misc.c fe-protocol3.c fe-secure.c 
fe-secure-common.c fe-secure-gssapi.c fe-secure-openssl.c win32.c 
../../port/thread.c
 GETTEXT_TRIGGERS = libpq_gettext pqInternalNotice:2
 GETTEXT_FLAGS    = libpq_gettext:1:pass-c-format pqInternalNotice:2:c-format
diff --git a/src/interfaces/libpq/po/LINGUAS b/src/interfaces/libpq/po/LINGUAS
new file mode 100644
index 0000000000..6704d6f4b3
--- /dev/null
+++ b/src/interfaces/libpq/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN zh_TW
diff --git a/src/nls-global.mk b/src/nls-global.mk
index c1f7982300..7fd5d5d242 100644
--- a/src/nls-global.mk
+++ b/src/nls-global.mk
@@ -8,7 +8,6 @@
 #
 # CATALOG_NAME          -- name of the message catalog (xxx.po); probably
 #                          name of the program
-# AVAIL_LANGUAGES       -- list of languages that are provided/supported
 # GETTEXT_FILES         -- list of source files that contain message strings
 # GETTEXT_TRIGGERS      -- (optional) list of functions that contain
 #                          translatable strings
@@ -16,6 +15,9 @@
 #                          function arguments that contain C format strings
 #                          (functions must be listed in TRIGGERS and FLAGS)
 #
+# Also, provide a test file 'po/LINGUAS' with a space-separated list
+# of languages that are provided/supported.
+#
 # That's all, the rest is done here, if --enable-nls was specified.
 #
 # The only user-visible targets here are 'init-po', to make an initial
@@ -27,6 +29,8 @@
 # existence checked by Makefile.global; otherwise we won't get here
 include $(srcdir)/nls.mk
 
+AVAIL_LANGUAGES := $(shell sed -e "/^#/d" -e "s/#.*//" po/LINGUAS)
+
 # If user specified the languages he wants in --enable-nls=LANGUAGES,
 # filter out the rest.  Else use all available ones.
 ifdef WANTED_LANGUAGES
diff --git a/src/pl/plperl/nls.mk b/src/pl/plperl/nls.mk
index ccdf1c3316..8c41bfac7a 100644
--- a/src/pl/plperl/nls.mk
+++ b/src/pl/plperl/nls.mk
@@ -1,6 +1,5 @@
 # src/pl/plperl/nls.mk
 CATALOG_NAME     = plperl
-AVAIL_LANGUAGES  = cs de el es fr it ja ko pl pt_BR ro ru sv tr uk vi zh_CN 
zh_TW
 GETTEXT_FILES    = plperl.c SPI.c
 GETTEXT_TRIGGERS = $(BACKEND_COMMON_GETTEXT_TRIGGERS)
 GETTEXT_FLAGS    = $(BACKEND_COMMON_GETTEXT_FLAGS)
diff --git a/src/pl/plperl/po/LINGUAS b/src/pl/plperl/po/LINGUAS
new file mode 100644
index 0000000000..37bf941be3
--- /dev/null
+++ b/src/pl/plperl/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr it ja ko pl pt_BR ro ru sv tr uk vi zh_CN zh_TW
diff --git a/src/pl/plpgsql/src/nls.mk b/src/pl/plpgsql/src/nls.mk
index 11878d2d5b..2bd620a8dd 100644
--- a/src/pl/plpgsql/src/nls.mk
+++ b/src/pl/plpgsql/src/nls.mk
@@ -1,6 +1,5 @@
 # src/pl/plpgsql/src/nls.mk
 CATALOG_NAME     = plpgsql
-AVAIL_LANGUAGES  = cs de el es fr it ja ko pl pt_BR ro ru sv tr uk vi zh_CN 
zh_TW
 GETTEXT_FILES    = pl_comp.c pl_exec.c pl_gram.c pl_funcs.c pl_handler.c 
pl_scanner.c
 GETTEXT_TRIGGERS = $(BACKEND_COMMON_GETTEXT_TRIGGERS) yyerror plpgsql_yyerror
 GETTEXT_FLAGS    = $(BACKEND_COMMON_GETTEXT_FLAGS)
diff --git a/src/pl/plpgsql/src/po/LINGUAS b/src/pl/plpgsql/src/po/LINGUAS
new file mode 100644
index 0000000000..37bf941be3
--- /dev/null
+++ b/src/pl/plpgsql/src/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr it ja ko pl pt_BR ro ru sv tr uk vi zh_CN zh_TW
diff --git a/src/pl/plpython/nls.mk b/src/pl/plpython/nls.mk
index c46e26200b..4c68a0e571 100644
--- a/src/pl/plpython/nls.mk
+++ b/src/pl/plpython/nls.mk
@@ -1,6 +1,5 @@
 # src/pl/plpython/nls.mk
 CATALOG_NAME     = plpython
-AVAIL_LANGUAGES  = cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN
 GETTEXT_FILES    = plpy_cursorobject.c plpy_elog.c plpy_exec.c plpy_main.c 
plpy_planobject.c plpy_plpymodule.c \
                    plpy_procedure.c plpy_resultobject.c plpy_spi.c 
plpy_subxactobject.c plpy_typeio.c plpy_util.c
 GETTEXT_TRIGGERS = $(BACKEND_COMMON_GETTEXT_TRIGGERS) PLy_elog:2 
PLy_exception_set:2 PLy_exception_set_plural:2,3
diff --git a/src/pl/plpython/po/LINGUAS b/src/pl/plpython/po/LINGUAS
new file mode 100644
index 0000000000..a13bb1a2ca
--- /dev/null
+++ b/src/pl/plpython/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN
diff --git a/src/pl/tcl/nls.mk b/src/pl/tcl/nls.mk
index fe6e84a3a4..8366998df1 100644
--- a/src/pl/tcl/nls.mk
+++ b/src/pl/tcl/nls.mk
@@ -1,6 +1,5 @@
 # src/pl/tcl/nls.mk
 CATALOG_NAME     = pltcl
-AVAIL_LANGUAGES  = cs de el es fr it ja ko pl pt_BR ro ru sv tr uk vi zh_CN 
zh_TW
 GETTEXT_FILES    = pltcl.c
 GETTEXT_TRIGGERS = $(BACKEND_COMMON_GETTEXT_TRIGGERS)
 GETTEXT_FLAGS    = $(BACKEND_COMMON_GETTEXT_FLAGS)
diff --git a/src/pl/tcl/po/LINGUAS b/src/pl/tcl/po/LINGUAS
new file mode 100644
index 0000000000..37bf941be3
--- /dev/null
+++ b/src/pl/tcl/po/LINGUAS
@@ -0,0 +1 @@
+cs de el es fr it ja ko pl pt_BR ro ru sv tr uk vi zh_CN zh_TW
-- 
2.36.1

Reply via email to