Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-134785

Provide QLocale::toString() floating-point formats for locale-appropriate case of exponent

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5
    • Core: Locales (i18n)
    • None
    • All
    • 8
    • 05c8a4861 (dev), 31d64b725 (6.9), 5d90dea2a (6.8), 507d8cc0e (dev), 55c60776e (6.9), dd45d2bb0 (6.8), b4418b6e6 (tqtc/lts-6.5), 672c60ea7 (tqtc/lts-6.5)
    • Foundation PM Staging

    Description

      Because QLocale::toString() takes a single character to determine format, and (following various C standard library functions) lets the caller control the case of the exponential separator by the case of that character, it obliges the caller to over-ride the locale's own choice of case for that separator. We hit a similar problem with the AM/PM indicator character formats for QTime and QDateTime, see QTBUG-95790, but were able to resolve that by adding new mixed-case forms, "aP" and "Ap", of the existing two-character format specifiers to cover the locale-appropriate case; however, with a single-character format, we don't have a similar option. (Splitting the difference between 'e' and 'E', as ASCII codes, I find 'U' is half-way between; likewise 'W' is the mid-point of 'g' and 'G'; but this is not necessarily a good basis for choosing the new codes.) We should probably aim to avoid using format codes already in use by POSIX APIs, unless we can find one that some locale-aware API uses for the purposes in hand. So:

      • Check existing POSIX APIs for such a precedent; use it if found; otherwise,
      • See what format characters none of those APIs use for any format and pick two of these to serve as our locale-appropriate-case equivalents of 'e'/'E' and 'g'/'G'
      • Implement that.

      We shall need, internally, an analog of QLocaleData::CapitalEorX, LowerEorX, to force the case of the exponent (or 0x, sadly now tied to it) to lower-case; then change the code that upper-cases on CapitalEorX else (since the fix to QTBUG-134768) lower-cases to make the lower-casing conditional on LowerEorX and just return the existing-case form otherwise.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-134785
          # Subject Branch Project Status CR V

          Activity

            People

              Eddy Edward Welbourne
              Eddy Edward Welbourne
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: