JDK-8019464 : [macosx] FileDialog buttons not localized
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u4
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: os_x
  • Submitted: 2013-06-30
  • Updated: 2014-06-26
  • Resolved: 2013-10-03
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 8
8Resolved
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version  " 1.7.0_40-ea " 
Java(TM) SE Runtime Environment (build 1.7.0_40-ea-b28)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b47, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Mac OS X 10.7.5

A DESCRIPTION OF THE PROBLEM :
The 3 buttons  " New Folder " ,  " Cancel "  and  " Open " / " Save "  displayed in a FileDialog instance are not localized according to the set locale.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test case attached to this report.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected the buttons would display the texts  " Nouveau dossier " ,  " Annuler "  and  " Ouvrir " .
ACTUAL -
The buttons displayed the texts  " New Folder " ,  " Cancel "  and  " Open " .

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.util.Locale;

public class FileDialogTest {
  public static void main(String [] args) {
    Locale.setDefault(Locale.FRENCH);
    new FileDialog(new Frame()).setVisible(true);
    System.exit(0);
  }
}

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

CUSTOMER SUBMITTED WORKAROUND :
None.
Note that only files selected with the FileDialog class can be opened in a sandboxed program, so in that environment, it can't even be replaced by a JFileChooser instance (that is less less usable under Mac OS X anyway).
Comments
This cannot be done due to OS X restrictions. The problem is that by default frameworks used in the apps are not allowed to use their own localisation. Only bundled apps with an Info.plist could override this default. JDK-6 was using the apple's private APIs to set the locale, however now these APIs does not seem to work. However there's a workaround if you use native packaging (javafxpackager tool). The Info.plist of the generated app should be updated to have the following lines: <key>CFBundleAllowMixedLocalizations</key> <true/> This will enable the default locale in the FileChooser and other native dialogs. I've filed an issue agains javafxpackager tool to include this by default: https://javafx-jira.kenai.com/browse/RT-33346
03-10-2013

BTW, see JDK-7131356, specifically this comment and below it: https://bugs.openjdk.java.net/browse/JDK-7131356?focusedCommentId=13368919&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13368919
25-09-2013

Why use JFileChooser l10n? We use native file dialogs, don't we? How do native apps resolve this issue?
24-09-2013

FileDialog should use localization from JFileChooser
23-09-2013

Sergey, could you estimate efforts to fix it in jdk8 in case if we are not deferring this bug?
17-09-2013

As to the impact, it seems to be rather visible issue hitting end users. Could you please fix it?
17-09-2013

Not a regression for JDK8, the problem is reproducible from JDK7. Does not have a significant impact on client applications.
22-08-2013

is it affected 7u6 ?
11-07-2013