Changeset 1802 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2009-07-17T20:53:35+02:00 (15 years ago)
Author:
stoecker
Message:

cleanup license and contributions a bit

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AboutAction.java

    r1755 r1802  
    127127        JTextArea readme = loadFile(Main.class.getResource("/README"), false);
    128128        JTextArea contribution = loadFile(Main.class.getResource("/CONTRIBUTION"), false);
     129        JTextArea license = loadFile(Main.class.getResource("/LICENSE"), false);
    129130
    130131        JPanel info = new JPanel(new GridBagLayout());
     
    148149        about.addTab(tr("Revision"), createScrollPane(revision));
    149150        about.addTab(tr("Contribution"), createScrollPane(contribution));
     151        about.addTab(tr("License"), createScrollPane(license));
    150152        about.addTab(tr("Plugins"), new JScrollPane(PluginHandler.getInfoPanel()));
    151153
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r1677 r1802  
    33package org.openstreetmap.josm.gui;
    44
    5 import static org.openstreetmap.josm.tools.I18n.i18n;
    65import static org.openstreetmap.josm.tools.I18n.tr;
    76
     
    1514import java.util.LinkedList;
    1615import java.util.List;
    17 import java.util.Locale;
    1816import java.util.Map;
    19 import java.util.MissingResourceException;
    2017
    2118import javax.swing.JFrame;
     
    2522import org.openstreetmap.josm.tools.BugReportExceptionHandler;
    2623import org.openstreetmap.josm.tools.ImageProvider;
    27 import org.xnap.commons.i18n.I18nFactory;
     24import org.openstreetmap.josm.tools.I18n;
    2825
    2926/**
     
    6360     */
    6461    public static void main(final String[] argArray) {
    65         /* try initial language settings, may be changed later again */
    66         try { i18n = I18nFactory.getI18n(MainApplication.class); }
    67         catch (MissingResourceException ex) { Locale.setDefault(Locale.ENGLISH);}
     62        I18n.init();
    6863
    6964        Thread.setDefaultUncaughtExceptionHandler(new BugReportExceptionHandler());
     
    9287        Main.pref.init(args.containsKey("reset-preferences"));
    9388
    94         String localeName = null; // The locale to use
    95 
    9689        // Check if passed as parameter
    9790        if (args.containsKey("language"))
    98             localeName = (String)(args.get("language").toArray()[0]);
    99 
    100         if (localeName == null)
    101             localeName = Main.pref.get("language", null);
    102 
    103         if (localeName != null) {
    104             Locale l;
    105             Locale d = Locale.getDefault();
    106             if (localeName.equals("he")) localeName = "iw_IL";
    107             int i = localeName.indexOf('_');
    108             if (i > 0) {
    109                 l = new Locale(localeName.substring(0, i), localeName.substring(i + 1));
    110             } else {
    111                 l = new Locale(localeName);
    112             }
    113             try {
    114                 Locale.setDefault(l);
    115                 i18n = I18nFactory.getI18n(MainApplication.class);
    116             } catch (MissingResourceException ex) {
    117                 if (!l.getLanguage().equals("en")) {
    118                     System.out.println(tr("Unable to find translation for the locale {0}. Reverting to {1}.",
    119                     l.getDisplayName(), d.getDisplayName()));
    120                     Locale.setDefault(d);
    121                 } else {
    122                     i18n = null;
    123                 }
    124             }
    125         }
     91            I18n.set((String)(args.get("language").toArray()[0]));
     92        else
     93            I18n.set(Main.pref.get("language", null));
    12694
    12795        if (argList.contains("--help") || argList.contains("-?") || argList.contains("-h")) {
  • trunk/src/org/openstreetmap/josm/tools/I18n.java

    r1583 r1802  
    77import java.util.Locale;
    88import java.util.LinkedList;
     9import java.util.MissingResourceException;
    910import java.util.Vector;
     11import org.openstreetmap.josm.gui.MainApplication;
     12import org.xnap.commons.i18n.I18nFactory;
    1013
    1114/**
     
    8992        return l;
    9093    }
     94
     95    public static void init()
     96    {
     97        /* try initial language settings, may be changed later again */
     98        try { i18n = I18nFactory.getI18n(MainApplication.class); }
     99        catch (MissingResourceException ex) { Locale.setDefault(Locale.ENGLISH);}
     100    }
     101
     102    public static void set(String localeName)
     103    {
     104        if (localeName != null) {
     105            Locale l;
     106            Locale d = Locale.getDefault();
     107            if (localeName.equals("he")) localeName = "iw_IL";
     108            int i = localeName.indexOf('_');
     109            if (i > 0) {
     110                l = new Locale(localeName.substring(0, i), localeName.substring(i + 1));
     111            } else {
     112                l = new Locale(localeName);
     113            }
     114            try {
     115                Locale.setDefault(l);
     116                i18n = I18nFactory.getI18n(MainApplication.class);
     117            } catch (MissingResourceException ex) {
     118                if (!l.getLanguage().equals("en")) {
     119                    System.out.println(tr("Unable to find translation for the locale {0}. Reverting to {1}.",
     120                    l.getDisplayName(), d.getDisplayName()));
     121                    Locale.setDefault(d);
     122                } else {
     123                    i18n = null;
     124                }
     125            }
     126        }
     127    }
    91128}
Note: See TracChangeset for help on using the changeset viewer.