Changeset 966 in josm


Ignore:
Timestamp:
Sep 14, 2008 1:53:07 PM (5 years ago)
Author:
stoecker
Message:

commandline arg --language works as expected

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

Legend:

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

    r776 r966  
    206206         * early plugins are loaded (before constructor). 
    207207         */ 
    208         public static void loadPlugins(boolean early) { 
     208        public static void loadPlugins(boolean early, String lang) { 
    209209                List<String> plugins = new LinkedList<String>(); 
    210210                if (Main.pref.hasKey("plugins")) 
     
    212212                if (System.getProperty("josm.plugins") != null) 
    213213                        plugins.addAll(Arrays.asList(System.getProperty("josm.plugins").split(","))); 
    214                  
    215                 // we remove mappaint from the preferences on startup but this is just 
    216                 // in case it crept in through the properties: 
    217                 if (plugins.contains("mappaint")) { 
    218                         plugins.remove("mappaint"); 
    219                         System.out.println("Warning - loading of mappaint plugin was requested. This JOSM version has built-in mappaint support. The plugin is not required."); 
     214 
     215                String [] oldplugins = new String[]{"mappaint", "unglueplugin"}; 
     216                for(String p : oldplugins) 
     217                { 
     218                        if(plugins.contains(p)) 
     219                        { 
     220                                plugins.remove(p); 
     221                                System.out.println(tr("Warning - loading of {0} plugin was requested. This plugin is no longer required.", p)); 
     222                        } 
     223                } 
     224                if(lang != null) 
     225                { 
     226                        for(String p : plugins) 
     227                        { 
     228                                if(p.startsWith("lang-")) 
     229                                { 
     230                                        plugins.remove(p); 
     231                                        break; 
     232                                } 
     233                        } 
     234                        if(!lang.equals("en")) 
     235                                plugins.add("lang-"+lang); 
    220236                } 
    221237                 
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r873 r966  
    119119                        Main.pref.save(); 
    120120                } 
     121                String language = null; 
     122                if(args.containsKey("language")) 
     123                        language = (String)(args.get("language").toArray()[0]); 
    121124 
    122125                if (!PluginDownloader.moveUpdatedPlugins()) { 
     
    127130                 
    128131                // load the early plugins 
    129                 Main.loadPlugins(true); 
     132                Main.loadPlugins(true, language); 
    130133 
    131134                if (argList.contains("--help") || argList.contains("-?") || argList.contains("-h")) { 
     
    143146                                        "\t--no-fullscreen                           "+tr("Don't launch in fullscreen mode")+"\n"+ 
    144147                                        "\t--reset-preferences                       "+tr("Reset the preferences to default")+"\n\n"+ 
    145                                         "\t--language=<language>                     "+tr("Set the language. Example: ")+"\n\n"+ 
     148                                        "\t--language=<language>                     "+tr("Set the language.")+"\n\n"+ 
    146149                                        tr("examples")+":\n"+ 
    147150                                        "\tjava -jar josm.jar track1.gpx track2.gpx london.osm\n"+ 
     
    160163                Main.parent = mainFrame; 
    161164                final Main main = new MainApplication(mainFrame); 
    162                 Main.loadPlugins(false); 
     165                Main.loadPlugins(false, null); 
    163166                toolbar.refreshToolbarControl(); 
    164167 
Note: See TracChangeset for help on using the changeset viewer.