X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=po%2FMakefile.in.in;h=693dc1893d2281d65b6b7e5b56ef0d4db615f6ca;hb=1c155241d88fa2106565711ef94396be42b912a9;hp=5fee5f919e17450551c5128c6fe8b12934d3034e;hpb=893eab90a2b3dd36aa4d5359f5fb76137d83a755;p=lyx.git diff --git a/po/Makefile.in.in b/po/Makefile.in.in index 5fee5f919e..693dc1893d 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -48,7 +48,8 @@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) POFILES = @POFILES@ GMOFILES = @GMOFILES@ DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \ -$(POFILES) $(GMOFILES) +$(POFILES) $(GMOFILES) xforms_l10n.pot qt_l10n.pot layouts_l10n.pot \ +languages_l10n.pot ui_l10n.pot POTFILE_IN_DEPS = $(shell find $(top_srcdir)/src -name Makefile.am) @@ -86,13 +87,13 @@ all-no: # otherwise packages like GCC can not be built if only parts of the source # have been downloaded. -$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in $(top_srcdir)/src/ext_l10n.h - $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ +$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in l10n_pots + $(XGETTEXT) --join-existing --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ --escape --add-comments --keyword=_ --keyword=N_ \ - --files-from=$(srcdir)/POTFILES.in \ + --keyword=qt_ --files-from=$(srcdir)/POTFILES.in \ && test ! -f $(PACKAGE).po \ || ( rm -f $(srcdir)/$(PACKAGE).pot \ - && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot ) + && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot || true) install: install-exec install-data install-exec: @@ -200,21 +201,103 @@ ${srcdir}/POTFILES.in: $(POTFILE_IN_DEPS) && ( cd $(top_srcdir); \ grep -l "_(\".*\")" `find src -name \*.[hHC] -print` |\ sed -e '/xforms.forms/d' | \ - sort -f -n | uniq ) > $@-t \ - && echo "src/ext_l10n.h" >> $@-t \ + LC_COLLATE=C sort | uniq ) > $@-t \ && mv $@-t $@ -$(top_srcdir)/src/ext_l10n.h: $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc $(top_srcdir)/lib/ui/default.ui $(top_srcdir)/lib/languages - sed < $(top_srcdir)/lib/ui/default.ui -n \ - -e 's/.*[sS]ub[mM]enu[^"]*\("[^"]*"\).*/_(\1);/p' \ - -e 's/.*[iI]tem[^"]*\("[^"]*"\).*/_(\1);/p' \ - > $@ - cat $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc | \ - sed -n -e 's/^[sS]tyle[ ]*\([^ ]*\)$$/_("\1");/p' | \ - sort | uniq >> $@ - sed < $(top_srcdir)/lib/languages -e '/^#/d' -e 's/[^"]*\("[A-Za-z0-9][^"]*"\).*/_(\1);/' >> $@ - cat $(top_srcdir)/src/frontends/qt2/ui/*.ui | grep '..*' | \ - sed 's,&,\&,;s,^.*,_(",;s,,"),;' | uniq >> $@ + +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 + +$(srcdir)/xforms_l10n.pot: $(top_srcdir)/src/frontends/xforms/forms/*.fd + 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"; \ + } \ + /label: / { \ + if (NF > 1) { \ + line=$$0;\ + sub(/label: /,"",line);\ + printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", FILENAME, FNR, line);\ + }\ + }' \ + `find $(top_srcdir)/src/frontends/xforms/forms -name \*.fd` > $@ + +$(srcdir)/qt_l10n.pot: $(top_srcdir)/src/frontends/qt2/ui/*.ui + awk ' \ + // { \ + line=$$0; \ + sub(/.*/, "", 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); \ + }' \ + `find $(top_srcdir)/src/frontends/qt2/ui -name \*.ui` > $@ + +$(srcdir)/layouts_l10n.pot: $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc + 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); \ + } \ + ' `find $(top_srcdir)/lib/layouts -regex ".*\.\(layout\|inc\)"` > $@ + +$(srcdir)/languages_l10n.pot: $(top_srcdir)/lib/languages + awk ' \ + /^#/ { \ + next; \ + } \ + { \ + match($$0,"\"[^\"]*\""); \ + lang=substr($$0,RSTART,RLENGTH); \ + gsub(/\"/, "", lang); \ + printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \ + FILENAME, FNR, lang); \ + } \ + ' $(top_srcdir)/lib/languages > $@ + +$(srcdir)/ui_l10n.pot: $(top_srcdir)/lib/ui/*.ui + 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); \ + } \ + ' $(top_srcdir)/lib/ui/*.ui > $@ # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded.