JDK-8331014 : Release Note: Console Methods With Explicit Locale
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Delivered
  • OS: generic
  • CPU: generic
  • Submitted: 2024-04-23
  • Updated: 2024-07-31
  • Resolved: 2024-05-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23Resolved
Description
The following methods have been added to `java.io.Console` class that take a `java.util.Locale` argument:
   - `public Console format(Locale locale, String format, Object ... args)`
   - `public Console printf(Locale locale, String format, Object ... args)`
   - `public String readLine(Locale locale, String format, Object ... args)`
   - `public char[] readPassword(Locale locale, String format, Object ... args)`

Users can now output the string or display the prompt text formatted with the specified `Locale`, which may be independent of the default locale. For example, a snippet `System.console().printf(Locale.FRANCE, "%1$tY-%1$tB-%1$te %1$tA", new Date())` will display:
```
2024-mai-16 jeudi
```