diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2013-05-14 21:40:48 +0200 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2013-05-16 11:25:05 +0200 |
commit | 0681183fac9cfbc37bf35ac894ff9b06cce757fc (patch) | |
tree | 8c50dadac6b22c1cf9e6ebd8a31130826b41922a | |
parent | bcf5b59c59e913f7f86038069e5c9c441853652f (diff) |
PIM: select "phonebook" for de and fi (part of FDO #64173)
We have to hard code this instead of always using it because ICU does
not properly fall back to non-phonebook defaults. Without phonebook as
collation, sorting was not done correctly in Germany.
-rw-r--r-- | src/dbus/server/pim/locale-factory-boost.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/dbus/server/pim/locale-factory-boost.cpp b/src/dbus/server/pim/locale-factory-boost.cpp index 386ce9dc..c152a293 100644 --- a/src/dbus/server/pim/locale-factory-boost.cpp +++ b/src/dbus/server/pim/locale-factory-boost.cpp @@ -515,9 +515,26 @@ public: gen.categories(boost::locale::collation_facet | boost::locale::convert_facet | boost::locale::information_facet); - // TODO: Check env vars, then append @collation=phonebook - // to get phonebook specific sorting. - return gen(""); + // Hard-code "phonebook" collation for certain languages + // where we know that it is desirable. We could use it + // in all cases, except that ICU has a bug where it does not + // fall back properly to the base collation. See + // http://sourceforge.net/mailarchive/message.php?msg_id=30802924 + // and http://bugs.icu-project.org/trac/ticket/10149 + std::locale locale = gen(""); + std::string name = std::use_facet<boost::locale::info>(locale).name(); + std::string language = std::use_facet<boost::locale::info>(locale).language(); + std::string country = std::use_facet<boost::locale::info>(locale).country(); + SE_LOG_DEV(NULL, "PIM Manager running with locale %s = language %s in country %s", + name.c_str(), + language.c_str(), + country.c_str()); + if (language == "de" || + language == "fi") { + SE_LOG_DEV(NULL, "enabling phonebook collation for language %s", language.c_str()); + locale = gen(name + "@collation=phonebook"); + } + return locale; } virtual boost::shared_ptr<IndividualCompare> createCompare(const std::string &order) |