Georg, all,
as an attempt to please you and to fix bug #3332, I produced the
attached patch :-)
The bad news: The translations to the buffer language do not work on my
machine (Win XP) - all translations are made to the menu language,
instead :-(
Could someone please check whether the patch works on Linux at least?
E.g., if you open a Spanish doc in a German environment and export the
doc as plain text, you shouldn't see any German inset labels.
Georg, is this what you had in mind? Any comments on the code itself?
Regards, Michael
PS: Since plaintext output partly depends on screen labels, some screen
labels are also printed in the buffer's language now. Whether this is
preferable, is a matter of taste, of course. From a logical point of
view, it may make sense.
Index: src/insets/InsetCaption.cpp
===
--- src/insets/InsetCaption.cpp (Revision 18124)
+++ src/insets/InsetCaption.cpp (Arbeitskopie)
@@ -134,7 +134,7 @@
int const width_offset = TEXT_TO_INSET_OFFSET / 2;
mi.base.textwidth -= width_offset;
- computeFullLabel();
+ computeFullLabel(*mi.base.bv->buffer());
labelwidth_ = theFontMetrics(mi.base.font).width(full_label_);
// add some space to separate the label from the inset text
@@ -257,7 +257,7 @@
int InsetCaption::plaintext(Buffer const & buf, odocstream & os,
OutputParams const & runparams) const
{
- computeFullLabel();
+ computeFullLabel(buf);
os << '[' << full_label_ << "\n";
InsetText::plaintext(buf, os, runparams);
@@ -278,13 +278,13 @@
}
-void InsetCaption::computeFullLabel() const
+void InsetCaption::computeFullLabel(Buffer const & buf) const
{
if (type_.empty())
- full_label_ = _("Senseless!!! ");
+ full_label_ = buf.B_("Senseless!!! ");
else {
docstring const number = convert(counter_);
- docstring label = custom_label_.empty()? _(type_): custom_label_;
+ docstring label = custom_label_.empty()? buf.B_(type_): custom_label_;
full_label_ = bformat(from_ascii("%1$s %2$s:"), label, number);
}
}
Index: src/insets/InsetFoot.cpp
===
--- src/insets/InsetFoot.cpp (Revision 18124)
+++ src/insets/InsetFoot.cpp (Arbeitskopie)
@@ -13,6 +13,7 @@
#include "InsetFoot.h"
+#include "Buffer.h"
#include "gettext.h"
// the following are needed just to get the layout of the enclosing
// paragraph. This seems a bit too much to me (JMarc)
@@ -82,7 +83,7 @@
int InsetFoot::plaintext(Buffer const & buf, odocstream & os,
OutputParams const & runparams) const
{
- os << '[' << _("footnote") << ":\n";
+ os << '[' << buf.B_("footnote") << ":\n";
InsetText::plaintext(buf, os, runparams);
os << "\n]";
Index: src/insets/InsetMarginal.cpp
===
--- src/insets/InsetMarginal.cpp (Revision 18124)
+++ src/insets/InsetMarginal.cpp (Arbeitskopie)
@@ -13,6 +13,7 @@
#include "InsetMarginal.h"
+#include "Buffer.h"
#include "gettext.h"
#include "Paragraph.h"
#include "OutputParams.h"
@@ -66,7 +67,7 @@
int InsetMarginal::plaintext(Buffer const & buf, odocstream & os,
OutputParams const & runparams) const
{
- os << '[' << _("margin") << ":\n";
+ os << '[' << buf.B_("margin") << ":\n";
InsetText::plaintext(buf, os, runparams);
os << "\n]";
Index: src/insets/InsetBranch.cpp
===
--- src/insets/InsetBranch.cpp (Revision 18124)
+++ src/insets/InsetBranch.cpp (Arbeitskopie)
@@ -235,7 +235,7 @@
if (!isBranchSelected(buf))
return 0;
- os << '[' << _("branch") << ' ' << params_.branch << ":\n";
+ os << '[' << buf.B_("branch") << ' ' << params_.branch << ":\n";
InsetText::plaintext(buf, os, runparams);
os << "\n]";
Index: src/insets/InsetGraphics.cpp
===
--- src/insets/InsetGraphics.cpp (Revision 18124)
+++ src/insets/InsetGraphics.cpp (Arbeitskopie)
@@ -807,7 +807,7 @@
}
-int InsetGraphics::plaintext(Buffer const &, odocstream & os,
+int InsetGraphics::plaintext(Buffer const & buf, odocstream & os,
OutputParams const &) const
{
// No graphics in ascii output. Possible to use gifscii to convert
@@ -818,7 +818,7 @@
// FIXME UNICODE
// FIXME: We have no idea what the encoding of the filename is
- docstring const str = bformat(_("Graphics file: %1$s"),
+ docstring const str = bformat(buf.B_("Graphics file: %1$s"),
from_utf8(params().filename.absFilename()));
os << '<' << str << '>';
Index: src/insets/InsetCaption.h
===
--- src/insets/InsetCaption.h (Revision 18124)
+++ src/insets/InsetCaption.h (Arbeitskopie)
@@ -84,7 +84,7 @@
private:
///
- void computeFullLabel() const;
+ void computeFullLabel(Buffer co