Changeset 5358 in josm for trunk/src


Ignore:
Timestamp:
2012-07-24T23:14:52+02:00 (12 years ago)
Author:
Don-vip
Message:

fix #6345 - Display shortcut accelerators in tooltips with the language used by JOSM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r5114 r5358  
    55
    66import java.awt.Color;
     7import java.awt.Toolkit;
    78import java.io.BufferedReader;
    89import java.io.File;
     
    2829import java.util.Map;
    2930import java.util.Map.Entry;
    30 import java.util.Properties;
     31import java.util.ResourceBundle;
    3132import java.util.SortedMap;
    3233import java.util.TreeMap;
     
    5253import org.openstreetmap.josm.tools.ColorHelper;
    5354import org.openstreetmap.josm.tools.Utils;
    54 import org.openstreetmap.josm.tools.XmlObjectParser;
    5555
    5656/**
     
    14391439     */
    14401440    public void updateSystemProperties() {
    1441         Properties sysProp = System.getProperties();
    1442         sysProp.put("http.agent", Version.getInstance().getAgentString());
    1443         System.setProperties(sysProp);
     1441        updateSystemProperty("http.agent", Version.getInstance().getAgentString());
     1442        updateSystemProperty("user.language", Main.pref.get("language"));
     1443        // Workaround to fix a Java bug.
     1444        // Force AWT toolkit to update its internal preferences (fix #3645).
     1445        // This ugly hack comes from Sun bug database: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6292739
     1446        try {
     1447            Field field = Toolkit.class.getDeclaredField("resources");
     1448            field.setAccessible(true);
     1449            field.set(null, ResourceBundle.getBundle("sun.awt.resources.awt"));
     1450        } catch (Exception e) {
     1451            // Ignore all exceptions
     1452        }
     1453    }
     1454   
     1455    private void updateSystemProperty(String key, String value) {
     1456        if (value != null) {
     1457            System.setProperty(key, value);
     1458        }
    14441459    }
    14451460
Note: See TracChangeset for help on using the changeset viewer.