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.)

Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/557a9f5c-e871-edc7-2f58-a4140fb65b7b@enterprisedb.com
This commit is contained in:
Peter Eisentraut 2022-07-13 07:51:43 +02:00
parent f29199d319
commit 88dad06b47
54 changed files with 41 additions and 40 deletions

View File

@ -175,10 +175,11 @@ make init-po
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 @@ fprintf(stderr, gettext("panic level %d\n"), lvl);
</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 @@ fprintf(stderr, gettext("panic level %d\n"), lvl);
</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>

View File

@ -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 \

1
src/backend/po/LINGUAS Normal file
View File

@ -0,0 +1 @@
de es fr id it ja ko pl pt_BR ru sv tr uk zh_CN

View File

@ -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)

View File

@ -0,0 +1 @@
cs de el es fr he it ja ko pl pt_BR ru sv tr uk vi zh_CN

View File

@ -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 \

View File

@ -0,0 +1 @@
de el es fr ja ru sv uk zh_CN

View File

@ -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)

View File

@ -0,0 +1 @@
cs de el es fr ja ko pl ru sv tr uk vi zh_CN

View File

@ -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 \

View File

@ -0,0 +1 @@
cs de es fr he it ja ko pl pt_BR ru sv tr uk vi zh_CN

View File

@ -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

View File

@ -0,0 +1 @@
cs de el es fr ja ko ru sv tr uk zh_CN

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -0,0 +1 @@
cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN

View File

@ -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

View File

@ -0,0 +1 @@
cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN

View File

@ -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 \

View File

@ -0,0 +1 @@
cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN

View File

@ -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)

View File

@ -0,0 +1 @@
cs de el es fr it ja ko pl pt_BR ru sv tr uk zh_CN

View File

@ -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) \

View File

@ -0,0 +1 @@
cs de el es fr it ja ko pl pt_BR ru sv tr uk zh_CN

View File

@ -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)

View File

@ -0,0 +1 @@
cs de el es fr ja ko pl ru sv tr uk vi zh_CN

View File

@ -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

View File

@ -0,0 +1 @@
cs de el es fr ja ko pl ru sv tr uk vi zh_CN

View File

@ -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

View File

@ -0,0 +1 @@
cs de es fr ja ko ru sv tr uk zh_CN

View File

@ -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 \

View File

@ -0,0 +1 @@
de el es fr ja ko ru sv uk zh_CN

View File

@ -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)

View File

@ -0,0 +1 @@
cs de el es fr ja ko ru sv tr uk vi zh_CN

View File

@ -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 \

1
src/bin/psql/po/LINGUAS Normal file
View File

@ -0,0 +1 @@
cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN zh_TW

View File

@ -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 \

View File

@ -0,0 +1 @@
cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN

View File

@ -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

View File

@ -0,0 +1 @@
cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN

View File

@ -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

View File

@ -0,0 +1 @@
cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN zh_TW

View File

@ -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

View File

@ -0,0 +1 @@
cs de el es fr he it ja ko pl pt_BR ru sv tr uk zh_CN zh_TW

View File

@ -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 text 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

View File

@ -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)

1
src/pl/plperl/po/LINGUAS Normal file
View File

@ -0,0 +1 @@
cs de el es fr it ja ko pl pt_BR ro ru sv tr uk vi zh_CN zh_TW

View File

@ -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)

View File

@ -0,0 +1 @@
cs de el es fr it ja ko pl pt_BR ro ru sv tr uk vi zh_CN zh_TW

View File

@ -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

View File

@ -0,0 +1 @@
cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN

View File

@ -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)

1
src/pl/tcl/po/LINGUAS Normal file
View File

@ -0,0 +1 @@
cs de el es fr it ja ko pl pt_BR ro ru sv tr uk vi zh_CN zh_TW