Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8024257

Locale.getDefault() should be replaced by Locale.getDefault(Category.DISPLAY) where appropriate

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description


      See recommendation from Naoto in
      <http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-September/020594.html>

      <<
      Just one comment. When you are retrieving the default locale, please use
      Locale.getDefault(Locale.Category.DISPLAY) which returns the default
      locale for displaying translatable names.

      Locale.Category was introduced in JDK7 where the user can set the
      default locales separately for UI display names and Formatting. In your
      case, the resource bundle seems to contain user visible localizable
      strings, so I suggested using getDefault() with Locale.Category.DISPLAY
      specifically. That way the user would see the string in the correct
      language even on any custom default locale environment.
      >>

      There are possibly several places in the corelibs where Locale.getDefault(Category.DISPLAY) should be preferred to Locale.getDefault().

      e.g. Logging, ResourceBundle etc...

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                naoto Naoto Sato
                Reporter:
                dfuchs Daniel Fuchs
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: