1 # Example for use of GNU gettext.
2 # Copyright (C) 2003 Free Software Foundation, Inc.
3 # This file is in the public domain.
5 # Makefile - processed by GNU make.
7 # NLS is enabled by default.
10 # List of files which contain translatable strings.
14 # Usually the message domain is the same as the package name in lower case.
15 DOMAIN
= hello-objc-gnustep
17 # These options get passed to xgettext.
20 # This is the copyright holder that gets inserted into the header of the
21 # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
22 # package. (Note that the msgstr strings, extracted from the package's
23 # sources, belong to the copyright holder of the package.) Translators are
24 # expected to transfer the copyright for their translations to this person
25 # or entity, or to disclaim their copyright. The empty string stands for
26 # the public domain; in this case the translators are expected to disclaim
28 COPYRIGHT_HOLDER
= Yoyodyne
, Inc.
30 # This is the email address or URL to which the translators shall report
31 # bugs in the untranslated strings:
32 # - Strings which are not entire sentences, see the maintainer guidelines
33 # in the GNU gettext documentation, section 'Preparing Strings'.
34 # - Strings which use unclear terms or require additional context to be
36 # - Strings which make invalid assumptions about notation of date, time or
38 # - Pluralisation problems.
39 # - Incorrect English spelling.
40 # - Incorrect formatting.
41 # It can be your email address, or a mailing list address where translators
42 # can write to without being subscribed, or the URL of a web page through
43 # which the translators can contact you.
44 MSGID_BUGS_ADDRESS
= bug-gnu-gettext@gnu.org
46 -include $(GNUSTEP_MAKEFILES
)/rules.make
50 MSGMERGE_UPDATE
= msgmerge
--update
55 # Set of available languages.
56 LINGUAS
:= $(shell sed
-e
"/^\#/d" LINGUAS
)
57 # Set of languages which use msgen.
58 ENLINGUAS
:= $(filter-out $(LINGUAS
), en
)
64 POTFILES_DEPS
= $(foreach file
, $(POTFILES
), $(top_srcdir
)/$(file
))
65 POFILES
= $(foreach lang
, $(LINGUAS
), $(lang
).po
)
66 UPDATEPOFILES
= $(foreach lang
, $(LINGUAS
), $(lang
).po-update
)
67 DUMMYPOFILES
= $(foreach lang
, $(LINGUAS
), $(lang
).nop
)
68 STRINGSFILES
= $(foreach lang
, $(LINGUAS
), $(top_srcdir
)/$(NSLOCALE_
$(lang
)).lproj
/Localizable.strings
)
69 ENSTRINGSFILES
= $(foreach lang
, $(ENLINGUAS
), $(top_srcdir
)/$(NSLOCALE_
$(lang
)).lproj
/Localizable.strings
)
70 CATALOGS
= $(STRINGSFILES
) $(ENSTRINGSFILES
)
72 .SUFFIXES
: .po .mo .sed .sin .nop .po-update
75 sed
-e
'/^#/d' $< > t-
$@
79 internal-all
:: all-local-
$(USE_NLS
)
81 all-local-yes
: $(CATALOGS
)
84 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
85 # otherwise packages like GCC can not be built if only parts of the source
86 # have been downloaded.
88 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
89 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
90 $(DOMAIN
).pot-update
: $(POTFILES_DEPS
) remove-potcdate.sed
91 $(XGETTEXT
) --default-domain
=$(DOMAIN
) --directory
=$(top_srcdir
) \
92 --add-comments
=TRANSLATORS
: $(XGETTEXT_OPTIONS
) \
93 --copyright-holder
='$(COPYRIGHT_HOLDER)' \
94 --msgid-bugs-address
='$(MSGID_BUGS_ADDRESS)' \
96 test ! -f
$(DOMAIN
).po ||
{ \
97 if
test -f
$(DOMAIN
).pot
; then \
98 sed
-f remove-potcdate.sed
< $(DOMAIN
).pot
> $(DOMAIN
).1po
&& \
99 sed
-f remove-potcdate.sed
< $(DOMAIN
).po
> $(DOMAIN
).2po
&& \
100 if cmp
$(DOMAIN
).1po
$(DOMAIN
).2po
>/dev
/null
2>&1; then \
101 rm -f
$(DOMAIN
).1po
$(DOMAIN
).2po
$(DOMAIN
).po
; \
103 rm -f
$(DOMAIN
).1po
$(DOMAIN
).2po
$(DOMAIN
).pot
&& \
104 mv
$(DOMAIN
).po
$(DOMAIN
).pot
; \
107 mv
$(DOMAIN
).po
$(DOMAIN
).pot
; \
111 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
112 # every "make" invocation, only create it when it is missing.
113 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
115 $(MAKE
) $(DOMAIN
).pot-update
117 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
118 # Note that a PO file is not touched if it doesn't need to be changed.
119 $(POFILES
): $(DOMAIN
).pot
120 @lang
=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
121 echo
"$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
122 $(MSGMERGE_UPDATE
) $${lang}.po
$(DOMAIN
).pot
125 $(MAKE
) $(DOMAIN
).pot-update
126 test -z
"$(UPDATEPOFILES)" ||
$(MAKE
) $(UPDATEPOFILES
)
127 $(MAKE
) update-strings
129 # General rule for updating PO files.
132 @lang
=`echo $@ | sed -e 's/\.po-update$$//'`; \
135 echo
"$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
136 if
$(MSGMERGE
) $$lang.po
$(DOMAIN
).pot
-o
$$tmpdir/$$lang.new.po
; then \
137 if cmp
$$lang.po
$$tmpdir/$$lang.new.po
>/dev
/null
2>&1; then \
138 rm -f
$$tmpdir/$$lang.new.po
; \
140 if mv
-f
$$tmpdir/$$lang.new.po
$$lang.po
; then \
143 echo
"msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
148 echo
"msgmerge for $$lang.po failed!" 1>&2; \
149 rm -f
$$tmpdir/$$lang.new.po
; \
155 update-strings
: $(CATALOGS
)
158 # I don't know how to make a dependency from a particular .strings file to its
159 # corresponding .po file; therefore I put here a dependency towards all .po
160 # files. It's safer than no dependency at all.
161 $(STRINGSFILES
): $(POFILES
)
162 $(MAKE
) $(UNIXLOCALE_
$(patsubst %.lproj
,%, $(notdir $(patsubst %/,%, $(dir $@
))))).po
163 mkdir
-p
$(patsubst %/,%, $(dir $@
))
164 msgcat
--stringtable-output
-o
$@.tmp
$(UNIXLOCALE_
$(patsubst %.lproj
,%, $(notdir $(patsubst %/,%, $(dir $@
))))).po
167 $(ENSTRINGSFILES
): $(DOMAIN
).pot
168 mkdir
-p
$(patsubst %/,%, $(dir $@
))
169 $(MSGINIT
) -i
$(DOMAIN
).pot
--no-translator
-l
$(UNIXLOCALE_
$(patsubst %.lproj
,%, $(notdir $(patsubst %/,%, $(dir $@
))))) --stringtable-output
-o
$@.tmp
173 @echo
$(foreach lang
, $(LINGUAS
), $(NSLOCALE_
$(lang
)))