* GuiDocument:

- Make the modules description in Document > Settings fully translatable (bug #6987).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@36503 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2010-11-26 10:37:53 +00:00
parent 13e9b23d31
commit 382f9ba3f9
2 changed files with 14 additions and 7 deletions

View File

@ -1365,6 +1365,9 @@ void GuiDocument::classChanged()
namespace { namespace {
// FIXME unicode
// both of these should take a vector<docstring>
// This is an insanely complicated attempt to make this sort of thing // This is an insanely complicated attempt to make this sort of thing
// work with RTL languages. // work with RTL languages.
docstring formatStrVec(vector<string> const & v, docstring const & s) docstring formatStrVec(vector<string> const & v, docstring const & s)
@ -1373,22 +1376,24 @@ namespace {
if (v.size() == 0) if (v.size() == 0)
return docstring(); return docstring();
if (v.size() == 1) if (v.size() == 1)
return from_utf8(v[0]); return translateIfPossible(from_utf8(v[0]));
if (v.size() == 2) { if (v.size() == 2) {
docstring retval = _("%1$s and %2$s"); docstring retval = _("%1$s and %2$s");
retval = subst(retval, _("and"), s); retval = subst(retval, _("and"), s);
return bformat(retval, from_utf8(v[0]), from_utf8(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... // The idea here is to format all but the last two items...
int const vSize = v.size(); int const vSize = v.size();
docstring t2 = _("%1$s, %2$s"); docstring t2 = _("%1$s, %2$s");
docstring retval = from_utf8(v[0]); docstring retval = translateIfPossible(from_utf8(v[0]));
for (int i = 1; i < vSize - 2; ++i) for (int i = 1; i < vSize - 2; ++i)
retval = bformat(t2, retval, from_utf8(v[i])); retval = bformat(t2, retval, translateIfPossible(from_utf8(v[i])));
//...and then to plug them, and the last two, into this schema //...and then to plug them, and the last two, into this schema
docstring t = _("%1$s, %2$s, and %3$s"); docstring t = _("%1$s, %2$s, and %3$s");
t = subst(t, _("and"), s); t = subst(t, _("and"), s);
return bformat(t, retval, from_utf8(v[vSize - 2]), from_utf8(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) vector<string> idsToNames(vector<string> const & idList)
@ -1399,7 +1404,8 @@ namespace {
for (; it != end; ++it) { for (; it != end; ++it) {
LyXModule const * const mod = moduleList[*it]; LyXModule const * const mod = moduleList[*it];
if (!mod) if (!mod)
retval.push_back(*it + " (Unavailable)"); retval.push_back(to_utf8(bformat(_("%1$s (unavailable)"),
translateIfPossible(from_utf8(*it)))));
else else
retval.push_back(mod->getName()); retval.push_back(mod->getName());
} }

View File

@ -56,7 +56,8 @@ What's new
* USER INTERFACE * USER INTERFACE
- Make the modules description in Document > Settings fully translatable
(bug 6987).
* DOCUMENTATION AND LOCALIZATION * DOCUMENTATION AND LOCALIZATION