mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Apply translation to the context menu
This commit is contained in:
@@ -3090,6 +3090,10 @@
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Dismissing the closing confirmation dialog using the "X" button should behave the same as selecting "Cancel"</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Apply translation to the context menu</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
</org.diylc.appframework.update.Version>
|
||||
|
||||
Binary file not shown.
@@ -24,6 +24,7 @@
|
||||
5PDT (Center OFF)
|
||||
AWG
|
||||
And
|
||||
Apply Variant
|
||||
C-B-E BJT
|
||||
D-G-S JFET
|
||||
D-G-S MOSFET
|
||||
@@ -44,6 +45,7 @@ G-D-S JFET
|
||||
G-D-S MOSFET
|
||||
G-S-D JFET
|
||||
G-S-D MOSFET
|
||||
Jezik
|
||||
Lin
|
||||
Loadline Editor
|
||||
Log
|
||||
@@ -63,7 +65,10 @@ SMD
|
||||
SPDT
|
||||
SPDT (Center OFF)
|
||||
SPST
|
||||
Save as Building Block
|
||||
Select
|
||||
Srpski
|
||||
Unlock
|
||||
Xnor
|
||||
Xor
|
||||
cm
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
*
|
||||
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
*
|
||||
* This file is part of DIYLC.
|
||||
*
|
||||
* DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License as published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* DIYLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with DIYLC. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.diylc.swing.gui;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
import org.diylc.lang.LangUtil;
|
||||
|
||||
public class TranslatedMenu extends JMenu {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public TranslatedMenu(String name) {
|
||||
super(LangUtil.translate(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public JMenuItem add(Action action) {
|
||||
String name = (String) action.getValue(Action.NAME);
|
||||
if (name != null)
|
||||
action.putValue(Action.NAME, LangUtil.translate(name));
|
||||
return super.add(action);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
*
|
||||
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
*
|
||||
* This file is part of DIYLC.
|
||||
*
|
||||
* DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License as published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* DIYLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with DIYLC. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.diylc.swing.gui;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import org.diylc.lang.LangUtil;
|
||||
|
||||
public class TranslatedPopupMenu extends JPopupMenu {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public JMenuItem add(Action action) {
|
||||
String name = (String) action.getValue(Action.NAME);
|
||||
if (name != null)
|
||||
action.putValue(Action.NAME, LangUtil.translate(name));
|
||||
return super.add(action);
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,6 @@ import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.IConfigListener;
|
||||
import org.diylc.appframework.miscutils.IConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.Utils;
|
||||
@@ -67,6 +66,8 @@ import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.images.IconLoader;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.TranslatedMenu;
|
||||
import org.diylc.swing.gui.TranslatedPopupMenu;
|
||||
import org.diylc.swing.plugins.edit.ComponentTransferable;
|
||||
import org.diylc.swing.plugins.file.ProjectDrawingProvider;
|
||||
import org.diylc.swingframework.ruler.IRulerListener;
|
||||
@@ -452,7 +453,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
||||
|
||||
public JPopupMenu getPopupMenu() {
|
||||
if (popupMenu == null) {
|
||||
popupMenu = new JPopupMenu();
|
||||
popupMenu = new TranslatedPopupMenu();
|
||||
popupMenu.add(getSelectionMenu());
|
||||
popupMenu.addSeparator();
|
||||
popupMenu.add(getCutAction());
|
||||
@@ -480,7 +481,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
||||
|
||||
public JMenu getSelectionMenu() {
|
||||
if (selectionMenu == null) {
|
||||
selectionMenu = new JMenu("Select");
|
||||
selectionMenu = new TranslatedMenu("Select");
|
||||
selectionMenu.setIcon(IconLoader.ElementsSelection.getIcon());
|
||||
}
|
||||
return selectionMenu;
|
||||
@@ -488,7 +489,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
||||
|
||||
public JMenu getExpandMenu() {
|
||||
if (expandMenu == null) {
|
||||
expandMenu = new JMenu("Expand Selection");
|
||||
expandMenu = new TranslatedMenu("Expand Selection");
|
||||
expandMenu.setIcon(IconLoader.BranchAdd.getIcon());
|
||||
expandMenu.add(getExpandSelectionAllAction());
|
||||
expandMenu.add(getExpandSelectionImmediateAction());
|
||||
@@ -499,7 +500,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
||||
|
||||
public JMenu getLockMenu() {
|
||||
if (lockMenu == null) {
|
||||
lockMenu = new JMenu("Lock");
|
||||
lockMenu = new TranslatedMenu("Lock");
|
||||
lockMenu.setIcon(IconLoader.Lock.getIcon());
|
||||
}
|
||||
return lockMenu;
|
||||
@@ -507,7 +508,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
||||
|
||||
public JMenu getUnlockMenu() {
|
||||
if (unlockMenu == null) {
|
||||
unlockMenu = new JMenu("Unlock");
|
||||
unlockMenu = new TranslatedMenu("Unlock");
|
||||
unlockMenu.setIcon(IconLoader.Unlock.getIcon());
|
||||
}
|
||||
return unlockMenu;
|
||||
@@ -515,7 +516,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
||||
|
||||
public JMenu getTransformMenu() {
|
||||
if (transformMenu == null) {
|
||||
transformMenu = new JMenu("Transform Selection");
|
||||
transformMenu = new TranslatedMenu("Transform Selection");
|
||||
transformMenu.setIcon(IconLoader.MagicWand.getIcon());
|
||||
transformMenu.add(getRotateClockwiseAction());
|
||||
transformMenu.add(getRotateCounterclockwiseAction());
|
||||
@@ -536,7 +537,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
||||
|
||||
public JMenu getApplyTemplateMenu() {
|
||||
if (applyTemplateMenu == null) {
|
||||
applyTemplateMenu = new JMenu("Apply Variant");
|
||||
applyTemplateMenu = new TranslatedMenu("Apply Variant");
|
||||
applyTemplateMenu.setIcon(IconLoader.BriefcaseInto.getIcon());
|
||||
}
|
||||
return applyTemplateMenu;
|
||||
|
||||
Reference in New Issue
Block a user