On Sun, 8 Dec 2002 03:11:46 +0000 John Levon <[EMAIL PROTECTED]> wrote:
> On Sun, Dec 08, 2002 at 12:40:26AM +0200, Pauli Virtanen wrote: > > > 2. At least with Qt 3.0.5, uic puts trUtf8() instead of tr() in the > > source files it generates, which the sed script in > > src/frontends/qt2/ui/Makefile.am does not replace with _() as it > > should. This causes the translations of dialogs to not appear when > > running (although translatable strings are properly extracted to > > lyx.pot). The attached 'qt3-trUtf8-replace.patch' fixes this, but > > perhaps using the -tr switch of uic would be a cleaner solution (if > > it works with uic from qt2). > > A ha ! > > Qt 2.3.1 supports uic -tr. Well spotted, this is much nicer - can you > make me a patch to use this in the makefiles and remove the sed hack ? The attached 'uic-tr.patch' does this. Seemed to compile and work fine. Note that _() is redefined in src/gettext.h so that _("") does not return the po file header, so I removed also the _("") -> "" transformation hack. > > 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. > > Do you have ideas on what to do about this ? The attached 'ui-transform-entities.patch' solves this for now just by translating < and > explicitly to < and > like uic does, so the strings appearing in src/ext_l10n.h match those of the generated source files. If also other entities appear, they should be handled likewise in po/Makefile.in.in. (But currently &, <, and > seem to be the only ones.) A more general approach would be to first generate the sources and then harvest the strings from them with xgettext, which would work also with other front-ends than QT. However, this requires the translators to have all the autogeneration tools (uic for QT, fdesign for xforms, glade for gnome, etc...) for every front-end installed (and extraction should issue an error if one is missing). The other (more failure-prone) way is to do the string extraction directly with custom scripts, like it is done now for QT. Parsing the xforms .fd files for translatable strings shouldn't be very hard to do, and newest xgettext has some support for glade files. I am not quite sure which approach is better. The former does require the translators to have all the code-generation tools for each frontend available, while the latter does not. However, the first one is quite a bit simpler to implement, because the makefile rules for code generation are there already. (At least for xforms this should be decided soon: currently all the texts in dialogs are untranslatable, since they are not extracted to lyx.pot.) > > 4. The strings "figure", "table", etc. in the "Type" drop down box > > in .. > > 5. In src/frontends/xforms/FormDocument.C some strings like > > 6. Xgettext guesses that the string "Select unit for width; Scale% > > for > > Can you file issues for each separate bug on bugzilla.lyx.org under > component "translations" Done. -- Pauli Virtanen
--- cvs/lyx/lyx-devel/po/Makefile.in.in Wed Apr 17 18:33:38 2002 +++ lyx-devel-qt/po/Makefile.in.in Sun Dec 8 17:05:19 2002 @@ -214,7 +214,7 @@ 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 >> $@ + sed 's,^.*<string>,_(",;s,</string>,"),;s,&,\&,g;s,<,<,g;s,>,>,g;' | 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.
--- cvs/lyx/lyx-devel/src/frontends/qt2/ui/Makefile.am Tue Nov 19 22:54:43 2002 +++ lyx-devel-qt/src/frontends/qt2/ui/Makefile.am Sun Dec 8 18:36:09 2002 @@ -20,69 +20,66 @@ libqt2ui.la: $(libqt2ui_la_OBJECTS) $(libqt2ui_la_DEPENDENCIES) -# a pattern to change tr() to _() - -SED = sed -SEDREPLACETR = s,[^A-Za-z]tr[ ]*(,_(,g -SEDREMOVEEMPTY = s,_[ ]*([ ]*""[ ]*),"",g +# Use _() for localization instead of tr() or trUtf8() +UICFLAGS=-tr _ QAskForTextDialog.h: QAskForTextDialog.ui - $(UIC) $< -o $@ + $(UIC) $(UICFLAGS) $< -o $@ QAskForTextDialog.C: QAskForTextDialog.h QAskForTextDialog.ui - $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@ + $(UIC) $(UICFLAGS) -impl $^ -o $@ ClassModuleBase.h: ClassModuleBase.ui - $(UIC) $< -o $@ + $(UIC) $(UICFLAGS) $< -o $@ ClassModuleBase.C: ClassModuleBase.h ClassModuleBase.ui - $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@ + $(UIC) $(UICFLAGS) -impl $^ -o $@ BulletsModuleBase.h: BulletsModuleBase.ui - $(UIC) $< -o $@ + $(UIC) $(UICFLAGS) $< -o $@ BulletsModuleBase.C: BulletsModuleBase.h BulletsModuleBase.ui - $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@ + $(UIC) $(UICFLAGS) -impl $^ -o $@ PackagesModuleBase.h: PackagesModuleBase.ui - $(UIC) $< -o $@ + $(UIC) $(UICFLAGS) $< -o $@ PackagesModuleBase.C: PackagesModuleBase.h PackagesModuleBase.ui - $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@ + $(UIC) $(UICFLAGS) -impl $^ -o $@ PaperModuleBase.h: PaperModuleBase.ui - $(UIC) $< -o $@ + $(UIC) $(UICFLAGS) $< -o $@ PaperModuleBase.C: PaperModuleBase.h PaperModuleBase.ui - $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@ + $(UIC) $(UICFLAGS) -impl $^ -o $@ MarginsModuleBase.h: MarginsModuleBase.ui - $(UIC) $< -o $@ + $(UIC) $(UICFLAGS) $< -o $@ MarginsModuleBase.C: MarginsModuleBase.h MarginsModuleBase.ui - $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@ + $(UIC) $(UICFLAGS) -impl $^ -o $@ LanguageModuleBase.h: LanguageModuleBase.ui - $(UIC) $< -o $@ + $(UIC) $(UICFLAGS) $< -o $@ LanguageModuleBase.C: LanguageModuleBase.h LanguageModuleBase.ui - $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@ + $(UIC) $(UICFLAGS) -impl $^ -o $@ NumberingModuleBase.h: NumberingModuleBase.ui - $(UIC) $< -o $@ + $(UIC) $(UICFLAGS) $< -o $@ NumberingModuleBase.C: NumberingModuleBase.h NumberingModuleBase.ui - $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@ + $(UIC) $(UICFLAGS) -impl $^ -o $@ BiblioModuleBase.h: BiblioModuleBase.ui - $(UIC) $< -o $@ + $(UIC) $(UICFLAGS) $< -o $@ BiblioModuleBase.C: BiblioModuleBase.h BiblioModuleBase.ui - $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@ + $(UIC) $(UICFLAGS) -impl $^ -o $@ PreambleModuleBase.h: PreambleModuleBase.ui - $(UIC) $< -o $@ + $(UIC) $(UICFLAGS) $< -o $@ PreambleModuleBase.C: PreambleModuleBase.h PreambleModuleBase.ui - $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@ + $(UIC) $(UICFLAGS) -impl $^ -o $@ %Module.h: %Module.ui - $(UIC) $< -o $@ + $(UIC) $(UICFLAGS) $< -o $@ %Module.C: %Module.h %Module.ui - $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@ + $(UIC) $(UICFLAGS) -impl $^ -o $@ %Base.h: %.ui - $(UIC) $< -o $@ + $(UIC) $(UICFLAGS) $< -o $@ %Base.C: %Base.h %.ui - $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@ + $(UIC) $(UICFLAGS) -impl $^ -o $@