Hello, Here is an adapted version of the lyx-1.2.0-turkish.patch that Mike posted. The main difference is that I created a ascii_lowercase function because there are some occasions where one wants to honor locale in case, and others when it is unwanted.
I'd appreciate comments on this patch (and testing). I plan to apply it to 1.2.1, and apply something cleaner (if possible; ideas are welcome) to 1.3.0cvs. JMarc
Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.713.2.21 diff -u -r1.713.2.21 ChangeLog --- src/ChangeLog 15 Jul 2002 11:41:57 -0000 1.713.2.21 +++ src/ChangeLog 15 Jul 2002 21:44:37 -0000 @@ -1,3 +1,30 @@ +2002-07-15 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> + + * lyxfont.C (setLyXFamily): + (setLyXSeries): + (setLyXShape): + (setLyXSize): + (setLyXMisc): + (lyxRead): + * debug.C (value): + * buffer.C (asciiParagraph): use ascii_lowercase + +2002-07-15 Mike Fabian <[EMAIL PROTECTED]> + + * lyxlex_pimpl.C (search_kw): + * lyxlex.C (getLongString): + * converter.h (operator<): + * converter.C (operator<): + * buffer.C (parseSingleLyXformat2Token): + (asciiParagraph): + * ToolbarDefaults.C (read): + * MenuBackend.C (checkShortcuts): + (read): + * LColor.C (getFromGUIName): + (getFromLyXName): use the compare_ascii_no_case instead of + compare_no_case, because in turkish, 'i' is not the lowercase + version of 'I', and thus turkish locale breaks parsing of tags. + 2002-07-10 Andrew Zabolotny <[EMAIL PROTECTED]> * minibuffer.C (peek_event): support keypad keys Index: src/LColor.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/LColor.C,v retrieving revision 1.31 diff -u -r1.31 LColor.C --- src/LColor.C 21 Mar 2002 17:25:07 -0000 1.31 +++ src/LColor.C 15 Jul 2002 21:44:37 -0000 @@ -186,7 +186,7 @@ InfoTab::const_iterator ici = infotab.begin(); InfoTab::const_iterator end = infotab.end(); for (; ici != end; ++ici) { - if (!compare_no_case(_(ici->second.guiname), guiname)) + if (!compare_ascii_no_case(_(ici->second.guiname), guiname)) return ici->first; } return LColor::inherit; @@ -199,7 +199,7 @@ InfoTab::const_iterator ici = infotab.begin(); InfoTab::const_iterator end = infotab.end(); for (; ici != end; ++ici) { - if (!compare_no_case(ici->second.lyxname, lyxname)) + if (!compare_ascii_no_case(ici->second.lyxname, lyxname)) return ici->first; } return LColor::inherit; Index: src/MenuBackend.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/MenuBackend.C,v retrieving revision 1.40 diff -u -r1.40 MenuBackend.C --- src/MenuBackend.C 29 Apr 2002 09:50:33 -0000 1.40 +++ src/MenuBackend.C 15 Jul 2002 21:44:38 -0000 @@ -237,7 +237,7 @@ << "\" does not contain shortcut `" << shortcut << '\'' << endl; for (const_iterator it2 = begin(); it2 != it1 ; ++it2) { - if (!compare_no_case(it2->shortcut(), shortcut)) { + if (!compare_ascii_no_case(it2->shortcut(), shortcut)) { lyxerr << "Menu warning: menu entries " << '"' << it1->fulllabel() << "\" and \"" << it2->fulllabel() @@ -451,7 +451,7 @@ }; //consistency check - if (compare_no_case(lex.getString(), "menuset")) { + if (compare_ascii_no_case(lex.getString(), "menuset")) { lyxerr << "Menubackend::read: ERROR wrong token:`" << lex.getString() << '\'' << endl; } Index: src/ToolbarDefaults.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ToolbarDefaults.C,v retrieving revision 1.29 diff -u -r1.29 ToolbarDefaults.C --- src/ToolbarDefaults.C 21 Mar 2002 17:25:09 -0000 1.29 +++ src/ToolbarDefaults.C 15 Jul 2002 21:44:38 -0000 @@ -98,7 +98,7 @@ void ToolbarDefaults::read(LyXLex & lex) { //consistency check - if (compare_no_case(lex.getString(), "toolbar")) { + if (compare_ascii_no_case(lex.getString(), "toolbar")) { lyxerr << "Toolbar::read: ERROR wrong token:`" << lex.getString() << '\'' << endl; } Index: src/buffer.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v retrieving revision 1.337.2.5 diff -u -r1.337.2.5 buffer.C --- src/buffer.C 17 Jun 2002 10:25:22 -0000 1.337.2.5 +++ src/buffer.C 15 Jul 2002 21:44:48 -0000 @@ -536,7 +536,7 @@ layoutname = tclass.defaultLayoutName(); } #ifndef NO_COMPABILITY - if (compare_no_case(layoutname, "latex") == 0) { + if (compare_ascii_no_case(layoutname, "latex") == 0) { ert_comp.active = true; ert_comp.fromlayout = true; ert_comp.font = font; @@ -557,7 +557,7 @@ #ifdef USE_CAPTION // The is the compability reading of layout caption. // It can be removed in LyX version 1.3.0. (Lgb) - if (compare_no_case(layoutname, "caption") == 0) { + if (compare_ascii_no_case(layoutname, "caption") == 0) { // We expect that the par we are now working on is // really inside a InsetText inside a InsetFloat. // We also know that captions can only be @@ -1575,7 +1575,7 @@ // This strange command allows LyX to recognize "natbib" style // citations: citet, citep, Citet etc. - if (compare_no_case(cmdName, "cite", 4) == 0) { + if (compare_ascii_no_case(cmdName.substr(0,4), "cite") == 0) { inset = new InsetCitation(inscmd); } else if (cmdName == "bibitem") { lex.printError("Wrong place for bibitem"); @@ -1942,25 +1942,25 @@ // First write the layout string const & tmp = par->layout(); - if (compare_no_case(tmp, "itemize") == 0) { + if (compare_ascii_no_case(tmp, "itemize") == 0) { ltype = 1; ltype_depth = depth + 1; - } else if (compare_no_case(tmp, "enumerate") == 0) { + } else if (compare_ascii_no_case(tmp, "enumerate") == 0) { ltype = 2; ltype_depth = depth + 1; - } else if (contains(lowercase(tmp), "ection")) { + } else if (contains(ascii_lowercase(tmp), "ection")) { ltype = 3; ltype_depth = depth + 1; - } else if (contains(lowercase(tmp), "aragraph")) { + } else if (contains(ascii_lowercase(tmp), "aragraph")) { ltype = 4; ltype_depth = depth + 1; - } else if (compare_no_case(tmp, "description") == 0) { + } else if (compare_ascii_no_case(tmp, "description") == 0) { ltype = 5; ltype_depth = depth + 1; - } else if (compare_no_case(tmp, "abstract") == 0) { + } else if (compare_ascii_no_case(tmp, "abstract") == 0) { ltype = 6; ltype_depth = 0; - } else if (compare_no_case(tmp, "bibliography") == 0) { + } else if (compare_ascii_no_case(tmp, "bibliography") == 0) { ltype = 7; ltype_depth = 0; } else { Index: src/converter.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/converter.C,v retrieving revision 1.47.2.1 diff -u -r1.47.2.1 converter.C --- src/converter.C 17 Jun 2002 10:25:23 -0000 1.47.2.1 +++ src/converter.C 15 Jul 2002 21:44:50 -0000 @@ -264,10 +264,13 @@ bool operator<(Converter const & a, Converter const & b) { - int const i = compare_no_case(a.From->prettyname(), - b.From->prettyname()); + // use the compare_ascii_no_case instead of compare_no_case, + // because in turkish, 'i' is not the lowercase version of 'I', + // and thus turkish locale breaks parsing of tags. + int const i = compare_ascii_no_case(a.From->prettyname(), + b.From->prettyname()); if (i == 0) - return compare_no_case(a.To->prettyname(), b.To->prettyname()) + return compare_ascii_no_case(a.To->prettyname(), b.To->prettyname()) < 0; else return i < 0; Index: src/converter.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/converter.h,v retrieving revision 1.22 diff -u -r1.22 converter.h --- src/converter.h 21 Mar 2002 17:25:09 -0000 1.22 +++ src/converter.h 15 Jul 2002 21:44:50 -0000 @@ -77,7 +77,11 @@ inline bool operator<(Format const & a, Format const & b) { - return compare_no_case(a.prettyname(), b.prettyname()) < 0; + // use the compare_ascii_no_case instead of compare_no_case, + // because in turkish, 'i' is not the lowercase version of 'I', + // and thus turkish locale breaks parsing of tags. + + return compare_ascii_no_case(a.prettyname(), b.prettyname()) < 0; } Index: src/debug.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/debug.C,v retrieving revision 1.21 diff -u -r1.21 debug.C --- src/debug.C 21 Mar 2002 17:25:09 -0000 1.21 +++ src/debug.C 15 Jul 2002 21:44:52 -0000 @@ -80,7 +80,7 @@ string v(val); while (!v.empty()) { string::size_type st = v.find(','); - string tmp(lowercase(v.substr(0, st))); + string tmp(ascii_lowercase(v.substr(0, st))); if (tmp.empty()) break; // Is it a number? Index: src/lyxfont.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfont.C,v retrieving revision 1.74.2.1 diff -u -r1.74.2.1 lyxfont.C --- src/lyxfont.C 17 Jun 2002 10:25:23 -0000 1.74.2.1 +++ src/lyxfont.C 15 Jul 2002 21:44:52 -0000 @@ -581,7 +581,7 @@ // Set family according to lyx format string LyXFont & LyXFont::setLyXFamily(string const & fam) { - string const s = lowercase(fam); + string const s = ascii_lowercase(fam); int i = 0; while (s != LyXFamilyNames[i] && LyXFamilyNames[i] != "error") ++i; @@ -597,7 +597,7 @@ // Set series according to lyx format string LyXFont & LyXFont::setLyXSeries(string const & ser) { - string const s = lowercase(ser); + string const s = ascii_lowercase(ser); int i = 0; while (s != LyXSeriesNames[i] && LyXSeriesNames[i] != "error") ++i; @@ -613,7 +613,7 @@ // Set shape according to lyx format string LyXFont & LyXFont::setLyXShape(string const & sha) { - string const s = lowercase(sha); + string const s = ascii_lowercase(sha); int i = 0; while (s != LyXShapeNames[i] && LyXShapeNames[i] != "error") ++i; @@ -629,7 +629,7 @@ // Set size according to lyx format string LyXFont & LyXFont::setLyXSize(string const & siz) { - string const s = lowercase(siz); + string const s = ascii_lowercase(siz); int i = 0; while (s != LyXSizeNames[i] && LyXSizeNames[i] != "error") ++i; if (s == LyXSizeNames[i]) { @@ -644,7 +644,7 @@ // Set size according to lyx format string LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz) { - string const s = lowercase(siz); + string const s = ascii_lowercase(siz); int i = 0; while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") ++i; if (s == LyXMiscNames[i]) @@ -678,7 +678,7 @@ bool finished = false; while (!finished && lex.isOK() && !error) { lex.next(); - string const tok = lowercase(lex.getString()); + string const tok = ascii_lowercase(lex.getString()); if (tok.empty()) { continue; @@ -702,7 +702,7 @@ setLyXSize(ttok); } else if (tok == "misc") { lex.next(); - string const ttok = lowercase(lex.getString()); + string const ttok = ascii_lowercase(lex.getString()); if (ttok == "no_bar") { setUnderbar(OFF); Index: src/lyxlex.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxlex.C,v retrieving revision 1.29 diff -u -r1.29 lyxlex.C --- src/lyxlex.C 21 Mar 2002 17:25:14 -0000 1.29 +++ src/lyxlex.C 15 Jul 2002 21:44:53 -0000 @@ -168,7 +168,7 @@ // We do a case independent comparison, like search_kw // does. - if (compare_no_case(token, endtoken) != 0) { + if (compare_ascii_no_case(token, endtoken) != 0) { string tmpstr = getString(); if (firstline) { unsigned int i = 0; Index: src/lyxlex_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxlex_pimpl.C,v retrieving revision 1.22 diff -u -r1.22 lyxlex_pimpl.C --- src/lyxlex_pimpl.C 21 Mar 2002 17:25:14 -0000 1.22 +++ src/lyxlex_pimpl.C 15 Jul 2002 21:44:54 -0000 @@ -379,8 +379,11 @@ keyword_item * res = lower_bound(table, table + no_items, search_tag, compare_tags()); + // use the compare_ascii_no_case instead of compare_no_case, + // because in turkish, 'i' is not the lowercase version of 'I', + // and thus turkish locale breaks parsing of tags. if (res != table + no_items - && !compare_no_case(res->tag, tag)) + && !compare_ascii_no_case(res->tag, tag)) return res->code; return LEX_UNDEF; } Index: src/lyxrc.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrc.C,v retrieving revision 1.115 diff -u -r1.115 lyxrc.C --- src/lyxrc.C 2 Apr 2002 17:04:22 -0000 1.115 +++ src/lyxrc.C 15 Jul 2002 21:44:58 -0000 @@ -506,7 +506,7 @@ case RC_DEFAULT_PAPERSIZE: if (lexrc.next()) { string const size = - lowercase(lexrc.getString()); + ascii_lowercase(lexrc.getString()); if (size == "usletter") default_papersize = BufferParams::PAPER_USLETTER; Index: src/frontends/controllers/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v retrieving revision 1.173.2.4 diff -u -r1.173.2.4 ChangeLog --- src/frontends/controllers/ChangeLog 4 Jul 2002 09:54:11 -0000 1.173.2.4 +++ src/frontends/controllers/ChangeLog 15 Jul 2002 21:45:02 -0000 @@ -1,3 +1,13 @@ +2002-07-15 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> + + * biblio.C (parseBibTeX): use ascii_lowercase instead of lowercase + +2002-07-15 Mike Fabian <[EMAIL PROTECTED]> + + * biblio.C (compareNoCase): use the compare_ascii_no_case instead + of compare_no_case, because in turkish, 'i' is not the lowercase + version of 'I', and thus turkish locale breaks parsing of tags. + 2002-06-27 Juergen Spitzmueller <[EMAIL PROTECTED]> * ControlInclude.C: Add warning if absolute path name and Index: src/frontends/controllers/biblio.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/biblio.C,v retrieving revision 1.26 diff -u -r1.26 biblio.C --- src/frontends/controllers/biblio.C 13 May 2002 13:23:29 -0000 1.26 +++ src/frontends/controllers/biblio.C 15 Jul 2002 21:45:04 -0000 @@ -265,7 +265,7 @@ struct compareNoCase: public std::binary_function<string, string, bool> { bool operator()(string const & s1, string const & s2) const { - return compare_no_case(s1, s2) < 0; + return compare_ascii_no_case(s1, s2) < 0; } }; @@ -423,9 +423,9 @@ do { dummy = token(data, ',', Entries++); if (!dummy.empty()) { - found = contains(lowercase(dummy), findkey); + found = contains(ascii_lowercase(dummy), findkey); if (findkey == "title" && - contains(lowercase(dummy), "booktitle")) + contains(ascii_lowercase(dummy), "booktitle")) found = false; } } while (!found && !dummy.empty()); Index: src/graphics/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/ChangeLog,v retrieving revision 1.59.2.6 diff -u -r1.59.2.6 ChangeLog --- src/graphics/ChangeLog 2 Jul 2002 14:12:17 -0000 1.59.2.6 +++ src/graphics/ChangeLog 15 Jul 2002 21:45:07 -0000 @@ -1,3 +1,8 @@ +2002-07-15 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> + + * GraphicsImageXPM.C (color_none_id): + (contains_color_none): use ascii_lowercase instead of lowercase + 2002-05-01 Herbert Voss <[EMAIL PROTECTED]> * GraphicsParams.C (GParams c-tor): use the new keepLyXAspectRatio Index: src/graphics/GraphicsImageXPM.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/GraphicsImageXPM.C,v retrieving revision 1.12.2.3 diff -u -r1.12.2.3 GraphicsImageXPM.C --- src/graphics/GraphicsImageXPM.C 17 Jun 2002 10:25:26 -0000 1.12.2.3 +++ src/graphics/GraphicsImageXPM.C 15 Jul 2002 21:45:10 -0000 @@ -550,7 +550,7 @@ XpmColor * table = colorTable_.get(); for (size_t i = 0; i < ncolors_; ++i) { char const * const color = table[i].c_color; - if (color && lowercase(color) == "none") + if (color && ascii_lowercase(color) == "none") return uint(i); } return 0; @@ -697,7 +697,7 @@ { for (size_t i = 0; i < image.ncolors; ++i) { char const * const color = image.colorTable[i].c_color; - if (color && lowercase(color) == "none") + if (color && ascii_lowercase(color) == "none") return true; } return false; Index: src/insets/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v retrieving revision 1.421.2.11 diff -u -r1.421.2.11 ChangeLog --- src/insets/ChangeLog 9 Jul 2002 14:55:04 -0000 1.421.2.11 +++ src/insets/ChangeLog 15 Jul 2002 21:45:19 -0000 @@ -1,3 +1,8 @@ +2002-07-15 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> + + * insetcite.C (getNatbibLabel): + * insetbib.C (getKeys): use ascii_lowercase instead of lowercase + 2002-07-03 Herbert Voss <[EMAIL PROTECTED]> * insetgraphics.C (prepareFile): fix several bugs with returning Index: src/insets/insetbib.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbib.C,v retrieving revision 1.85 diff -u -r1.85 insetbib.C --- src/insets/insetbib.C 16 Apr 2002 09:09:41 -0000 1.85 +++ src/insets/insetbib.C 15 Jul 2002 21:45:19 -0000 @@ -259,7 +259,7 @@ linebuf = subst(linebuf, '{', '('); string tmp; linebuf = split(linebuf, tmp, '('); - tmp = lowercase(tmp); + tmp = ascii_lowercase(tmp); if (!prefixIs(tmp, "@string") && !prefixIs(tmp, "@preamble")) { linebuf = split(linebuf, tmp, ','); Index: src/insets/insetcite.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcite.C,v retrieving revision 1.32 diff -u -r1.32 insetcite.C --- src/insets/insetcite.C 14 May 2002 09:47:12 -0000 1.32 +++ src/insets/insetcite.C 15 Jul 2002 21:45:20 -0000 @@ -93,8 +93,8 @@ bool const full = citeType[citeType.size()-1] == '*'; string const cite_type = full ? - lowercase(citeType.substr(0,citeType.size()-1)) : - lowercase(citeType); + ascii_lowercase(citeType.substr(0,citeType.size()-1)) : + ascii_lowercase(citeType); string before_str; if (!before.empty()) { Index: src/support/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v retrieving revision 1.103.2.1 diff -u -r1.103.2.1 ChangeLog --- src/support/ChangeLog 17 Jun 2002 10:25:27 -0000 1.103.2.1 +++ src/support/ChangeLog 15 Jul 2002 21:45:23 -0000 @@ -1,3 +1,8 @@ +2002-07-15 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> + + * filetools.C (IsLyXFilename): + (IsSGMLFilename): use ascii_lowercase instead of lowercase + 2002-06-13 Angus Leeming <[EMAIL PROTECTED]> Fixes needed to compile with Compaq cxx 6.3. Index: src/support/filetools.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v retrieving revision 1.121.2.1 diff -u -r1.121.2.1 filetools.C --- src/support/filetools.C 17 Jun 2002 10:25:27 -0000 1.121.2.1 +++ src/support/filetools.C 15 Jul 2002 21:45:26 -0000 @@ -85,13 +85,13 @@ bool IsLyXFilename(string const & filename) { - return suffixIs(lowercase(filename), ".lyx"); + return suffixIs(ascii_lowercase(filename), ".lyx"); } bool IsSGMLFilename(string const & filename) { - return suffixIs(lowercase(filename), ".sgml"); + return suffixIs(ascii_lowercase(filename), ".sgml"); } Index: src/support/lstrings.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/lstrings.C,v retrieving revision 1.52.2.1 diff -u -r1.52.2.1 lstrings.C --- src/support/lstrings.C 17 Jun 2002 10:25:27 -0000 1.52.2.1 +++ src/support/lstrings.C 15 Jul 2002 21:45:27 -0000 @@ -247,6 +247,12 @@ } }; +struct local_ascii_lowercase { + char operator()(char c) const { + return ascii_tolower(c); + } +}; + } // end of anon namespace string const lowercase(string const & a) @@ -260,6 +266,15 @@ { string tmp(a); transform(tmp.begin(), tmp.end(), tmp.begin(), local_uppercase()); + return tmp; +} + + +string const ascii_lowercase(string const & a) +{ + string tmp(a); + transform(tmp.begin(), tmp.end(), tmp.begin(), + local_ascii_lowercase()); return tmp; } Index: src/support/lstrings.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/lstrings.h,v retrieving revision 1.37 diff -u -r1.37 lstrings.h --- src/support/lstrings.h 15 Apr 2002 12:05:07 -0000 1.37 +++ src/support/lstrings.h 15 Jul 2002 21:45:27 -0000 @@ -80,6 +80,9 @@ /// char uppercase(char c); +/// same as lowercase(), but ignores locale +string const ascii_lowercase(string const &); + /// string const lowercase(string const &);