From: Bo Peng Date: Thu, 22 Mar 2007 20:12:54 +0000 (+0000) Subject: po/Makefile.in.in, replace awk scripts with the Python version X-Git-Tag: 1.6.10~10542 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1ed357093d44b8c2030f5118e101238de4573375;p=features.git po/Makefile.in.in, replace awk scripts with the Python version git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17512 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/po/Makefile.in.in b/po/Makefile.in.in index 8ac08b8053..3047a087cb 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -381,120 +381,18 @@ l10n_pots: qt4_l10n.pot layouts_l10n.pot languages_l10n.pot ui_l10n.pot qt4_l10n.pot: $(top_srcdir)/src/frontends/qt4/ui/*.ui LC_ALL=C ; export LC_ALL ; \ - $(AWK) -v top_srcdir="$(top_srcdir)" ' \ - function fixupfilename() \ - {\ - return substr(FILENAME, length(top_srcdir "/") + 1);\ - }\ - BEGIN { \ - previousline=""; \ - } \ - { \ - if (!(previousline ~ /^ *< *property *name *= *"shortcut" *> *$$/) \ - && $$0 ~ //) { \ - 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", \ - fixupfilename(), FNR, line); \ - } \ - } \ - previousline=$$0; \ - }' \ - ${top_srcdir}/src/frontends/qt4/ui/*.ui > $@ + python lyx_pot.py -b .. -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) -v top_srcdir="$(top_srcdir)" ' \ - function fixupfilename() \ - {\ - return substr(FILENAME, length(top_srcdir "/") + 1);\ - }\ - /^Style / { \ - line=$$0; \ - sub(/Style /, "", line); \ - gsub(/"/, "", line); \ - gsub(/_/, " ", line); \ - printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \ - fixupfilename(), FNR, line); \ - } \ - /LabelString[A-Za-z]*/ { \ - line=$$0; \ - sub(/[[:space:]]*LabelString[A-Za-z]*[[:space:]]*/, "", line); \ - gsub(/"/, "", line); \ - if (line != "") \ - printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \ - fixupfilename(), FNR, line); \ - } \ - /GuiName/ { \ - line=$$0; \ - sub(/[[:space:]]*GuiName[[:space:]]*/, "", line); \ - gsub(/"/, "", line); \ - printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \ - fixupfilename(), FNR, line); \ - } \ - /ListName/ { \ - line=$$0; \ - sub(/[[:space:]]*ListName[[:space:]]*/, "", line); \ - gsub(/"/, "", line); \ - printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \ - fixupfilename(), FNR, line); \ - }' \ - ${top_srcdir}/lib/layouts/*.layout ${top_srcdir}/lib/layouts/*.inc \ - | sed 's/\\/\\\\/g' > $@ + python lyx_pot.py -b .. -o $@ -t layouts ${top_srcdir}/lib/layouts/*.layout ${top_srcdir}/lib/layouts/*.inc languages_l10n.pot: $(top_srcdir)/lib/languages - $(AWK) -v top_srcdir="$(top_srcdir)" ' \ - function fixupfilename() \ - {\ - return substr(FILENAME, length(top_srcdir "/") + 1);\ - }\ - /^#/ { \ - next; \ - } \ - { \ - match($$0,"\"[^\"]*\""); \ - lang=substr($$0,RSTART,RLENGTH); \ - gsub(/"/, "", lang); \ - printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \ - fixupfilename(), FNR, lang); \ - }' \ - ${top_srcdir}/lib/languages > $@ + python lyx_pot.py -b .. -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) -v top_srcdir="$(top_srcdir)" ' \ - function fixupfilename() \ - {\ - return substr(FILENAME, length(top_srcdir "/") + 1);\ - }\ - /^[^#]*Submenu/ { \ - line=$$0; \ - sub(/[^"]*"/, "", line); \ - sub(/".*/, "", line); \ - printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \ - fixupfilename(), FNR, line); \ - } \ - /^[^#]*Toolbar[^s]/ { \ - line=$$0; \ - sub(/[^"]*"[^"]*"[^"]"*/, "", line); \ - sub(/".*/, "", line); \ - printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \ - fixupfilename(), FNR, line); \ - } \ - /^[^#]*Item/ { \ - line=$$0; \ - sub(/[^"]*"/, "", line); \ - sub(/".*/, "", line); \ - printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \ - fixupfilename(), FNR, line); \ - }' \ - ${top_srcdir}/lib/ui/*.ui ${top_srcdir}/lib/ui/*.inc > $@ + python lyx_pot.py -b .. -o $@ -t ui ${top_srcdir}/lib/ui/*.ui ${top_srcdir}/lib/ui/*.inc i18n.php: $(POFILES) postats.sh (cd $(srcdir) ; ./postats.sh $(POFILES)) >$@ diff --git a/po/lyx_pot.py b/po/lyx_pot.py index 5660e45abd..9dc78f0874 100755 --- a/po/lyx_pot.py +++ b/po/lyx_pot.py @@ -23,7 +23,7 @@ def relativePath(path, base): '''return relative path from top source dir''' # full pathname of path path1 = os.path.normpath(os.path.realpath(path)).split(os.sep) - path2 = os.path.normpath(base).split(os.sep) + path2 = os.path.normpath(os.path.realpath(base)).split(os.sep) if path1[:len(path2)] != path2: print "Path %s is not under top source directory" % path return os.path.join(*path1[len(path2):])