Jean-Marc Lasgouttes wrote:

>>>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]>
>>>>>> writes:
> 
> Angus> Why not use strings "Menu|File|Open" etc and then define an
> Angus> "en" po file. Jean-Marc has already established the precedent
> Angus> by ensuring that only ASCII characters are passed to the
> Angus> translation functions.
> 
> Or we could allow for a different syntax like "To|[EMAIL PROTECTED]", where the
> part after @ is ignored in the shortcut.

This would be specific to xforms. So we would need something similar to my
first proposal in addition.

I investigated Angus' proposal a bit. The solution with the english
translation still has the problem that it should be used as fallback for
untranslated languages. I found out that a fallback translation is possible
with GNU gettext (see first patch).

Questions:
1. Do we ever use any other gettext than GNU gettext?
2. Is HAVE_LC_MESSAGES ever undefined?

If the answer to at least one questions is "yes", then this solution will
not work.

A simpler version is attached in the second patch. Here remain some
questions, too:

1. Is it necessary to call bindtextdomain() and textdomain() again for the
english translation? As I understood the gettext documentation, these
functions are normally called only once at program startup. There must be a
reason to call them every time a translated message is requested, so I
added them a second time.
2. In many cases the second gettext call is executed although it is not
needed. Is this a performance problem? I should probably use the profiler,
but how do I simulate a typical usage?

Both versions work (at least on linux). I would tend towards the second
version, but if it has performance problems, we might need gettext to sort
out the right translation (first patch).
Opinions?

The only things that still needs to be done is a bit of documentation for
the translators. Where should this be added?

One last remark: I updated the .po files by hand, because "make update-po"
produced large changes, and running this is not possible with builddir !=
srcdir.


Georg
Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/ChangeLog,v
retrieving revision 1.974
diff -u -r1.974 ChangeLog
--- ChangeLog	4 Sep 2004 12:13:48 -0000	1.974
+++ ChangeLog	10 Sep 2004 15:47:49 -0000
@@ -1,3 +1,7 @@
+2004-09-10  Georg Baum  <[EMAIL PROTECTED]>
+
+	* configure.ac (ALL_LINGUAS): add "en"
+
 2004-09-04  Lars Gullik Bjonnes  <[EMAIL PROTECTED]>
 
 	* configure.ac (AC_CONFIG_FILES): add src/client/Makefile
Index: configure.ac
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/configure.ac,v
retrieving revision 1.25
diff -u -r1.25 configure.ac
--- configure.ac	4 Sep 2004 12:13:48 -0000	1.25
+++ configure.ac	10 Sep 2004 15:37:14 -0000
@@ -20,7 +20,7 @@
 
 # The list of languages known to LyX
 # This is needed by GNU gettext
-ALL_LINGUAS="bg ca cs da de es eu fi fr he hu it nl nn no pl pt ro ru sk sl sv tr wa"
+ALL_LINGUAS="bg ca cs da de en es eu fi fr he hu it nl nn no pl pt ro ru sk sl sv tr wa"
 
 # fix the value of the prefixes.
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
Index: po/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/po/ChangeLog,v
retrieving revision 1.188
diff -u -r1.188 ChangeLog
--- po/ChangeLog	3 Aug 2004 10:09:46 -0000	1.188
+++ po/ChangeLog	10 Sep 2004 15:37:28 -0000
@@ -1,3 +1,9 @@
+2004-09-10  Georg Baum  <[EMAIL PROTECTED]>
+
+	* en.po: new, provide english translations for strings with context
+	information
+	* de.po: update strings with context information
+
 2004-08-03  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* Makefile.in.in (POTFILES.in): fix portability problem with Mac
