The list of supported locales for "User Interface Translation" does not have all the languages I need to support. How can I add more languages for a JFileChooser?
views:
20answers:
1
+1
A:
You can change the properties of your JFileChooser like FileChooser.openButtonText
UIManager.put("FileChooser.acceptAllFileFilterText", "Directorios");
UIManager.put("FileChooser.lookInLabelText", "Localização");
UIManager.put("FileChooser.cancelButtonText", "Cancelar");
UIManager.put("FileChooser.cancelButtonToolTipText", "Cancelar");
UIManager.put("FileChooser.openButtonText", "Adicionar");
UIManager.put("FileChooser.openButtonToolTipText", "Adicionar ficheiro(s)");
UIManager.put("FileChooser.filesOfTypeLabelText", "Tipo");
UIManager.put("FileChooser.fileNameLabelText", "Ficheiro(s)");
UIManager.put("FileChooser.listViewButtonToolTipText", "Lista");
UIManager.put("FileChooser.listViewButtonAccessibleName", "Lista");
UIManager.put("FileChooser.detailsViewButtonToolTipText", "Detalhes");
UIManager.put("FileChooser.detailsViewButtonAccessibleName", "Detalhes");
UIManager.put("FileChooser.upFolderToolTipText", "Um nível acima");
UIManager.put("FileChooser.upFolderAccessibleName", "Um nível acima");
UIManager.put("FileChooser.homeFolderToolTipText", "Ambiente de Trabalho");
UIManager.put("FileChooser.homeFolderAccessibleName", "Ambiente de Trabalho"); UIManager.put("FileChooser.fileNameHeaderText", "Nome");
UIManager.put("FileChooser.fileSizeHeaderText", "Tamanho");
UIManager.put("FileChooser.fileTypeHeaderText", "Tipo");
UIManager.put("FileChooser.fileDateHeaderText", "Data");
UIManager.put("FileChooser.fileAttrHeaderText", "Atributos");
UIManager.put("FileChooser.openDialogTitleText","Adicionar Fotos");
UIManager.put("FileChooser.readOnly", Boolean.TRUE);
Resources :
Colin Hebert
2010-09-08 21:16:57
so, is there any way to put this in a propeties file so the correct locale choosing logic will be performed? I could add a check in code for the locales I am looking for but I would rather have the jvm choose the right file for me.
Tony Eichelberger
2010-09-08 21:26:59
AFAIK, I'm afraid you have to check the locale and set up the new values manually.
Colin Hebert
2010-09-08 21:39:03
You can subclass JFileChooser, add similar code in static initialization block (required) and then you can export these values to properties just as you always do.
Paweł Dyda
2010-09-09 07:21:08
There is also a way to externalize mnemonics this way but it won't be so easy to find. By the way: in JDK 6 home folder (desktop) comes from OS, so there is no way to translate it (Vista and above will always show you English name)
Paweł Dyda
2010-09-09 07:23:41