The following patches fix the implementation of i18nLibFileSearch so
that the LANGUAGE env variable can contain several languages, like
"fr:es" which says "use french if possible, spanish otherwise".

I will apply them, since they seem so straightforward.

Thanks to thanks to Pablo Saraxtaga for the initial patch.

JMarc

Index: src/support/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.149.2.8
diff -u -p -r1.149.2.8 ChangeLog
--- src/support/ChangeLog	8 Apr 2004 10:16:44 -0000	1.149.2.8
+++ src/support/ChangeLog	29 Jun 2004 12:49:58 -0000
@@ -1,3 +1,9 @@
+2004-06-29  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* filetools.C (i18nLibFileSearch): honor case where LANGUAGE
+	specifies a list of locales (thanks to Pablo Saraxtaga for the
+	initial patch).
+
 2004-04-01  Georg Baum  <[EMAIL PROTECTED]>
 
 	* filetools.C (DeleteAllFilesInDir): delete directories with
Index: src/support/filetools.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
retrieving revision 1.146.2.4
diff -u -p -r1.146.2.4 filetools.C
--- src/support/filetools.C	8 Apr 2004 10:16:45 -0000	1.146.2.4
+++ src/support/filetools.C	29 Jun 2004 12:49:58 -0000
@@ -329,18 +329,18 @@ i18nLibFileSearch(string const & dir, st
 	if (lang != "C" && lang != "POSIX" && !language.empty())
 		lang = language;
 
-	lang = token(lang, '_', 0);
-
-	if (lang.empty() || lang == "C")
-		return LibFileSearch(dir, name, ext);
-	else {
-		string const tmp = LibFileSearch(dir, lang + '_' + name,
+	string l;
+	lang = split(lang, l, ':');
+	while (!l.empty() && l != "C" && l != "POSIX") {
+		string const tmp = LibFileSearch(dir, 
+						 token(l, '_', 0) + '_' + name,
 						 ext);
 		if (!tmp.empty())
 			return tmp;
-		else
-			return LibFileSearch(dir, name, ext);
+		lang = split(lang, l, ':');
 	}
+
+	return LibFileSearch(dir, name, ext);
 }
 
 
Index: src/support/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.255
diff -u -p -r1.255 ChangeLog
--- src/support/ChangeLog	8 Jun 2004 14:06:11 -0000	1.255
+++ src/support/ChangeLog	29 Jun 2004 12:49:37 -0000
@@ -1,3 +1,9 @@
+2004-06-29  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* filetools.C (i18nLibFileSearch): honor case where LANGUAGE
+	specifies a list of locales (thanks to Pablo Saraxtaga for the
+	initial patch).
+
 2004-05-04  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* path_defines.C.in (setLyxPaths): make sure that LyX/Mac can find
Index: src/support/filetools.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
retrieving revision 1.184
diff -u -p -r1.184 filetools.C
--- src/support/filetools.C	20 Apr 2004 08:51:15 -0000	1.184
+++ src/support/filetools.C	29 Jun 2004 12:49:37 -0000
@@ -332,18 +332,18 @@ i18nLibFileSearch(string const & dir, st
 	if (lang != "C" && lang != "POSIX" && !language.empty())
 		lang = language;
 
-	lang = token(lang, '_', 0);
-
-	if (lang.empty() || lang == "C")
-		return LibFileSearch(dir, name, ext);
-	else {
-		string const tmp = LibFileSearch(dir, lang + '_' + name,
+	string l;
+	lang = split(lang, l, ':');
+	while (!l.empty() && l != "C" && l != "POSIX") {
+		string const tmp = LibFileSearch(dir, 
+						 token(l, '_', 0) + '_' + name,
 						 ext);
 		if (!tmp.empty())
 			return tmp;
-		else
-			return LibFileSearch(dir, name, ext);
+		lang = split(lang, l, ':');
 	}
+
+	return LibFileSearch(dir, name, ext);
 }
 
 

Reply via email to