]> git.lyx.org Git - features.git/commitdiff
add targets for l10n extraction
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 9 Dec 2002 00:45:06 +0000 (00:45 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 9 Dec 2002 00:45:06 +0000 (00:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5793 a592a061-630c-0410-9148-cb99ea01b6c8

po/.cvsignore
po/ChangeLog
po/Makefile.in.in

index b04a2fc1dadfc752ccccfd91607d757cfee08f58..d2a9c2db00a4b8ec3c11412b1e3aa72d307234c0 100644 (file)
@@ -7,3 +7,6 @@ POTFILES.in
 cat-id-tbl.c
 stamp-cat-id
 lyx.pot
+layouts_l10n.pot
+qt_l10n.pot
+xforms_l10n.pot
index 6a2825848f8e04ef5ac1c0aa7a73c9728b762730..b484931379ee62432c0d2ccc40bec4c45ab03f7c 100644 (file)
@@ -1,3 +1,13 @@
+2002-12-09  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * Makefile.in.in (layouts_l10n.pot): new target
+       (qt_l10n.pot): new target
+       (xforms_l10n.pot): new target
+       (l10n_pots): new target
+       ($(top_srcdir)/src/ext_l10n.h): remove layout parsing and qt
+       parsing, move to their own targets.
+       ($(srcdir)/$(PACKAGE).pot): depend on l10n_pots
+
 2002-12-08  Claus Hindsgaul  <claus_h@image.dk>
 
        * da.po: update da.po
index 5fee5f919e17450551c5128c6fe8b12934d3034e..9a025d856a5875b44c7c034ec062a252e5ae33de 100644 (file)
@@ -86,8 +86,8 @@ 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 $(top_srcdir)/src/ext_l10n.h l10n_pots
+       $(XGETTEXT) --join-existing --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
          --escape --add-comments --keyword=_ --keyword=N_ \
          --files-from=$(srcdir)/POTFILES.in \
        && test ! -f $(PACKAGE).po \
@@ -204,17 +204,65 @@ ${srcdir}/POTFILES.in: $(POTFILE_IN_DEPS)
        && echo "src/ext_l10n.h" >> $@-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
+
+l10n_pots: xforms_l10n.pot qt_l10n.pot layouts_l10n.pot
+       cat xforms_l10n.pot qt_l10n.pot layouts_l10n.pot | \
+       msguniq -o $(PACKAGE).po
+
+xforms_l10n.pot: $(top_srcdir)/src/frontends/xforms/forms/*.fd
+       awk ' \
+            BEGIN { \
+                    print "msgid \"\""; \
+                    print "msgstr \"\""; \
+                    print "\"Content-Type: text/plain; charset=ISO-8859-1\\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` > $@
+
+qt_l10n.pot: $(top_srcdir)/src/frontends/qt2/ui/*.ui
+       awk ' \
+            /<string>/ { \
+                    if (NF > 1) { \
+                            line=$$0; \
+                            sub(/.*<string>/, "", line); \
+                            sub(/<\/string>.*/, "", line); \
+                            gsub(/&amp;/, "\\&", line); \
+                            gsub(/&lt;/, "<", line); \
+                            gsub(/&gt;/, ">", line); \
+                            printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n",\
+                            FILENAME, FNR, line); \
+                    } \
+            }' \
+       `find $(top_srcdir)/src/frontends/qt2/ui -name \*.ui` > $@
+
+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\)"` > $@
+
+$(top_srcdir)/src/ext_l10n.h: $(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 '<string>..*</string>' | \
-               sed 's,&amp;,\&,;s,^.*<string>,_(",;s,</string>,"),;' | uniq >> $@
 
 # 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.