From 43630cabd66afa89b98ee053ebbd02d53ccefbb4 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 2 Dec 2013 12:41:23 -0800 Subject: 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 --- qt-ui/models.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'qt-ui') diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 7be4a8ae3..5dbb8ea22 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -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; } } -- cgit v1.2.3-70-g09d2