Changeset 8721 in josm for trunk/src/org


Ignore:
Timestamp:
2015-09-02T23:27:47+02:00 (5 years ago)
Author:
simon04
Message:

fix #11765 - Seperate menu entry i18n strings, add mnemonics as translation hints

File:
1 edited

Legend:

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

    r8720 r8721  
    33
    44import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    5 import static org.openstreetmap.josm.tools.I18n.marktr;
     5import static org.openstreetmap.josm.tools.I18n.marktrc;
    66import static org.openstreetmap.josm.tools.I18n.tr;
     7import static org.openstreetmap.josm.tools.I18n.trc;
    78
    89import java.awt.Component;
     
    329330     * fileMenu contains I/O actions
    330331     */
    331     public final JMenu fileMenu = addMenu(marktr("File"), KeyEvent.VK_F, 0, ht("/Menu/File"));
     332    public final JMenu fileMenu = addMenu(/* I18N: mnemonic: F */ marktrc("menu", "File"), KeyEvent.VK_F, 0, ht("/Menu/File"));
    332333    /**
    333334     * sessionMenu is a submenu of File menu containing all session actions
     
    337338     * editMenu contains editing actions
    338339     */
    339     public final JMenu editMenu = addMenu(marktr("Edit"), KeyEvent.VK_E, 1, ht("/Menu/Edit"));
     340    public final JMenu editMenu = addMenu(/* I18N: mnemonic: E */ marktrc("menu", "Edit"), KeyEvent.VK_E, 1, ht("/Menu/Edit"));
    340341    /**
    341342     * viewMenu contains display actions (zoom, map styles, etc.)
    342343     */
    343     public final JMenu viewMenu = addMenu(marktr("View"), KeyEvent.VK_V, 2, ht("/Menu/View"));
     344    public final JMenu viewMenu = addMenu(/* I18N: mnemonic: V */ marktrc("menu", "View"), KeyEvent.VK_V, 2, ht("/Menu/View"));
    344345    /**
    345346     * toolsMenu contains different geometry manipulation actions from JOSM core (most used)
    346347     * The plugins should use other menus
    347348     */
    348     public final JMenu toolsMenu = addMenu(marktr("Tools"), KeyEvent.VK_T, 3, ht("/Menu/Tools"));
     349    public final JMenu toolsMenu = addMenu(/* I18N: mnemonic: T */ marktrc("menu", "Tools"), KeyEvent.VK_T, 3, ht("/Menu/Tools"));
    349350    /**
    350351     * moreToolsMenu contains geometry-related actions from all the plugins
    351352     * @since 6082 (moved from Utilsplugin2)
    352353     */
    353     public final JMenu moreToolsMenu = addMenu(marktr("More tools"), KeyEvent.VK_M, 4, ht("/Menu/MoreTools"));
     354    public final JMenu moreToolsMenu = addMenu(/* I18N: mnemonic: M */ marktrc("menu", "More tools"), KeyEvent.VK_M, 4, ht("/Menu/MoreTools"));
    354355    /**
    355356     * dataMenu contains plugin actions that are related to certain tagging schemes (addressing opening hours),
     
    357358     * @since 6082
    358359     */
    359     public final JMenu dataMenu = addMenu(marktr("Data"), KeyEvent.VK_D, 5, ht("/Menu/Data"));
     360    public final JMenu dataMenu = addMenu(/* I18N: mnemonic: D */ marktrc("menu", "Data"), KeyEvent.VK_D, 5, ht("/Menu/Data"));
    360361    /**
    361362     * selectionMenu contains all actions related to selecting different objects
    362363     * @since 6082 (moved from Utilsplugin2)
    363364     */
    364     public final JMenu selectionMenu = addMenu(marktr("Selection"), KeyEvent.VK_N, 6, ht("/Menu/Selection"));
     365    public final JMenu selectionMenu = addMenu(/* I18N: mnemonic: N */ marktrc("menu", "Selection"), KeyEvent.VK_N, 6, ht("/Menu/Selection"));
    365366    /**
    366367     * presetsMenu contains presets actions (search, presets tree)
    367368     */
    368     public final JMenu presetsMenu = addMenu(marktr("Presets"), KeyEvent.VK_P, 7, ht("/Menu/Presets"));
     369    public final JMenu presetsMenu = addMenu(/* I18N: mnemonic: P */ marktrc("menu", "Presets"), KeyEvent.VK_P, 7, ht("/Menu/Presets"));
    369370    /**
    370371     * submenu in Imagery menu that contains plugin-managed additional imagery layers
     
    375376     * imageryMenu contains all imagery-related actions
    376377     */
    377     public final ImageryMenu imageryMenu = addMenu(new ImageryMenu(imagerySubMenu), marktr("Imagery"), KeyEvent.VK_I, 8, ht("/Menu/Imagery"));
     378    // 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"));
     380    // CHECKSTYLE.ON: LineLength
    378381    /**
    379382     * gpsMenu contains all plugin actions that are related
     
    381384     * @since 6082
    382385     */
    383     public final JMenu gpsMenu = addMenu(marktr("GPS"), KeyEvent.VK_G, 9, ht("/Menu/GPS"));
     386    public final JMenu gpsMenu = addMenu(/* I18N: mnemonic: G */ marktrc("menu", "GPS"), KeyEvent.VK_G, 9, ht("/Menu/GPS"));
    384387    /** the window menu is split into several groups. The first is for windows that can be opened from
    385388     * this menu any time, e.g. the changeset editor. The second group is for toggle dialogs and the third
     
    387390     * to use WINDOW_MENU_GROUP to determine the group integer.
    388391     */
    389     public final JMenu windowMenu = addMenu(marktr("Windows"), KeyEvent.VK_W, 10, ht("/Menu/Windows"));
     392    public final JMenu windowMenu = addMenu(/* I18N: mnemonic: W */ marktrc("menu", "Windows"), KeyEvent.VK_W, 10, ht("/Menu/Windows"));
    390393
    391394    /**
     
    396399     * helpMenu contains JOSM general actions (Help, About, etc.)
    397400     */
    398     public final JMenu helpMenu = addMenu(marktr("Help"), KeyEvent.VK_H, 11, ht("/Menu/Help"));
     401    public final JMenu helpMenu = addMenu(/* I18N: mnemonic: H */ marktrc("menu", "Help"), KeyEvent.VK_H, 11, ht("/Menu/Help"));
    399402
    400403    private static final int defaultMenuPos = 11;
     
    612615
    613616    public <T extends JMenu> T addMenu(T menu, String name, int mnemonicKey, int position, String relativeHelpTopic) {
    614         Shortcut.registerShortcut("menu:" + name, tr("Menu: {0}", tr(name)), mnemonicKey,
     617        Shortcut.registerShortcut("menu:" + name, tr("Menu: {0}", trc("menu", name)), mnemonicKey,
    615618                Shortcut.MNEMONIC).setMnemonic(menu);
    616619        add(menu, position);
     
    911914    protected void showAudioMenu(boolean showMenu) {
    912915        if (showMenu && audioMenu == null) {
    913             audioMenu = addMenu(marktr("Audio"), KeyEvent.VK_U, defaultMenuPos, ht("/Menu/Audio"));
     916            audioMenu = addMenu(/* I18N: mnemonic: U */ marktrc("Audio", "menu"), KeyEvent.VK_U, defaultMenuPos, ht("/Menu/Audio"));
    914917            add(audioMenu, audioPlayPause);
    915918            add(audioMenu, audioNext);
Note: See TracChangeset for help on using the changeset viewer.