--- po/en.po	2004-09-10 17:45:51.000000000 +0200
+++ po/en.po	2004-09-07 08:41:04.000000000 +0200
@@ -0,0 +1,32 @@
+# english translation
+# the only translated strings are those which contain an additional
+# translation hint, e.g.
+# "To:[translation hint: as in 'From page x to page y'] becomes "To:".
+msgid ""
+msgstr ""
+"Project-Id-Version: LyX 1.4.0\n"
+"Report-Msgid-Bugs-To: [EMAIL PROTECTED]"
+"POT-Creation-Date: 2004-07-25 14:19+0200\n"
+"PO-Revision-Date: 2004-06-01 20:56+0200\n"
+"Last-Translator: Georg Baum <[EMAIL PROTECTED]>\n"
+"Language-Team: English <[EMAIL PROTECTED]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/frontends/xforms/forms/form_preferences.fd:1960
+msgid "To:|#T[translation hint: as in 'From format x to format y']"
+msgstr "To:|#T"
+
+#: src/frontends/xforms/forms/form_print.fd:188
+msgid "To:|#T[translation hint: as in 'From page x to page y']"
+msgstr "To:|#T"
+
+#: src/frontends/qt2/ui/QPrefConvertersModule.ui:220
+msgid "&To:[translation hint: as in 'From format x to format y']"
+msgstr "&To:"
+
+#: src/frontends/qt2/ui/QPrintDialogBase.ui:112
+msgid "&To:[translation hint: as in 'From page x to page y']"
+msgstr "&To:"
+
Index: po/de.po
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/po/de.po,v
retrieving revision 1.91
diff -u -r1.91 de.po
--- po/de.po	2 Aug 2004 14:32:23 -0000	1.91
+++ po/de.po	10 Sep 2004 15:37:32 -0000
@@ -1538,8 +1538,7 @@
 msgstr "Von:|#V"
 
 #: src/frontends/xforms/forms/form_preferences.fd:1960
-#: src/frontends/xforms/forms/form_print.fd:188
-msgid "To:|#T"
+msgid "To:|#T[translation hint: as in 'From format x to format y']"
 msgstr "Nach:|#N"
 
 #: src/frontends/xforms/forms/form_preferences.fd:1978
@@ -1726,6 +1725,10 @@
 msgid "Sorted|#S"
 msgstr "Sortiert|#S"
 
+#: src/frontends/xforms/forms/form_print.fd:188
+msgid "To:|#T[translation hint: as in 'From page x to page y']"
+msgstr "Bis:|#B"
+
 #: src/frontends/xforms/forms/form_print.fd:224
 msgid "Reverse order|#R"
 msgstr "Umgekehrte Reihenfolge|#R"
@@ -3997,7 +4000,7 @@
 msgstr "&Konverter:"
 
 #: src/frontends/qt2/ui/QPrefConvertersModule.ui:220
-msgid "&To:"
+msgid "&To:[translation hint: as in 'From format x to format y']"
 msgstr "&Nach:"
 
 #: src/frontends/qt2/ui/QPrefConvertersModule.ui:235
@@ -4515,8 +4518,8 @@
 msgstr "Drucke ab Seite Nr."
 
 #: src/frontends/qt2/ui/QPrintDialogBase.ui:112
-msgid "&to"
-msgstr "&bis"
+msgid "&To:[translation hint: as in 'From page x to page y']"
+msgstr "&Bis:"
 
 #: src/frontends/qt2/ui/QPrintDialogBase.ui:131
 msgid "Page number to print to"
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.1977
diff -u -r1.1977 ChangeLog
--- src/ChangeLog	4 Sep 2004 12:13:48 -0000	1.1977
+++ src/ChangeLog	10 Sep 2004 15:37:37 -0000
@@ -1,3 +1,9 @@
+2004-09-10  Georg Baum  <[EMAIL PROTECTED]>
+
+	* messages.C (Pimpl): use english translation as fallback if no
+	translation was found in the desired language. This enables us to
+	supply context information in translated strings.
+
 2004-09-04  Lars Gullik Bjonnes  <[EMAIL PROTECTED]>
 
 	* client: new dir
