Changeset 8792 in josm for trunk/src/org


Ignore:
Timestamp:
2015-09-24T21:19:57+02:00 (5 years ago)
Author:
simon04
Message:

fix #11895 see #11765 - Some menu entries are no longer translated

Regression from r8721.

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

Legend:

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

    r8510 r8792  
    108108     */
    109109    public ImageryMenu(JMenu subMenu) {
    110         super(tr("Imagery"));
     110        super(trc("menu", "Imagery"));
    111111        setupMenuScroller();
    112112        MapView.addLayerChangeListener(this);
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r8748 r8792  
    33
    44import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    5 import static org.openstreetmap.josm.tools.I18n.marktrc;
    65import static org.openstreetmap.josm.tools.I18n.tr;
    76import static org.openstreetmap.josm.tools.I18n.trc;
     
    330329     * fileMenu contains I/O actions
    331330     */
    332     public final JMenu fileMenu = addMenu(/* I18N: mnemonic: F */ marktrc("menu", "File"), KeyEvent.VK_F, 0, ht("/Menu/File"));
     331    public final JMenu fileMenu = addMenu("File", /* I18N: mnemonic: F */ trc("menu", "File"), KeyEvent.VK_F, 0, ht("/Menu/File"));
    333332    /**
    334333     * sessionMenu is a submenu of File menu containing all session actions
     
    338337     * editMenu contains editing actions
    339338     */
    340     public final JMenu editMenu = addMenu(/* I18N: mnemonic: E */ marktrc("menu", "Edit"), KeyEvent.VK_E, 1, ht("/Menu/Edit"));
     339    public final JMenu editMenu = addMenu("Edit", /* I18N: mnemonic: E */ trc("menu", "Edit"), KeyEvent.VK_E, 1, ht("/Menu/Edit"));
    341340    /**
    342341     * viewMenu contains display actions (zoom, map styles, etc.)
    343342     */
    344     public final JMenu viewMenu = addMenu(/* I18N: mnemonic: V */ marktrc("menu", "View"), KeyEvent.VK_V, 2, ht("/Menu/View"));
     343    public final JMenu viewMenu = addMenu("View", /* I18N: mnemonic: V */ trc("menu", "View"), KeyEvent.VK_V, 2, ht("/Menu/View"));
    345344    /**
    346345     * toolsMenu contains different geometry manipulation actions from JOSM core (most used)
    347346     * The plugins should use other menus
    348347     */
    349     public final JMenu toolsMenu = addMenu(/* I18N: mnemonic: T */ marktrc("menu", "Tools"), KeyEvent.VK_T, 3, ht("/Menu/Tools"));
     348    public final JMenu toolsMenu = addMenu("Tools", /* I18N: mnemonic: T */ trc("menu", "Tools"), KeyEvent.VK_T, 3, ht("/Menu/Tools"));
    350349    /**
    351350     * moreToolsMenu contains geometry-related actions from all the plugins
    352351     * @since 6082 (moved from Utilsplugin2)
    353352     */
    354     public final JMenu moreToolsMenu = addMenu(/* I18N: mnemonic: M */ marktrc("menu", "More tools"), KeyEvent.VK_M, 4, ht("/Menu/MoreTools"));
     353    public final JMenu moreToolsMenu = addMenu("More tools", /* I18N: mnemonic: M */ trc("menu", "More tools"), KeyEvent.VK_M, 4, ht("/Menu/MoreTools"));
    355354    /**
    356355     * dataMenu contains plugin actions that are related to certain tagging schemes (addressing opening hours),
     
    358357     * @since 6082
    359358     */
    360     public final JMenu dataMenu = addMenu(/* I18N: mnemonic: D */ marktrc("menu", "Data"), KeyEvent.VK_D, 5, ht("/Menu/Data"));
     359    public final JMenu dataMenu = addMenu("Data", /* I18N: mnemonic: D */ trc("menu", "Data"), KeyEvent.VK_D, 5, ht("/Menu/Data"));
    361360    /**
    362361     * selectionMenu contains all actions related to selecting different objects
    363362     * @since 6082 (moved from Utilsplugin2)
    364363     */
    365     public final JMenu selectionMenu = addMenu(/* I18N: mnemonic: N */ marktrc("menu", "Selection"), KeyEvent.VK_N, 6, ht("/Menu/Selection"));
     364    public final JMenu selectionMenu = addMenu("Selection", /* I18N: mnemonic: N */ trc("menu", "Selection"), KeyEvent.VK_N, 6, ht("/Menu/Selection"));
    366365    /**
    367366     * presetsMenu contains presets actions (search, presets tree)
    368367     */
    369     public final JMenu presetsMenu = addMenu(/* I18N: mnemonic: P */ marktrc("menu", "Presets"), KeyEvent.VK_P, 7, ht("/Menu/Presets"));
     368    public final JMenu presetsMenu = addMenu("Presets", /* I18N: mnemonic: P */ trc("menu", "Presets"), KeyEvent.VK_P, 7, ht("/Menu/Presets"));
    370369    /**
    371370     * submenu in Imagery menu that contains plugin-managed additional imagery layers
     
    377376     */
    378377    // CHECKSTYLE.OFF: LineLength
    379     public final ImageryMenu imageryMenu = addMenu(new ImageryMenu(imagerySubMenu), /* I18N: mnemonic: I */ marktrc("menu", "Imagery"), KeyEvent.VK_I, 8, ht("/Menu/Imagery"));
     378    public final ImageryMenu imageryMenu = addMenu(new ImageryMenu(imagerySubMenu), /* I18N: mnemonic: I */ "Imagery", KeyEvent.VK_I, 8, ht("/Menu/Imagery"));
    380379    // CHECKSTYLE.ON: LineLength
    381380    /**
     
    384383     * @since 6082
    385384     */
    386     public final JMenu gpsMenu = addMenu(/* I18N: mnemonic: G */ marktrc("menu", "GPS"), KeyEvent.VK_G, 9, ht("/Menu/GPS"));
     385    public final JMenu gpsMenu = addMenu("GPS", /* I18N: mnemonic: G */ trc("menu", "GPS"), KeyEvent.VK_G, 9, ht("/Menu/GPS"));
    387386    /** the window menu is split into several groups. The first is for windows that can be opened from
    388387     * this menu any time, e.g. the changeset editor. The second group is for toggle dialogs and the third
     
    390389     * to use WINDOW_MENU_GROUP to determine the group integer.
    391390     */
    392     public final JMenu windowMenu = addMenu(/* I18N: mnemonic: W */ marktrc("menu", "Windows"), KeyEvent.VK_W, 10, ht("/Menu/Windows"));
     391    public final JMenu windowMenu = addMenu("Windows", /* I18N: mnemonic: W */ trc("menu", "Windows"), KeyEvent.VK_W, 10, ht("/Menu/Windows"));
    393392
    394393    /**
     
    399398     * helpMenu contains JOSM general actions (Help, About, etc.)
    400399     */
    401     public final JMenu helpMenu = addMenu(/* I18N: mnemonic: H */ marktrc("menu", "Help"), KeyEvent.VK_H, 11, ht("/Menu/Help"));
     400    public final JMenu helpMenu = addMenu("Help", /* I18N: mnemonic: H */ trc("menu", "Help"), KeyEvent.VK_H, 11, ht("/Menu/Help"));
    402401
    403402    private static final int defaultMenuPos = 11;
     
    606605    }
    607606
     607    /**
     608     * @deprecated Use {@link #addMenu(String, String, int, int, String)} instead.
     609     */
     610    // Kept for compatibility with plugins
     611    @Deprecated
    608612    public JMenu addMenu(String name, int mnemonicKey, int position, String relativeHelpTopic) {
    609         final JMenu menu = new JMenu(tr(name));
     613        return addMenu(name, tr(name), mnemonicKey, position, relativeHelpTopic);
     614    }
     615
     616    /**
     617     * Creates a menu and adds it on the given position to the main menu.
     618     *
     619     * @param name              the untranslated name (used as identifier for shortcut registration)
     620     * @param translatedName    the translated menu name (use {@code I18n.trc("menu", name)} to allow better internationalization
     621     * @param mnemonicKey       the mnemonic key to register
     622     * @param position          the position in the main menu
     623     * @param relativeHelpTopic the relative help topic
     624     * @return the newly created menu
     625     */
     626    public JMenu addMenu(String name, String translatedName, int mnemonicKey, int position, String relativeHelpTopic) {
     627        final JMenu menu = new JMenu(translatedName);
    610628        if (!GraphicsEnvironment.isHeadless()) {
    611629            MenuScroller.setScrollerFor(menu);
     
    614632    }
    615633
     634    /**
     635     * Adds the given menu on the given position to the main menu.
     636     *
     637     * @param menu              the menu to add
     638     * @param name              the untranslated name (used as identifier for shortcut registration)
     639     * @param mnemonicKey       the mnemonic key to register
     640     * @param position          the position in the main menu
     641     * @param relativeHelpTopic the relative help topic
     642     * @return the given {@code }menu}
     643     */
    616644    public <T extends JMenu> T addMenu(T menu, String name, int mnemonicKey, int position, String relativeHelpTopic) {
    617         Shortcut.registerShortcut("menu:" + name, tr("Menu: {0}", trc("menu", name)), mnemonicKey,
     645        Shortcut.registerShortcut("menu:" + name, tr("Menu: {0}", getName()), mnemonicKey,
    618646                Shortcut.MNEMONIC).setMnemonic(menu);
    619647        add(menu, position);
     
    914942    protected void showAudioMenu(boolean showMenu) {
    915943        if (showMenu && audioMenu == null) {
    916             audioMenu = addMenu(/* I18N: mnemonic: U */ marktrc("menu", "Audio"), KeyEvent.VK_U, defaultMenuPos, ht("/Menu/Audio"));
     944            audioMenu = addMenu("Audio", /* I18N: mnemonic: U */ trc("menu", "Audio"), KeyEvent.VK_U, defaultMenuPos, ht("/Menu/Audio"));
    917945            add(audioMenu, audioPlayPause);
    918946            add(audioMenu, audioNext);
Note: See TracChangeset for help on using the changeset viewer.