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

Missing language tag and AnyLanguage are wrongly handled

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.8.0, 6.8
    • Core: Locales (i18n)
    • None
    • All
    • 13

    Description

      RFC 5646 defines the BCP 47 handling of language tags. In Section 4.1 it goes into details that include:

      • The 'und' (Undetermined) primary language subtag identifies
        linguistic content whose language is not determined. This
        subtag SHOULD NOT be used unless a language tag is required
        and language information is not available or cannot be
        determined. Omitting the language tag (where permitted) is
        preferred. The 'und' subtag might be useful for protocols
        that require a language tag to be provided or where a primary
        language subtag is required (such as in "und-Latn"). The
        'und' subtag MAY also be useful when matching language tags in
        certain situations.

      This indicates that omitting the language tag may be allowed in some contexts; and that using und for it is appropriate when such omission is not allowed.
      QLocale, in contrast:

      • treats any locale ID as invalid if it has no language tag (despite the fact that we might be able to infer one via likely sub-tag rules from script and/or territory)
      • returns an empty string for any QLocaleId whose language is AnyLanguage, regardless of its other members, where it would be better to report those members, either with und as language tag or with no language tag specified.

      This would imply a behaviour change for bcp47Name() and potentially for name(), the repercussions of which must be thought through with some care. A longer scrutiny of the RFC than I can afford to spend right now would probably also be in order. Most of the work shall be in deciding the right course of action; the coding should be fairly straightforward.

      Requires some caller-controlled choice over whether to include the und prefix or omit it; this implies API changes.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

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

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes