* GuiDocument.cpp:

use translateIfPossible here, since the module names might be non-ASCII
	(thanks rgh).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35898 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2010-10-29 08:34:26 +00:00
parent fadde98eb3
commit 2b604413e7

View File

@ -1886,28 +1886,31 @@ void GuiDocument::bibtexChanged(int n)
namespace {
// This is an insanely complicated attempt to make this sort of thing
// work with RTL languages.
//FIXME unicode (this should take a vector<docstring>)
docstring formatStrVec(vector<string> const & v, docstring const & s)
{
//this mess formats the list as "v[0], v[1], ..., [s] v[n]"
if (v.size() == 0)
return docstring();
if (v.size() == 1)
return _(v[0]);
return translateIfPossible(from_utf8(v[0]));
if (v.size() == 2) {
docstring retval = _("%1$s and %2$s");
retval = subst(retval, _("and"), s);
return bformat(retval, _(v[0]), _(v[1]));
return bformat(retval, translateIfPossible(from_utf8(v[0])),
translateIfPossible(from_utf8(v[1])));
}
// The idea here is to format all but the last two items...
int const vSize = v.size();
docstring t2 = _("%1$s, %2$s");
docstring retval = _(v[0]);
docstring retval = translateIfPossible(from_utf8(v[0]));
for (int i = 1; i < vSize - 2; ++i)
retval = bformat(t2, retval, _(v[i]));
retval = bformat(t2, retval, translateIfPossible(from_utf8(v[i])));
//...and then to plug them, and the last two, into this schema
docstring t = _("%1$s, %2$s, and %3$s");
t = subst(t, _("and"), s);
return bformat(t, retval, _(v[vSize - 2]), _(v[vSize - 1]));
return bformat(t, retval, translateIfPossible(from_utf8(v[vSize - 2])),
translateIfPossible(from_utf8(v[vSize - 1])));
}
vector<string> idsToNames(vector<string> const & idList)