On 04/15/2015 05:57 AM, Jean-Marc Lasgouttes wrote:
Hi Richard,

I have a question about an old commit (see bleow). Basically, what you do here causes the message machinery to be invoked before the locale is properly set up. It is not a big problem per se, but the patch looks very dubious to me. Can you remember what the problem was?

Yes, see below.

commit c4f8a516bd917acdf305891f46f29138bd92b8c7
Author: Richard Heck <rgh...@comcast.net>
Date:   Tue Apr 15 15:32:02 2008 +0000

This string cannot be translated here, because it is a layout identifier.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24266a592a061-630c-0410-9148-cb99ea01b6c8

diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index a735710..0ed38f3 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -109,7 +109,8 @@ std::string translateRT(TextClass::ReadType rt)
 } // namespace anon


-docstring const TextClass::emptylayout_ = from_ascii(N_("Plain Layout"));
+// This string cannot be translated, because it is a layout identifier.
+docstring const TextClass::emptylayout_ = from_ascii("Plain Layout");

If you look at TextClass.cpp from c4f8a516b, we have e.g.:
    lay.setName(emptylayout_);
This failed if emptylayout_ was translated. On the other hand, however...

InsetLayout DocumentClass::empty_insetlayout_;
@@ -129,6 +130,7 @@ TextClass::TextClass()
        titletype_ = TITLE_COMMAND_AFTER;
        titlename_ = "maketitle";
        loaded_ = false;
+       _("Plain Layout"); // a hack to make this translatable
 }

we do want to translate that string when it's present in the layout combo. So someone suggested this hack.

The emptylayout_ variable got removed at some point, though, so any way of making this string translatable by the GUI will do.

Richard

Reply via email to