diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-12-02 12:41:23 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-12-02 12:41:23 -0800 |
commit | 43630cabd66afa89b98ee053ebbd02d53ccefbb4 (patch) | |
tree | 0fbf84b93a4aaf5a771a0d0446a276b37779a54b /qt-ui/models.cpp | |
parent | 81d91f2ce0d8ae9a3a15c76410f053a902b5bccc (diff) | |
download | subsurface-43630cabd66afa89b98ee053ebbd02d53ccefbb4.tar.gz |
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>
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r-- | qt-ui/models.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
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; } } |