diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-08-27 12:57:14 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2014-09-10 21:11:11 +0200 |
commit | c17563eca879845deef542173f5fb479c9aa2d0e (patch) | |
tree | b967050c3502458043998288292d6da952252649 /src/corelib/tools/qlocale_win.cpp | |
parent | 6316a681f3f3dde46d5ab5c915f31a2098b463bb (diff) |
Fix several issues in QCollator
Refactor the code and move more things into the cross platform
code path.
Make sure the flags survive changing the locale of QCollator.
Use the correct locale on Windows, WinRT and OS X. We now
pass all QCollator autotests on these platforms.
Task-number: QTBUG-40778
Change-Id: Ic2d3334b5018c323a35a3ea8fc1d7ab5f99b4e62
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qlocale_win.cpp')
-rw-r--r-- | src/corelib/tools/qlocale_win.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index 4c44016fdf..b5f77b9ed8 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -1012,6 +1012,32 @@ static const char *winLangCodeToIsoName(int code) } +LCID qt_inIsoNametoLCID(const char *name) +{ + // handle norwegian manually, the list above will fail + if (!strncmp(name, "nb", 2)) + return 0x0414; + else if (!strncmp(name, "nn", 2)) + return 0x0814; + + char n[64]; + strncpy(n, name, sizeof(n)); + n[sizeof(n)-1] = 0; + char *c = n; + while (*c) { + if (*c == '-') + *c = '_'; + ++c; + } + + for (int i = 0; i < windows_to_iso_count; ++i) { + if (!strcmp(n, windows_to_iso_list[i].iso_name)) + return windows_to_iso_list[i].windows_code; + } + return LOCALE_USER_DEFAULT; +} + + #ifndef Q_OS_WINRT static QString winIso639LangName(LCID id) #else |