Index: src/messages.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/messages.C,v
retrieving revision 1.16
diff -u -r1.16 messages.C
--- src/messages.C	8 Jun 2004 14:06:10 -0000	1.16
+++ src/messages.C	10 Sep 2004 15:48:36 -0000
@@ -11,10 +11,12 @@
 
 #include "messages.h"
 #include "support/filetools.h"
+#include "support/lyxlib.h"
 #include "support/path_defines.h"
 
 using lyx::support::GetEnvPath;
 using lyx::support::lyx_localedir;
+using lyx::support::putenv;
 
 using std::string;
 
@@ -78,9 +80,43 @@
 // This is a more traditional variant.
 class Messages::Pimpl {
 public:
+	// Some english words have different translations, depending on
+	// context. These cases are handled with an english translation:
+	// The original string is augmented by context information (e.g.
+	// "To:[translation hint: as in 'From page x to page y']" and
+	// "To:[translation hint: as in 'From format x to format y']", and
+	// the english translation of both strings is "To:".
+	// This means that we need the english translation as fallback, if
+	// no translation for the current language is available, otherwise
+	// the user sees bogus messages.
+	// We accomplish this with a feature that is only available in
+	// GNU gettext: If the environment variable LANGUAGE contains a
+	// list of languages (separated by colons), it searches the catalogs
+	// of the corresponding languages until a translation is found.
 	Pimpl(string const & l)
-		: lang_(l)
+		// $LANGUAGE is not evaluated if $LC_* == "C"
+		: locale_(l == "C" ? "en_US" : l)
 	{
+		// primary language
+		if (locale_.empty()) {
+			// We can't use LC_ALL because it returns an
+			// opaque string. LC_MESSAGES returns something
+			// like "en_US" which can be used in $LANGUAGE.
+#ifdef HAVE_LC_MESSAGES
+			languages_ = setlocale(LC_MESSAGES, 0);
+#else
+#error This works only with LC_MESSAGES in locale.h
+#endif
+		} else
+			languages_ = locale_;
+
+		// add fallback
+		if (languages_ != "en_US")
+			languages_ += ":en_US";
+
+		// problem: the fallback will not work if the first entry of
+		// languages_ is not understood by gettext
+
 		//lyxerr << "Messages: language(" << l
 		//       << ") in dir(" << dir << ")" << std::endl;
 
@@ -93,20 +129,27 @@
 		if (m.empty())
 			return m;
 
-		char * old = strdup(setlocale(LC_ALL, 0));
-		char * n = setlocale(LC_ALL, lang_.c_str());
+		char * old_locale = strdup(setlocale(LC_ALL, 0));
+		char * old_language = getenv("LANGUAGE");
+		bool const success = setlocale(LC_ALL, locale_.c_str()) &&
+		                     putenv("LANGUAGE", languages_.c_str());
 		bindtextdomain(PACKAGE, lyx_localedir().c_str());
 		textdomain(PACKAGE);
 		const char* msg = gettext(m.c_str());
-		setlocale(LC_ALL, old);
-		free(old);
+		setlocale(LC_ALL, old_locale);
+		free(old_locale);
+		if (old_language)
+			putenv(old_language);
+
 		// If we are unable to honour the request we just
 		// return what we got in.
-		return (!n ? m : string(msg));
+		return (success ? string(msg) : m);
 	}
 private:
-	///
-	string lang_;
+	/// locale for translations
+	string locale_;
+	/// colon separated list of languages
+	string languages_;
 };
 #endif
 
