prefix = @prefix@
exec_prefix = @exec_prefix@
+datarootdir = @datarootdir@
datadir = @datadir@
localedir = $(datadir)/locale
gettextsrcdir = $(datadir)/gettext/po
MKINSTALLDIRS = @MKINSTALLDIRS@
mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
+AWK = @AWK@
+
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = @XGETTEXT@
$(POFILES) $(GMOFILES) \
$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
+DISTFILES.extra1 = lyx_pot.py
+
POTFILE_IN_DEPS = $(shell find $(top_srcdir)/src -name Makefile.am)
POTFILES = \
# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
-$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in l10n_pots remove-potcdate.sed
+$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
+ $(MAKE) l10n_pots
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
--files-from=$(srcdir)/POTFILES.in \
LC_ALL=C ; export LC_ALL ; \
rm -f $@-t \
&& ( cd $(top_srcdir); \
- grep -l "_(\".*\")" `find src -regex ".*\\.\\(C\\|c\\|h\\|C\\.in\\)" -print` |\
- sed -e '/xforms.forms/d' |\
+ grep -l "_(\".*\")" `find src \( -name '*.h' -o -name '*.cpp' -o -name '*.cpp.in' \) -print` |\
+ grep -v -e "src/support/Package.cpp$$" |\
sort | uniq ) > $@-t \
&& mv $@-t $@
-l10n_pots: $(srcdir)/xforms_l10n.pot $(srcdir)/qt_l10n.pot $(srcdir)/layouts_l10n.pot $(srcdir)/languages_l10n.pot $(srcdir)/ui_l10n.pot
- cat $(srcdir)/xforms_l10n.pot $(srcdir)/qt_l10n.pot $(srcdir)/layouts_l10n.pot $(srcdir)/languages_l10n.pot $(srcdir)/ui_l10n.pot | \
- msguniq -o $(PACKAGE).po
+l10n_pots: qt4_l10n.pot layouts_l10n.pot languages_l10n.pot ui_l10n.pot
+ cat $^ | \
+ msguniq -o $(DOMAIN).po && rm -f $^
-$(srcdir)/xforms_l10n.pot: $(top_srcdir)/src/frontends/xforms/forms/*.fd
- cd ${srcdir} ; \
- LC_ALL=C ; export LC_ALL ; \
- awk ' \
- BEGIN { \
- print "#, fuzzy"; \
- print "msgid \"\""; \
- print "msgstr \"\""; \
- print "\"Content-Type: text/plain; charset=ISO-8859-1\\n\""; \
- print "\"Content-Transfer-Encoding: 8bit\\n\""; \
- print "\n"; \
- skip=0; \
- } \
- /style: 15/ { \
- skip=1; \
- } \
- /label: / { \
- if (NF > 1 && skip == 0) { \
- line=$$0;\
- sub(/label: /,"",line);\
- printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", FILENAME, FNR, line);\
- }\
- skip=0; \
- }' \
- ../src/frontends/xforms/forms/*.fd > xforms_l10n.pot
-
-$(srcdir)/qt_l10n.pot: $(top_srcdir)/src/frontends/qt2/ui/*.ui
- cd ${srcdir} ; \
+
+qt4_l10n.pot: $(top_srcdir)/src/frontends/qt4/ui/*.ui
LC_ALL=C ; export LC_ALL ; \
- awk ' \
- /<string>/ { \
- line=$$0; \
- sub(/.*<string>/, "", line); \
- sub(/<\/string>.*/, "", line); \
- gsub(/&/, "\\&", line); \
- gsub(/</, "<", line); \
- gsub(/>/, ">", line); \
- gsub(/\"/, "\\\"", line); \
- if (length(line) > 0) \
- printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n",\
- FILENAME, FNR, line); \
- }' \
- ../src/frontends/qt2/ui/*.ui > qt_l10n.pot
-
-$(srcdir)/layouts_l10n.pot: $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc
- cd ${srcdir} ; \
+ python $(srcdir)/lyx_pot.py -b $(top_srcdir) -o $@ -t qt4 ${top_srcdir}/src/frontends/qt4/ui/*.ui
+
+layouts_l10n.pot: $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc
LC_ALL=C ; export LC_ALL ; \
- awk ' \
- /^Style / { \
- line=$$0; \
- sub(/Style /, "", line); \
- printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
- FILENAME, FNR, line); \
- } \
- /GuiName/ { \
- line=$$0; \
- sub(/[[:space:]]*GuiName[[:space:]]*/, "", line); \
- printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
- FILENAME, FNR, line); \
- }' \
- ../lib/layouts/*.layout ../lib/layouts/*.inc > layouts_l10n.pot
-
-$(srcdir)/languages_l10n.pot: $(top_srcdir)/lib/languages
- cd ${srcdir} ; \
- awk ' \
- /^#/ { \
- next; \
- } \
- { \
- match($$0,"\"[^\"]*\""); \
- lang=substr($$0,RSTART,RLENGTH); \
- gsub(/\"/, "", lang); \
- printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
- FILENAME, FNR, lang); \
- }' \
- ../lib/languages > languages_l10n.pot
-
-$(srcdir)/ui_l10n.pot: $(top_srcdir)/lib/ui/*.ui
- cd ${srcdir} ; \
+ python $(srcdir)/lyx_pot.py -b $(top_srcdir) -o $@ -t layouts ${top_srcdir}/lib/layouts/*.layout ${top_srcdir}/lib/layouts/*.inc
+
+languages_l10n.pot: $(top_srcdir)/lib/languages
+ python $(srcdir)/lyx_pot.py -b $(top_srcdir) -o $@ -t languages ${top_srcdir}/lib/languages
+
+ui_l10n.pot: $(top_srcdir)/lib/ui/*.ui $(top_srcdir)/lib/ui/*.inc
LC_ALL=C ; export LC_ALL ; \
- awk ' \
- /^[^#]*Submenu/ { \
- line=$$0; \
- sub(/[^"]*"/, "", line); \
- sub(/".*/, "", line); \
- printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
- FILENAME, FNR, line); \
- } \
- /^[^#]*Toolbar/ { \
- line=$$0; \
- sub(/[^"]*"/, "", line); \
- sub(/".*/, "", line); \
- printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
- FILENAME, FNR, line); \
- } \
- /^[^#]*Item/ { \
- line=$$0; \
- sub(/[^"]*"/, "", line); \
- sub(/".*/, "", line); \
- printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
- FILENAME, FNR, line); \
- }' \
- ../lib/ui/*.ui > ui_l10n.pot
+ python $(srcdir)/lyx_pot.py -b $(top_srcdir) -o $@ -t ui ${top_srcdir}/lib/ui/*.ui ${top_srcdir}/lib/ui/*.inc
+
+i18n.php: $(POFILES) postats.sh
+ (cd $(srcdir) ; ./postats.sh $(POFILES)) >$@
force: