diff options
| author | Peter Eisentraut | 2011-06-26 21:13:10 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2011-06-26 21:37:21 +0000 |
| commit | cb5a7bc2dce4377036bd70a69b2b7b3bc821036f (patch) | |
| tree | 0aabced33a09c1658c8fc305d5be7dbacff715ad /src/nls-global.mk | |
| parent | 7a5a843a2a63636458397823f090d5e28a02b6a4 (diff) | |
Add the possibility to pass --flag arguments to xgettext calls
The --flag argument can be used to tell xgettext the arguments of
which functions should be flagged with c-format in the PO files,
instead of guessing based on the presence of format specifiers, which
fails if no format specifiers are present but the translation
accidentally introduces one.
Appropriate flag settings have been added for each message catalog.
based on a patch by Christoph Berg for bug #6066
Diffstat (limited to 'src/nls-global.mk')
| -rw-r--r-- | src/nls-global.mk | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nls-global.mk b/src/nls-global.mk index dda3e29a7a..c95c3a496f 100644 --- a/src/nls-global.mk +++ b/src/nls-global.mk @@ -12,6 +12,9 @@ # GETTEXT_FILES -- list of source files that contain message strings # GETTEXT_TRIGGERS -- (optional) list of functions that contain # translatable strings +# GETTEXT_FLAGS -- (optional) list of gettext --flag arguments to mark +# function arguments that contain C format strings +# (functions must be listed in TRIGGERS and FLAGS) # # That's all, the rest is done here, if --enable-nls was specified. # @@ -41,6 +44,7 @@ endif # _ is defined in c.h, so it's global GETTEXT_TRIGGERS += _ +GETTEXT_FLAGS += _:1:pass-c-format # common settings that apply to backend and all backend modules @@ -49,6 +53,11 @@ BACKEND_COMMON_GETTEXT_TRIGGERS = \ errdetail errdetail_log errdetail_plural:1,2 \ errhint \ errcontext +BACKEND_COMMON_GETTEXT_FLAGS = \ + errmsg:1:c-format errmsg_plural:1:c-format errmsg_plural:2:c-format \ + errdetail:1:c-format errdetail_log:1:c-format errdetail_plural:1:c-format errdetail_plural:2:c-format \ + errhint:1:c-format \ + errcontext:1:c-format all-po: $(MO_FILES) @@ -59,7 +68,7 @@ all-po: $(MO_FILES) ifeq ($(word 1,$(GETTEXT_FILES)),+) po/$(CATALOG_NAME).pot: $(word 2, $(GETTEXT_FILES)) $(MAKEFILE_LIST) ifdef XGETTEXT - $(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) -f $< + $(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) $(addprefix --flag=, $(GETTEXT_FLAGS)) -f $< else @echo "You don't have 'xgettext'."; exit 1 endif @@ -68,7 +77,7 @@ po/$(CATALOG_NAME).pot: $(GETTEXT_FILES) $(MAKEFILE_LIST) # Change to srcdir explicitly, don't rely on $^. That way we get # consistent #: file references in the po files. ifdef XGETTEXT - $(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) $(GETTEXT_FILES) + $(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) $(addprefix --flag=, $(GETTEXT_FLAGS)) $(GETTEXT_FILES) else @echo "You don't have 'xgettext'."; exit 1 endif |
