KDE Core/Platform 11/Locale

From KDE Community Wiki

Locale

What's wrong with KLocale:

  • Gtk/Qt apps running under kde-workspace don't use the KDE locale
  • KDE apps running under other platforms/workspaces do not use host locale
  • Class merges settings, formatters, parsers and translations in one giant blob
  • Circular dependencies with KConfig and KCalendarSystem
  • Unnecessary dependency for Qt-Addon libraries

What's great about KLocale:

  • Users can customise workspace locale settings
  • Apps can customise locale settings
  • Many advanced settings and formats not in QLocale (yet)

What's wrong with QLocale:

  • Not all settings are supported
  • Apps and users unable to change settings

What's good with QLocale:

  • Uses host settings on all platforms
  • Low-level common class so good for Qt Addons
  • Some settings not yet in KDE

The Plan:

  • Add all KDE settings that already exist in CLDR to QLocale
  • Use QLocale to replace KLocale's role as settings container
    • Gives correct Windows, Mac, Gnome, Meego settings
  • KDE Workspace to set locale envvar on login if KDE locale different to system locale
    • Gives correct locale Gtk/Qt apps
  • KCM to load settings from QLocale, write out as both POSIX and CLDR format files only if user chooses different settings
    • locale envvar then set to absolute path to users POSIX file so all Gtk apps get right settings
    • QLocale loads CLDR(?) file so KDE/Qt apps get right settings
  • Apps use parser/formatter classes/api's to alter settings for one-off calls rather than changing the locale itself, or create a whole new locale object.
  • Settings not available in QLocale are used by formatter/parser classes

Big Questions:

  • Date/Time formats: Keep POSIX formats (need own formatter/parser that translates Unicode format) or switch to Unicode format (not SC, QDateTime may not support all our features)
  • How will QLocale load custom CLDR? Fallback to custom POSIX but lacks some settings.

What's missing in QLocale:

  • ISO codes for language/country, uses enums instead
  • Digit Sets
  • Binary Formats
  • Page Size
  • Decimal Places
  • Separate monetary number symbols (decimal, sign, etc) but that's a Unicode CLDR thing
  • Monetary formatting options internal only not exposed
  • ...

What's extra in QLocale:

  • More locale metadata
  • Script
  • Quotes
  • Lists
  • More number symbols