Changeset 6108 in josm for trunk/src/org


Ignore:
Timestamp:
2013-08-03T02:24:38+02:00 (11 years ago)
Author:
Don-vip
Message:

fix #8912 - language command line option evaluated too late

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r6084 r6108  
    229229        I18n.init();
    230230        Main.checkJava6();
    231         Main.pref = new Preferences();
    232 
    233         Policy.setPolicy(new Policy() {
    234             // Permissions for plug-ins loaded when josm is started via webstart
    235             private PermissionCollection pc;
    236 
    237             {
    238                 pc = new Permissions();
    239                 pc.add(new AllPermission());
    240             }
    241 
    242             @Override
    243             public void refresh() { }
    244 
    245             @Override
    246             public PermissionCollection getPermissions(CodeSource codesource) {
    247                 return pc;
    248             }
    249         });
    250 
    251         Thread.setDefaultUncaughtExceptionHandler(new BugReportExceptionHandler());
    252         // http://stuffthathappens.com/blog/2007/10/15/one-more-note-on-uncaught-exception-handlers/
    253         System.setProperty("sun.awt.exception.handler", BugReportExceptionHandler.class.getName());
    254 
    255         // initialize the platform hook, and
    256         Main.determinePlatformHook();
    257         // call the really early hook before we do anything else
    258         Main.platform.preStartupHook();
    259231
    260232        // construct argument table
     
    265237            System.exit(1);
    266238        }
     239       
     240        final boolean languageGiven = args.containsKey(Option.LANGUAGE);
     241
     242        if (languageGiven) {
     243            I18n.set(args.get(Option.LANGUAGE).iterator().next());
     244        }
     245
     246        Main.pref = new Preferences();
     247
     248        Policy.setPolicy(new Policy() {
     249            // Permissions for plug-ins loaded when josm is started via webstart
     250            private PermissionCollection pc;
     251
     252            {
     253                pc = new Permissions();
     254                pc.add(new AllPermission());
     255            }
     256
     257            @Override
     258            public void refresh() { }
     259
     260            @Override
     261            public PermissionCollection getPermissions(CodeSource codesource) {
     262                return pc;
     263            }
     264        });
     265
     266        Thread.setDefaultUncaughtExceptionHandler(new BugReportExceptionHandler());
     267        // http://stuffthathappens.com/blog/2007/10/15/one-more-note-on-uncaught-exception-handlers/
     268        System.setProperty("sun.awt.exception.handler", BugReportExceptionHandler.class.getName());
     269
     270        // initialize the platform hook, and
     271        Main.determinePlatformHook();
     272        // call the really early hook before we do anything else
     273        Main.platform.preStartupHook();
    267274
    268275        Main.commandLineArgs = argArray;
    269 
     276       
    270277        if (args.containsKey(Option.VERSION)) {
    271278            System.out.println(Version.getInstance().getAgentString());
    272279            System.exit(0);
    273         } //else {
    274         //    System.out.println(Version.getInstance().getReleaseAttributes());
    275         //}
     280        }
    276281
    277282        Main.pref.init(args.containsKey(Option.RESET_PREFERENCES));
    278283
    279         // Check if passed as parameter
    280         if (args.containsKey(Option.LANGUAGE)) {
    281             I18n.set(args.get(Option.LANGUAGE).iterator().next());
    282         } else {
     284        if (!languageGiven) {
    283285            I18n.set(Main.pref.get("language", null));
    284286        }
Note: See TracChangeset for help on using the changeset viewer.