1 # Example for use of GNU gettext.
2 # This file is in the public domain.
4 # Makefile - processed by GNU make.
6 # NLS is enabled by default.
9 # List of files which contain translatable strings.
13 # Usually the message domain is the same as the package name in lower case.
14 DOMAIN
= hello-objc-gnustep
16 # These options get passed to xgettext.
19 # This is the copyright holder that gets inserted into the header of the
20 # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
21 # package. (Note that the msgstr strings, extracted from the package's
22 # sources, belong to the copyright holder of the package.) Translators are
23 # expected to transfer the copyright for their translations to this person
24 # or entity, or to disclaim their copyright. The empty string stands for
25 # the public domain; in this case the translators are expected to disclaim
27 COPYRIGHT_HOLDER
= Yoyodyne
, Inc.
29 # This is the email address or URL to which the translators shall report
30 # bugs in the untranslated strings:
31 # - Strings which are not entire sentences, see the maintainer guidelines
32 # in the GNU gettext documentation, section 'Preparing Strings'.
33 # - Strings which use unclear terms or require additional context to be
35 # - Strings which make invalid assumptions about notation of date, time or
37 # - Pluralisation problems.
38 # - Incorrect English spelling.
39 # - Incorrect formatting.
40 # It can be your email address, or a mailing list address where translators
41 # can write to without being subscribed, or the URL of a web page through
42 # which the translators can contact you.
43 MSGID_BUGS_ADDRESS
= bug-gnu-gettext@gnu.org
45 # These options get passed to msgmerge.
46 # Useful options are in particular:
47 # --previous to keep previous msgids of translated messages,
48 # --quiet to reduce the verbosity.
49 MSGMERGE_OPTIONS
= --quiet
51 -include $(GNUSTEP_MAKEFILES
)/rules.make
59 MSGMERGE_UPDATE
= msgmerge
--update
64 # Set of available languages.
65 LINGUAS
:= $(shell sed
-e
"/^\#/d" LINGUAS
)
66 # Set of languages which use msgen.
67 ENLINGUAS
:= $(filter-out $(LINGUAS
), en
)
73 POTFILES_DEPS
= $(foreach file
, $(POTFILES
), $(top_srcdir
)/$(file
))
74 POFILES
= $(foreach lang
, $(LINGUAS
), $(lang
).po
)
75 UPDATEPOFILES
= $(foreach lang
, $(LINGUAS
), $(lang
).po-update
)
76 DUMMYPOFILES
= $(foreach lang
, $(LINGUAS
), $(lang
).nop
)
77 STRINGSFILES
= $(foreach lang
, $(LINGUAS
), $(top_srcdir
)/$(NSLOCALE_
$(lang
)).lproj
/Localizable.strings
)
78 ENSTRINGSFILES
= $(foreach lang
, $(ENLINGUAS
), $(top_srcdir
)/$(NSLOCALE_
$(lang
)).lproj
/Localizable.strings
)
79 CATALOGS
= $(STRINGSFILES
) $(ENSTRINGSFILES
)
81 .SUFFIXES
: .po .mo .sed .sin .nop .po-create .po-update
84 sed
-e
'/^#/d' $< > t-
$@
88 internal-all
:: all-local-
$(USE_NLS
)
90 all-local-yes
: $(CATALOGS
)
93 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
94 # otherwise packages like GCC can not be built if only parts of the source
95 # have been downloaded.
97 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
98 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
99 $(DOMAIN
).pot-update
: $(POTFILES_DEPS
) remove-potcdate.sed
100 if LC_ALL
=C grep
'GNU $(PACKAGE_NAME)' ..
/* 2>/dev
/null
>/dev
/null
; then \
101 package_gnu
='GNU '; \
105 msgid_bugs_address
='$(MSGID_BUGS_ADDRESS)'; \
106 case
`$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
107 '' |
0.
[0-9] |
0.
[0-9].
* |
0.1[0-5] |
0.1[0-5].
* |
0.16 |
0.16.
[0-1]*) \
108 $(XGETTEXT
) --default-domain
=$(DOMAIN
) --directory
=$(top_srcdir
) \
109 --add-comments
=TRANSLATORS
: $(XGETTEXT_OPTIONS
) \
110 --copyright-holder
='$(COPYRIGHT_HOLDER)' \
111 --msgid-bugs-address
="$$msgid_bugs_address" \
115 $(XGETTEXT
) --default-domain
=$(DOMAIN
) --directory
=$(top_srcdir
) \
116 --add-comments
=TRANSLATORS
: $(XGETTEXT_OPTIONS
) \
117 --copyright-holder
='$(COPYRIGHT_HOLDER)' \
118 --package-name
="$${package_gnu}$(PACKAGE_NAME)" \
119 --package-version
='$(VERSION)' \
120 --msgid-bugs-address
="$$msgid_bugs_address" \
124 test ! -f
$(DOMAIN
).po ||
{ \
125 if
test -f
$(DOMAIN
).pot
; then \
126 sed
-f remove-potcdate.sed
< $(DOMAIN
).pot
> $(DOMAIN
).1po
&& \
127 sed
-f remove-potcdate.sed
< $(DOMAIN
).po
> $(DOMAIN
).2po
&& \
128 if cmp
$(DOMAIN
).1po
$(DOMAIN
).2po
>/dev
/null
2>&1; then \
129 rm -f
$(DOMAIN
).1po
$(DOMAIN
).2po
$(DOMAIN
).po
; \
131 rm -f
$(DOMAIN
).1po
$(DOMAIN
).2po
$(DOMAIN
).pot
&& \
132 mv
$(DOMAIN
).po
$(DOMAIN
).pot
; \
135 mv
$(DOMAIN
).po
$(DOMAIN
).pot
; \
139 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
140 # every "make" invocation, only create it when it is missing.
141 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
143 $(MAKE
) $(DOMAIN
).pot-update
145 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
146 # Note that a PO file is not touched if it doesn't need to be changed.
147 $(POFILES
): $(DOMAIN
).pot
148 @lang
=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
149 if
test -f
$${lang}.po
; then \
150 echo
"$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
151 case
`$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
152 '' |
0.
[0-9] |
0.
[0-9].
* |
0.1[0-7] |
0.1[0-7].
*) \
153 $(MSGMERGE_UPDATE
) $(MSGMERGE_OPTIONS
) $${lang}.po
$(DOMAIN
).pot
;; \
155 $(MSGMERGE_UPDATE
) $(MSGMERGE_OPTIONS
) --lang
=$${lang} $${lang}.po
$(DOMAIN
).pot
;; \
158 $(MAKE
) $${lang}.po-create
; \
162 $(MAKE
) $(DOMAIN
).pot-update
163 test -z
"$(UPDATEPOFILES)" ||
$(MAKE
) $(UPDATEPOFILES
)
164 $(MAKE
) update-strings
166 # General rule for creating PO files.
169 @lang
=`echo $@ | sed -e 's/\.po-create$$//'`; \
170 echo
"File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
173 # General rule for updating PO files.
176 @lang
=`echo $@ | sed -e 's/\.po-update$$//'`; \
179 echo
"$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
180 if
{ case
`$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
181 '' |
0.
[0-9] |
0.
[0-9].
* |
0.1[0-7] |
0.1[0-7].
*) \
182 $(MSGMERGE
) $(MSGMERGE_OPTIONS
) -o
$$tmpdir/$$lang.new.po
$$lang.po
$(DOMAIN
).pot
;; \
184 $(MSGMERGE
) $(MSGMERGE_OPTIONS
) --lang
=$$lang -o
$$tmpdir/$$lang.new.po
$$lang.po
$(DOMAIN
).pot
;; \
187 if cmp
$$lang.po
$$tmpdir/$$lang.new.po
>/dev
/null
2>&1; then \
188 rm -f
$$tmpdir/$$lang.new.po
; \
190 if mv
-f
$$tmpdir/$$lang.new.po
$$lang.po
; then \
193 echo
"msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
198 echo
"msgmerge for $$lang.po failed!" 1>&2; \
199 rm -f
$$tmpdir/$$lang.new.po
; \
205 update-strings
: $(CATALOGS
)
208 # I don't know how to make a dependency from a particular .strings file to its
209 # corresponding .po file; therefore I put here a dependency towards all .po
210 # files. It's safer than no dependency at all.
211 $(STRINGSFILES
): $(POFILES
)
212 $(MAKE
) $(UNIXLOCALE_
$(patsubst %.lproj
,%, $(notdir $(patsubst %/,%, $(dir $@
))))).po
213 mkdir
-p
$(patsubst %/,%, $(dir $@
))
214 msgcat
--stringtable-output
-o
$@.tmp
$(UNIXLOCALE_
$(patsubst %.lproj
,%, $(notdir $(patsubst %/,%, $(dir $@
))))).po
217 $(ENSTRINGSFILES
): $(DOMAIN
).pot
218 mkdir
-p
$(patsubst %/,%, $(dir $@
))
219 $(MSGINIT
) -i
$(DOMAIN
).pot
--no-translator
-l
$(UNIXLOCALE_
$(patsubst %.lproj
,%, $(notdir $(patsubst %/,%, $(dir $@
))))) --stringtable-output
-o
$@.tmp
223 @echo
$(foreach lang
, $(LINGUAS
), $(NSLOCALE_
$(lang
)))