mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
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
This commit is contained in:
parent
90f39c2dca
commit
1ed357093d
@ -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 ~ /<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", \
|
||||
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)) >$@
|
||||
|
@ -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):])
|
||||
|
Loading…
Reference in New Issue
Block a user