Pauli Virtanen <[EMAIL PROTECTED]> writes:
| Hi,
|
| There currently are some problems with localization in LyX 1.3.0cvs (as
| of Dec 3), which might need some fixing.
|
|
| The first three concern extraction of strings from (autogenerated)
| sources to lyx.pot:
|
| 1. Translatable strings from xforms dialogs are not extracted to
| lyx.pot.
Ok, final patch in these series, this time qt extraction from ui files
are also handled as well as...
| 3. Currently strings like "<page>" are extracted as-is from the
| qt ui files, but appear like "<page>" in the source, which makes them
| effectively untranslatable. Ampersand entities & are handled
| explicitly in po/Makefile.in, but other entities are not, which causes
| the problem.
This issue with extraction from ui files.
Index: Makefile.in.in
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/po/Makefile.in.in,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile.in.in
--- Makefile.in.in 16 Apr 2002 21:59:01 -0000 1.20
+++ Makefile.in.in 8 Dec 2002 21:36:48 -0000
@@ -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,6 +204,43 @@ ${srcdir}/POTFILES.in: $(POTFILE_IN_DEPS
&& echo "src/ext_l10n.h" >> $@-t \
&& mv $@-t $@
+
+l10n_pots: xforms_l10n.pot qt_l10n.pot
+ cat xforms_l10n.pot qt_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=$$2;\
+ sub(/label: /,"",line);\
+ printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", FILENAME, FNR, line);\
+ }\
+ }' \
+ `find $(top_srcdir)/src/frontends/xforms/forms -name \*.fd` > $@
+# msguniq -o $@
+
+qt_l10n.pot: $(top_srcdir)/src/frontends/qt2/ui/*.ui
+ awk ' \
+ /<string>/ { \
+ if (NF > 1) { \
+ line=$$0; \
+ sub(/.*<string>/, "", line); \
+ sub(/<\/string>.*/, "", line); \
+ gsub(/&/, "\\&", line); \
+ gsub(/</, "<", line); \
+ gsub(/>/, ">", line); \
+ printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", FILENAME, FNR, line); \
+ } \
+ }' \
+ `find $(top_srcdir)/src/frontends/qt2/ui -name \*.ui` > $@
+# msguniq -o $@
+
$(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' \
@@ -213,8 +250,6 @@ $(top_srcdir)/src/ext_l10n.h: $(top_srcd
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,&,\&,;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.
--
Lgb