Don't store translated standard weight system names

For the names that we have in our "default set" we need to store the
English name so Subsurface will "do the right thing" when opening the file
in a different locale.

With manually entered names in a local language there's not much we can
do.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-12-02 12:41:23 -08:00
parent 81d91f2ce0
commit 43630cabd6

View file

@ -485,7 +485,16 @@ bool WeightModel::setData(const QModelIndex& index, const QVariant& value, int r
case TYPE:
if (!value.isNull()) {
if (!ws->description || gettextFromC::instance()->tr(ws->description) != value.toString()) {
ws->description = strdup(value.toString().toUtf8().constData());
// loop over translations to see if one matches
int i = -1;
while(ws_info[++i].name) {
if (gettextFromC::instance()->tr(ws_info[i].name) == value.toString()) {
ws->description = ws_info[i].name;
break;
}
}
if (ws_info[i].name == NULL) // didn't find a match
ws->description = strdup(value.toString().toUtf8().constData());
changed = true;
}
}