Index: src/messages.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/messages.h,v
retrieving revision 1.8
diff -u -r1.8 messages.h
--- src/messages.h	7 Oct 2003 06:45:24 -0000	1.8
+++ src/messages.h	10 Sep 2004 15:37:39 -0000
@@ -17,9 +17,9 @@
 ///
 class Messages {
 public:
-	///
+	/// messages in the language defined by the environment
 	Messages();
-	///
+	/// messages in the language \p l
 	Messages(std::string const & l);
 	///
 	~Messages();
Index: src/frontends/qt2/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.712
diff -u -r1.712 ChangeLog
--- src/frontends/qt2/ChangeLog	19 Aug 2004 06:30:43 -0000	1.712
+++ src/frontends/qt2/ChangeLog	10 Sep 2004 15:59:10 -0000
@@ -1,3 +1,8 @@
+2004-09-10  Georg Baum  <[EMAIL PROTECTED]>
+
+	* ui/QPrefConvertersModule.ui: Add translation context to "To:"
+	* ui/QPrintDialogBase.ui: ditto
+
 2004-08-19  Georg Baum  <[EMAIL PROTECTED]>
 
 	* BulletsModule.C (setBullet): use toqstr() for a string passed to
Index: src/frontends/qt2/ui/QPrefConvertersModule.ui
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ui/QPrefConvertersModule.ui,v
retrieving revision 1.6
diff -u -r1.6 QPrefConvertersModule.ui
--- src/frontends/qt2/ui/QPrefConvertersModule.ui	28 Mar 2003 01:21:42 -0000	1.6
+++ src/frontends/qt2/ui/QPrefConvertersModule.ui	10 Sep 2004 15:37:42 -0000
@@ -217,7 +217,7 @@
                             </property>
                             <property stdset="1">
                                 <name>text</name>
-                                <string>&amp;To:</string>
+                                <string>&amp;To:[translation hint: as in 'From format x to format y']</string>
                             </property>
                             <property>
                                 <name>buddy</name>
Index: src/frontends/qt2/ui/QPrintDialogBase.ui
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ui/QPrintDialogBase.ui,v
retrieving revision 1.3
diff -u -r1.3 QPrintDialogBase.ui
--- src/frontends/qt2/ui/QPrintDialogBase.ui	14 Jun 2003 15:13:55 -0000	1.3
+++ src/frontends/qt2/ui/QPrintDialogBase.ui	10 Sep 2004 15:37:42 -0000
@@ -109,7 +109,7 @@
                                     </property>
                                     <property stdset="1">
                                         <name>text</name>
-                                        <string>&amp;to</string>
+                                        <string>&amp;To:[translation hint: as in 'From page x to page y']</string>
                                     </property>
                                     <property>
                                         <name>buddy</name>
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.933
diff -u -r1.933 ChangeLog
--- src/frontends/xforms/ChangeLog	29 Aug 2004 23:52:47 -0000	1.933
+++ src/frontends/xforms/ChangeLog	10 Sep 2004 15:59:09 -0000
@@ -1,3 +1,8 @@
+2004-09-10  Georg Baum  <[EMAIL PROTECTED]>
+
+	* forms/form_preferences.fd: Add translation context to "To:"
+	* forms/form_print.fd: ditto
+		
 2004-08-30  Lars Gullik Bjonnes  <[EMAIL PROTECTED]>
 
 	* forms/pch.h: make it better
Index: src/frontends/xforms/forms/form_preferences.fd
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/form_preferences.fd,v
retrieving revision 1.67
diff -u -r1.67 form_preferences.fd
--- src/frontends/xforms/forms/form_preferences.fd	19 Apr 2004 13:31:16 -0000	1.67
+++ src/frontends/xforms/forms/form_preferences.fd	10 Sep 2004 15:37:45 -0000
@@ -1957,7 +1957,7 @@
 style: FL_NORMAL_STYLE
 size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
-label: To:|#T
+label: To:|#T[translation hint: as in 'From format x to format y']
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
Index: src/frontends/xforms/forms/form_print.fd
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/form_print.fd,v
retrieving revision 1.19
diff -u -r1.19 form_print.fd
--- src/frontends/xforms/forms/form_print.fd	28 Mar 2004 14:12:33 -0000	1.19
+++ src/frontends/xforms/forms/form_print.fd	10 Sep 2004 15:37:45 -0000
@@ -185,7 +185,7 @@
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: To:|#T
+label: To:|#T[translation hint: as in 'From page x to page y']
 shortcut: 
 resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/ChangeLog,v
retrieving revision 1.974
diff -u -r1.974 ChangeLog
--- ChangeLog	4 Sep 2004 12:13:48 -0000	1.974
+++ ChangeLog	10 Sep 2004 15:47:49 -0000
@@ -1,3 +1,7 @@
+2004-09-10  Georg Baum  <[EMAIL PROTECTED]>
+
+	* configure.ac (ALL_LINGUAS): add "en"
+
 2004-09-04  Lars Gullik Bjonnes  <[EMAIL PROTECTED]>
 
 	* configure.ac (AC_CONFIG_FILES): add src/client/Makefile
Index: configure.ac
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/configure.ac,v
retrieving revision 1.25
diff -u -r1.25 configure.ac
--- configure.ac	4 Sep 2004 12:13:48 -0000	1.25
+++ configure.ac	10 Sep 2004 15:37:14 -0000
@@ -20,7 +20,7 @@
 
 # The list of languages known to LyX
 # This is needed by GNU gettext
-ALL_LINGUAS="bg ca cs da de es eu fi fr he hu it nl nn no pl pt ro ru sk sl sv tr wa"
+ALL_LINGUAS="bg ca cs da de en es eu fi fr he hu it nl nn no pl pt ro ru sk sl sv tr wa"
 
 # fix the value of the prefixes.
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
Index: po/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/po/ChangeLog,v
retrieving revision 1.188
diff -u -r1.188 ChangeLog
--- po/ChangeLog	3 Aug 2004 10:09:46 -0000	1.188
+++ po/ChangeLog	10 Sep 2004 15:37:28 -0000
@@ -1,3 +1,9 @@
+2004-09-10  Georg Baum  <[EMAIL PROTECTED]>
+
+	* en.po: new, provide english translations for strings with context
+	information
+	* de.po: update strings with context information
+
 2004-08-03  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* Makefile.in.in (POTFILES.in): fix portability problem with Mac
--- po/en.po	2004-09-10 17:45:51.000000000 +0200
+++ po/en.po	2004-09-07 08:41:04.000000000 +0200
@@ -0,0 +1,32 @@
+# english translation
+# the only translated strings are those which contain an additional
+# translation hint, e.g.
+# "To:[translation hint: as in 'From page x to page y'] becomes "To:".
+msgid ""
+msgstr ""
+"Project-Id-Version: LyX 1.4.0\n"
+"Report-Msgid-Bugs-To: [EMAIL PROTECTED]"
+"POT-Creation-Date: 2004-07-25 14:19+0200\n"
+"PO-Revision-Date: 2004-06-01 20:56+0200\n"
+"Last-Translator: Georg Baum <[EMAIL PROTECTED]>\n"
+"Language-Team: English <[EMAIL PROTECTED]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/frontends/xforms/forms/form_preferences.fd:1960
+msgid "To:|#T[translation hint: as in 'From format x to format y']"
+msgstr "To:|#T"
+
+#: src/frontends/xforms/forms/form_print.fd:188
+msgid "To:|#T[translation hint: as in 'From page x to page y']"
+msgstr "To:|#T"
+
+#: src/frontends/qt2/ui/QPrefConvertersModule.ui:220
+msgid "&To:[translation hint: as in 'From format x to format y']"
+msgstr "&To:"
+
+#: src/frontends/qt2/ui/QPrintDialogBase.ui:112
+msgid "&To:[translation hint: as in 'From page x to page y']"
+msgstr "&To:"
+
Index: po/de.po
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/po/de.po,v
retrieving revision 1.91
diff -u -r1.91 de.po
--- po/de.po	2 Aug 2004 14:32:23 -0000	1.91
+++ po/de.po	10 Sep 2004 15:37:32 -0000
@@ -1538,8 +1538,7 @@
 msgstr "Von:|#V"
 
 #: src/frontends/xforms/forms/form_preferences.fd:1960
-#: src/frontends/xforms/forms/form_print.fd:188
-msgid "To:|#T"
+msgid "To:|#T[translation hint: as in 'From format x to format y']"
 msgstr "Nach:|#N"
 
 #: src/frontends/xforms/forms/form_preferences.fd:1978
@@ -1726,6 +1725,10 @@
 msgid "Sorted|#S"
 msgstr "Sortiert|#S"
 
+#: src/frontends/xforms/forms/form_print.fd:188
+msgid "To:|#T[translation hint: as in 'From page x to page y']"
+msgstr "Bis:|#B"
+
 #: src/frontends/xforms/forms/form_print.fd:224
 msgid "Reverse order|#R"
 msgstr "Umgekehrte Reihenfolge|#R"
@@ -3997,7 +4000,7 @@
 msgstr "&Konverter:"
 
 #: src/frontends/qt2/ui/QPrefConvertersModule.ui:220
-msgid "&To:"
+msgid "&To:[translation hint: as in 'From format x to format y']"
 msgstr "&Nach:"
 
 #: src/frontends/qt2/ui/QPrefConvertersModule.ui:235
@@ -4515,8 +4518,8 @@
 msgstr "Drucke ab Seite Nr."
 
 #: src/frontends/qt2/ui/QPrintDialogBase.ui:112
-msgid "&to"
-msgstr "&bis"
+msgid "&To:[translation hint: as in 'From page x to page y']"
+msgstr "&Bis:"
 
 #: src/frontends/qt2/ui/QPrintDialogBase.ui:131
 msgid "Page number to print to"
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.1977
diff -u -r1.1977 ChangeLog
--- src/ChangeLog	4 Sep 2004 12:13:48 -0000	1.1977
+++ src/ChangeLog	10 Sep 2004 15:37:37 -0000
@@ -1,3 +1,9 @@
+2004-09-10  Georg Baum  <[EMAIL PROTECTED]>
+
+	* messages.C (Pimpl): use english translation as fallback if no
+	translation was found in the desired language. This enables us to
+	supply context information in translated strings.
+
 2004-09-04  Lars Gullik Bjonnes  <[EMAIL PROTECTED]>
 
 	* client: new dir
Index: src/messages.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/messages.C,v
retrieving revision 1.16
diff -u -r1.16 messages.C
--- src/messages.C	8 Jun 2004 14:06:10 -0000	1.16
+++ src/messages.C	10 Sep 2004 15:37:39 -0000
@@ -98,6 +98,23 @@
 		bindtextdomain(PACKAGE, lyx_localedir().c_str());
 		textdomain(PACKAGE);
 		const char* msg = gettext(m.c_str());
+
+		// Some english words have different translations, depending
+		// on context. These cases are handled with an english
+		// translation: The original string is augmented by context
+		// information (e.g.
+		// "To:[translation hint: as in 'From page x to page y']" and
+		// "To:[translation hint: as in 'From format x to format y']",
+		// and the english translation of both strings is "To:".
+		// This means that we need the english translation as
+		// fallback, if no translation for the current language is
+		// available, otherwise the user sees bogus messages.
+		if (n && msg == m) {
+			n = setlocale(LC_ALL, "en_US");
+			bindtextdomain(PACKAGE, lyx_localedir().c_str());
+			textdomain(PACKAGE);
+			msg = gettext(m.c_str());
+		}
 		setlocale(LC_ALL, old);
 		free(old);
 		// If we are unable to honour the request we just
Index: src/messages.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/messages.h,v
retrieving revision 1.8
diff -u -r1.8 messages.h
--- src/messages.h	7 Oct 2003 06:45:24 -0000	1.8
+++ src/messages.h	10 Sep 2004 15:37:39 -0000
@@ -17,9 +17,9 @@
 ///
 class Messages {
 public:
-	///
+	/// messages in the language defined by the environment
 	Messages();
-	///
+	/// messages in the language \p l
 	Messages(std::string const & l);
 	///
 	~Messages();
Index: src/frontends/qt2/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.712
diff -u -r1.712 ChangeLog
--- src/frontends/qt2/ChangeLog	19 Aug 2004 06:30:43 -0000	1.712
+++ src/frontends/qt2/ChangeLog	10 Sep 2004 15:59:10 -0000
@@ -1,3 +1,8 @@
+2004-09-10  Georg Baum  <[EMAIL PROTECTED]>
+
+	* ui/QPrefConvertersModule.ui: Add translation context to "To:"
+	* ui/QPrintDialogBase.ui: ditto
+
 2004-08-19  Georg Baum  <[EMAIL PROTECTED]>
 
 	* BulletsModule.C (setBullet): use toqstr() for a string passed to
Index: src/frontends/qt2/ui/QPrefConvertersModule.ui
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ui/QPrefConvertersModule.ui,v
retrieving revision 1.6
diff -u -r1.6 QPrefConvertersModule.ui
--- src/frontends/qt2/ui/QPrefConvertersModule.ui	28 Mar 2003 01:21:42 -0000	1.6
+++ src/frontends/qt2/ui/QPrefConvertersModule.ui	10 Sep 2004 15:37:42 -0000
@@ -217,7 +217,7 @@
                             </property>
                             <property stdset="1">
                                 <name>text</name>
-                                <string>&amp;To:</string>
+                                <string>&amp;To:[translation hint: as in 'From format x to format y']</string>
                             </property>
                             <property>
                                 <name>buddy</name>
Index: src/frontends/qt2/ui/QPrintDialogBase.ui
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ui/QPrintDialogBase.ui,v
retrieving revision 1.3
diff -u -r1.3 QPrintDialogBase.ui
--- src/frontends/qt2/ui/QPrintDialogBase.ui	14 Jun 2003 15:13:55 -0000	1.3
+++ src/frontends/qt2/ui/QPrintDialogBase.ui	10 Sep 2004 15:37:42 -0000
@@ -109,7 +109,7 @@
                                     </property>
                                     <property stdset="1">
                                         <name>text</name>
-                                        <string>&amp;to</string>
+                                        <string>&amp;To:[translation hint: as in 'From page x to page y']</string>
                                     </property>
                                     <property>
                                         <name>buddy</name>
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.933
diff -u -r1.933 ChangeLog
--- src/frontends/xforms/ChangeLog	29 Aug 2004 23:52:47 -0000	1.933
+++ src/frontends/xforms/ChangeLog	10 Sep 2004 15:59:09 -0000
@@ -1,3 +1,8 @@
+2004-09-10  Georg Baum  <[EMAIL PROTECTED]>
+
+	* forms/form_preferences.fd: Add translation context to "To:"
+	* forms/form_print.fd: ditto
+		
 2004-08-30  Lars Gullik Bjonnes  <[EMAIL PROTECTED]>
 
 	* forms/pch.h: make it better
Index: src/frontends/xforms/forms/form_preferences.fd
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/form_preferences.fd,v
retrieving revision 1.67
diff -u -r1.67 form_preferences.fd
--- src/frontends/xforms/forms/form_preferences.fd	19 Apr 2004 13:31:16 -0000	1.67
+++ src/frontends/xforms/forms/form_preferences.fd	10 Sep 2004 15:37:45 -0000
@@ -1957,7 +1957,7 @@
 style: FL_NORMAL_STYLE
 size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
-label: To:|#T
+label: To:|#T[translation hint: as in 'From format x to format y']
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
Index: src/frontends/xforms/forms/form_print.fd
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/form_print.fd,v
retrieving revision 1.19
diff -u -r1.19 form_print.fd
--- src/frontends/xforms/forms/form_print.fd	28 Mar 2004 14:12:33 -0000	1.19
+++ src/frontends/xforms/forms/form_print.fd	10 Sep 2004 15:37:45 -0000
@@ -185,7 +185,7 @@
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: To:|#T
+label: To:|#T[translation hint: as in 'From page x to page y']
 shortcut: 
 resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity

Reply via email to