Fix translation of ambiguous messages

* src/frontends/qt4/ui/QPrefConvertersUi.ui: Readd translation hint
	to label and remove broken tooltip that somebody created instead

	* src/messages.C
	(Messages::Pimpl::get): reenable stripping of [[..]] from
	untranslated messages


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15872 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-11-12 09:36:08 +00:00
parent 03d5a4adb7
commit 2c64f84300
3 changed files with 28 additions and 34 deletions

View File

@ -156,8 +156,6 @@ EDITING
MENUS MENUS
* Special handling of [[...]] in text messages is disabled in messages.C
LAYOUT LAYOUT
@ -352,3 +350,6 @@ CREDITS:
window again it has moved towards the bottom of the screen. (Joost 3/11/06) window again it has moved towards the bottom of the screen. (Joost 3/11/06)
FIXED (Peter 8/11/2006) FIXED (Peter 8/11/2006)
* Special handling of [[...]] in text messages is disabled in messages.C
FIXED (Georg 2006-11-12)

View File

@ -146,11 +146,8 @@
</item> </item>
<item row="1" column="0" > <item row="1" column="0" >
<widget class="QLabel" name="converterToLA" > <widget class="QLabel" name="converterToLA" >
<property name="toolTip" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:Sans Serif; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">[[as in 'From format x to format y']]&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="text" > <property name="text" >
<string>&amp;To:</string> <string>&amp;To:[[as in 'From format x to format y']]</string>
</property> </property>
<property name="buddy" > <property name="buddy" >
<cstring>converterToCO</cstring> <cstring>converterToCO</cstring>

View File

@ -170,39 +170,35 @@ public:
} }
textdomain(PACKAGE); textdomain(PACKAGE);
#if 0 char const * tmp = m.c_str();
const char* msg = gettext(m.c_str()); char const * msg = gettext(tmp);
string translated(msg ? msg : m); docstring translated;
// Some english words have different translations, depending if (!msg || msg == tmp) {
// on context. In these cases the original string is if (!msg)
// augmented by context information (e.g. lyxerr << "Undefined result from gettext" << endl;
//else
// lyxerr << "Same as entered returned" << endl;
// Some english words have different translations,
// depending on context. In these cases the original
// string is augmented by context information (e.g.
// "To:[[as in 'From page x to page y']]" and // "To:[[as in 'From page x to page y']]" and
// "To:[[as in 'From format x to format y']]". // "To:[[as in 'From format x to format y']]".
// This means that we need to filter out everything in // This means that we need to filter out everything
// double square brackets at the end of the string, // in double square brackets at the end of the
// otherwise the user sees bogus messages. // string, otherwise the user sees bogus messages.
// If we are unable to honour the request we just // If we are unable to honour the request we just
// return what we got in. // return what we got in.
static boost::regex const reg("^([^\\[]*)\\[\\[[^\\]]*\\]\\]$"); static boost::regex const reg("^([^\\[]*)\\[\\[[^\\]]*\\]\\]$");
boost::smatch sub; boost::smatch sub;
if (regex_match(translated, sub, reg)) if (regex_match(m, sub, reg))
translated = sub.str(1); translated = from_ascii(sub.str(1));
#else else
char const * tmp = m.c_str();
char const * msg = gettext(tmp);
docstring translated;
if (!msg) {
lyxerr << "Undefined result from gettext" << endl;
translated = from_ascii(tmp);
} else if (msg == tmp) {
//lyxerr << "Same as entered returned" << endl;
translated = from_ascii(tmp); translated = from_ascii(tmp);
} else { } else {
lyxerr[Debug::DEBUG] << "We got a translation" << endl; lyxerr[Debug::DEBUG] << "We got a translation" << endl;
char_type const * ucs4 = reinterpret_cast<char_type const *>(msg); char_type const * ucs4 = reinterpret_cast<char_type const *>(msg);
translated = ucs4; translated = ucs4;
} }
#endif
#ifdef HAVE_LC_MESSAGES #ifdef HAVE_LC_MESSAGES
setlocale(LC_MESSAGES, lang.c_str()); setlocale(LC_MESSAGES, lang.c_str());
#endif #endif