Changeset 13793 in josm


Ignore:
Timestamp:
2018-05-20T21:19:27+02:00 (17 months ago)
Author:
Don-vip
Message:

see #16288 - replace similar i18n strings (script update for plugins)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/data/defaultpresets.xml

    r13789 r13793  
    41264126            <combo key="reservation" text="Reservation" values="yes,no,required,recommended,members_only" />
    41274127            <text key="ele" text="Elevation" />
    4128             <text key="description" text="Closer Description" />
     4128            <text key="description" text="Closer description" />
    41294129            <space />
    41304130            <reference ref="link_contact_address_payment" />
     
    44404440            <combo key="map_type" text="Detail Grade" values="topo,street,scheme,toposcope" />
    44414441            <combo key="map_size" text="Shown Area" values="site,city,region" />
    4442             <text key="description" text="Closer Description" />
     4442            <text key="description" text="Closer description" />
    44434443            <optional text="Routes shown for:">
    44444444                <check key="hiking" text="Hiking" />
     
    44644464            <text key="name" text="Name" />
    44654465            <combo key="board_type" text="Board Content" values="notice,history,nature,wildlife,plants,geology" />
    4466             <text key="description" text="Closer Description" />
     4466            <text key="description" text="Closer description" />
    44674467        </item> <!-- Information Board -->
    44684468        <item name="Guidepost" icon="presets/misc/information/guidepost.svg" type="node" preset_name_label="true">
     
    45424542            <key key="tourism" value="information" />
    45434543            <text key="name" text="Name" />
    4544             <text key="description" text="Closer Description" />
     4544            <text key="description" text="Closer description" />
    45454545        </item> <!-- Other Information Point -->
    45464546    </group> <!-- Tourism -->
  • trunk/scripts/I18nSimilarStrings.java

    r13761 r13793  
    33import java.util.List;
    44
     5import org.openstreetmap.josm.Main;
     6import org.openstreetmap.josm.data.Preferences;
     7import org.openstreetmap.josm.data.UndoRedoHandler;
     8import org.openstreetmap.josm.data.preferences.JosmBaseDirectories;
    59import org.openstreetmap.josm.data.validation.tests.SimilarNamedWays;
     10import org.openstreetmap.josm.gui.MainApplication;
     11import org.openstreetmap.josm.gui.MainApplicationTest;
     12import org.openstreetmap.josm.plugins.PluginHandlerTestIT;
     13import org.openstreetmap.josm.spi.preferences.Config;
    614import org.openstreetmap.josm.tools.I18n;
    715
     
    1927    public static void main(String[] args) {
    2028        I18n.init();
     29        Main.determinePlatformHook();
     30        Config.setBaseDirectoriesProvider(JosmBaseDirectories.getInstance());
     31        Preferences pref = new Preferences();
     32        Config.setPreferencesInstance(pref);
     33        pref.init(false);
     34        MainApplication.undoRedo = new UndoRedoHandler();
     35        MainApplicationTest.initContentPane();
     36        MainApplicationTest.initToolbar();
     37        MainApplicationTest.initMainMenu();
     38        PluginHandlerTestIT.loadAllPlugins();
    2139        List<String> strings = new ArrayList<>();
    2240        strings.addAll(I18n.getSingularTranslations().keySet());
    2341        strings.addAll(I18n.getPluralTranslations().keySet());
    24         System.out.println("Loaded " + strings.size() + " core strings");
     42        System.out.println("Loaded " + strings.size() + " strings");
    2543        strings.removeIf(s -> s.length() <= 5);
    26         System.out.println("Kept " + strings.size() + " core strings longer than 5 characters");
     44        System.out.println("Kept " + strings.size() + " strings longer than 5 characters");
    2745        Collections.sort(strings);
    2846        for (int i = 0; i < strings.size(); i++) {
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java

    r12849 r13793  
    5050    @Test
    5151    public void testValidityOfAvailablePlugins() {
     52        loadAllPlugins();
     53
     54        Map<String, Throwable> loadingExceptions = PluginHandler.pluginLoadingExceptions.entrySet().stream()
     55                .collect(Collectors.toMap(e -> e.getKey(), e -> ExceptionUtils.getRootCause(e.getValue())));
     56
     57        // Add/remove layers twice to test basic plugin good behaviour
     58        Map<String, Throwable> layerExceptions = new HashMap<>();
     59        List<PluginInformation> loadedPlugins = PluginHandler.getPlugins();
     60        for (int i = 0; i < 2; i++) {
     61            OsmDataLayer layer = new OsmDataLayer(new DataSet(), "Layer "+i, null);
     62            testPlugin(MainApplication.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
     63            testPlugin(MainApplication.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
     64        }
     65        for (int i = 0; i < 2; i++) {
     66            GpxLayer layer = new GpxLayer(new GpxData());
     67            testPlugin(MainApplication.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
     68            testPlugin(MainApplication.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
     69        }
     70
     71        MapUtils.debugPrint(System.out, null, loadingExceptions);
     72        MapUtils.debugPrint(System.out, null, layerExceptions);
     73        String msg = Arrays.toString(loadingExceptions.entrySet().toArray()) + '\n' +
     74                     Arrays.toString(layerExceptions.entrySet().toArray());
     75        assertTrue(msg, loadingExceptions.isEmpty() && layerExceptions.isEmpty());
     76    }
     77
     78    /**
     79     * Downloads and loads all JOSM plugins.
     80     */
     81    public static void loadAllPlugins() {
    5282        // Download complete list of plugins
    5383        ReadRemotePluginInformationTask pluginInfoDownloadTask = new ReadRemotePluginInformationTask(
     
    81111        // Load late plugins
    82112        PluginHandler.loadLatePlugins(null, plugins, null);
    83 
    84         Map<String, Throwable> loadingExceptions = PluginHandler.pluginLoadingExceptions.entrySet().stream()
    85                 .collect(Collectors.toMap(e -> e.getKey(), e -> ExceptionUtils.getRootCause(e.getValue())));
    86 
    87         // Add/remove layers twice to test basic plugin good behaviour
    88         Map<String, Throwable> layerExceptions = new HashMap<>();
    89         List<PluginInformation> loadedPlugins = PluginHandler.getPlugins();
    90         for (int i = 0; i < 2; i++) {
    91             OsmDataLayer layer = new OsmDataLayer(new DataSet(), "Layer "+i, null);
    92             testPlugin(MainApplication.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
    93             testPlugin(MainApplication.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
    94         }
    95         for (int i = 0; i < 2; i++) {
    96             GpxLayer layer = new GpxLayer(new GpxData());
    97             testPlugin(MainApplication.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
    98             testPlugin(MainApplication.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
    99         }
    100 
    101         MapUtils.debugPrint(System.out, null, loadingExceptions);
    102         MapUtils.debugPrint(System.out, null, layerExceptions);
    103         String msg = Arrays.toString(loadingExceptions.entrySet().toArray()) + '\n' +
    104                      Arrays.toString(layerExceptions.entrySet().toArray());
    105         assertTrue(msg, loadingExceptions.isEmpty() && layerExceptions.isEmpty());
    106113    }
    107114
Note: See TracChangeset for help on using the changeset viewer.