JDK-8217485 : ModifiersExText not localized since JDK 11
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 11,12,13
  • Priority: P3
  • Status: Resolved
  • Resolution: Won't Fix
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2019-01-21
  • Updated: 2019-10-29
  • Resolved: 2019-01-23
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)

A DESCRIPTION OF THE PROBLEM :
The String describing the extended modifier keys and mouse buttons returned by java.awt.event.InputEvent.getModifiersExText( int ) is no longer localized, but always returns the English modifier keys and mouse button names.
Tested with Locale.GERMAN and Locale.ITALIAN

Might be related to https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8214574

REGRESSION : Last worked in version 8u201

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the given code

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
"CTRL in German: Strg" is printed to the console
ACTUAL -
"CTRL in German: Ctrl" is printed to the console

---------- BEGIN SOURCE ----------
import java.awt.event.InputEvent;
import java.util.Locale;

public class InputEventTest {
    
    public static void main(String[] args) {
        Locale.setDefault(Locale.ITALIAN);
        System.out.println("CTRL in German: " + 
            InputEvent.getModifiersExText(InputEvent.CTRL_DOWN_MASK));
    }
    
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Patching java.desktop module with sun.awt.resources.awt_[LANGUAGE_CODE].java from Java 10 or earlier

FREQUENCY : always



Comments
It is documented here: https://www.oracle.com/technetwork/java/javase/11-relnote-issues-5012449.html#Important_Changes
12-06-2019

AFAIK, we no longer support those translations in Oracle builds of the JDK. I did not impose this policy, I was just asked to implement it.
23-01-2019

This is result of JDK-8204973, I do not know how the supported locales were selected, but it looks like ITALIAN/GERMAN are not supported anymore.
22-01-2019

String describing the extended modifier keys and mouse buttons returned by java.awt.event.InputEvent.getModifiersExText( int ) is no longer localized. Checked with reported version and could confirm the regression. Result: ======= 8u201: Pass 9: Pass 10.0.2: Pass 11: Fail 11.0.2: Fail 12 ea b28: Fail 13 ea b04: Fail This is a regression introduced in JDK 11. This is related to JDK-8214574. 10.0.2 > java InputEventTest CTRL in German: Strg 11 > java InputEventTest CTRL in German: Ctrl
22-01-2019