Changeset 3294 in josm for trunk


Ignore:
Timestamp:
2010-06-02T10:25:27+02:00 (14 years ago)
Author:
bastiK
Message:

fixed #5093 - translation for open file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/I18n.java

    r3259 r3294  
    1212import java.util.Vector;
    1313
     14import javax.swing.JFileChooser;
     15import javax.swing.UIManager;
     16
    1417import org.openstreetmap.josm.Main;
    1518
     
    2326        MODE_CS, MODE_AR, MODE_PL, MODE_RO, MODE_RU, MODE_SK, MODE_SL}
    2427    private static PluralMode pluralMode = PluralMode.MODE_NOTONE; /* english default */
     28    private static String[] fileChooserDialogStringKeys = new String[] {
     29        "FileChooser.detailsViewActionLabelText",
     30        "FileChooser.detailsViewButtonAccessibleName",
     31        "FileChooser.detailsViewButtonToolTipText",
     32        "FileChooser.fileAttrHeaderText",
     33        "FileChooser.fileDateHeaderText",
     34        "FileChooser.fileNameHeaderText",
     35        "FileChooser.fileNameLabelText",
     36        "FileChooser.fileSizeHeaderText",
     37        "FileChooser.fileTypeHeaderText",
     38        "FileChooser.filesOfTypeLabelText",
     39        "FileChooser.homeFolderAccessibleName",
     40        "FileChooser.homeFolderToolTipText",
     41        "FileChooser.listViewActionLabelText",
     42        "FileChooser.listViewButtonAccessibleName",
     43        "FileChooser.listViewButtonToolTipText",
     44        "FileChooser.lookInLabelText",
     45        "FileChooser.newFolderAccessibleName",
     46        "FileChooser.newFolderActionLabelText",
     47        "FileChooser.newFolderToolTipText",
     48        "FileChooser.refreshActionLabelText",
     49        "FileChooser.saveInLabelText",
     50        "FileChooser.upFolderAccessibleName",
     51        "FileChooser.upFolderToolTipText",
     52        "FileChooser.viewMenuLabelText"};
    2553    private static HashMap<String, String> strings = null;
    2654    private static HashMap<String, String[]> pstrings = null;
     
    349377                l = new Locale(localeName);
    350378            }
    351             if(load(localeName)) {
     379            if (load(localeName)) {
    352380                Locale.setDefault(l);
     381               
     382                // localization for file chooser dialog
     383                JFileChooser.setDefaultLocale(l);
     384                for (String key : fileChooserDialogStringKeys) {
     385                    String us = UIManager.getString(key, Locale.US);
     386                    String loc = UIManager.getString(key, l);
     387                    // only provide custom translation if it is not already localized by Java
     388                    if (us.equals(loc)) {
     389                        UIManager.put(key, tr(us));
     390                    }
     391                }
    353392            } else {
    354393                if (!l.getLanguage().equals("en")) {
Note: See TracChangeset for help on using the changeset viewer.