Localization of javax.swing.JOptionPane's default button labels in OS X
-
28-09-2019 - |
문제
How can this be achieved? I have the ff. test code:
javax.swing.JOptionPane.showMessageDialog(null, "Hello, world!");
Running it with, say, -Duser.language=zh
and -Duser.country=TW
doesn't work. I.e., the OK button is still labeled "OK". In Windows, for example, it is replaced with the Traditional Chinese equivalent.
해결책
Prioritize the corresponding language in System Preferences > International.
Aqua is used if the LAF isn't specified. It doesn't respect the default locale probably because it's very much integrated into the OS.
If a cross-platform LAF is used (e.g., Metal), the problem is not observed.
제휴하지 않습니다 StackOverflow