From e340cfa40abe825e62ba833c9a70957ed917675b Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 16 Aug 2018 16:36:50 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-10025=2010.0=20&=205.0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=BE=9D=E6=8D=AE=E5=9B=BD=E9=99=85=E5=8C=96=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=9B=BD=E9=99=85=E5=8C=96=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/file/PreferencePane.java | 4 +++- .../shortcutfactory/AbstractShortCutFactory.java | 11 +++++------ .../shortcutfactory/OldShortCutFactory.java | 4 ++-- .../main/java/com/fr/design/widget/EventCreator.java | 11 ++++++----- .../designer/properties/EventPropertyTable.java | 5 ++++- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index bb4fe00aec..aec3f42f3e 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -24,6 +24,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; +import com.fr.general.Inter; import com.fr.general.log.Log4jConfig; import com.fr.locale.InterProviderFactory; import com.fr.third.apache.log4j.Level; @@ -394,7 +395,8 @@ public class PreferencePane extends BasicPane { int i = 0; for (Map.Entry entry : map.entrySet()) { keys[i] = entry.getKey(); - values[i] = com.fr.design.i18n.Toolkit.i18nText(entry.getValue()); + // 想要读取到,必需在这里 使用 Inter 才行。 + values[i] = Inter.getLocText(entry.getValue()); i++; } UIDictionaryComboBox languageComboBox = new UIDictionaryComboBox<>(keys, values); diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/AbstractShortCutFactory.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/AbstractShortCutFactory.java index ff1c34fd67..8d837fcc09 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/AbstractShortCutFactory.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/AbstractShortCutFactory.java @@ -6,7 +6,6 @@ import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.ShortCutListenerProvider; import com.fr.design.menu.ShortCut; -import com.fr.general.Inter; import java.awt.event.ActionEvent; @@ -98,7 +97,7 @@ public abstract class AbstractShortCutFactory { */ private class RemoveItemAction extends UpdateAction { RemoveItemAction() { - this.setName(Inter.getLocText("FR-Action_Remove")); + this.setName(com.fr.design.i18n.Toolkit.i18nText(("Fine-Design_Basic_Action_Remove"))); this.setMnemonic('R'); this.setSmallIcon(BaseUtils .readIcon("/com/fr/base/images/cell/control/remove.png")); @@ -115,7 +114,7 @@ public abstract class AbstractShortCutFactory { */ private class CopyItemAction extends UpdateAction { CopyItemAction() { - this.setName(Inter.getLocText("FR-Action_Copy")); + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Copy")); this.setMnemonic('C'); this.setSmallIcon(BaseUtils .readIcon("/com/fr/design/images/m_edit/copy.png")); @@ -132,7 +131,7 @@ public abstract class AbstractShortCutFactory { */ private class MoveUpItemAction extends UpdateAction { MoveUpItemAction() { - this.setName(Inter.getLocText("Utils-Move_Up")); + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Up")); this.setMnemonic('U'); this.setSmallIcon(BaseUtils .readIcon("/com/fr/design/images/control/up.png")); @@ -149,7 +148,7 @@ public abstract class AbstractShortCutFactory { */ private class MoveDownItemAction extends UpdateAction { MoveDownItemAction() { - this.setName(Inter.getLocText("Utils-Move_Down")); + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Down")); this.setMnemonic('D'); this.setSmallIcon(BaseUtils .readIcon("/com/fr/design/images/control/down.png")); @@ -165,7 +164,7 @@ public abstract class AbstractShortCutFactory { private boolean isAtoZ = false; SortItemAction() { - this.setName(Inter.getLocText("FR-Action_Sort")); + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Sort")); this.setMnemonic('S'); this.setSmallIcon(BaseUtils .readIcon("/com/fr/design/images/control/sortAsc.png")); diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java index a608ebb3e3..a7608e2bdf 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java @@ -59,7 +59,7 @@ public class OldShortCutFactory extends AbstractShortCutFactory { public AddItemUpdateAction(NameableCreator[] creators) { this.creator = creators[0]; - this.setName(Inter.getLocText("FR-Action_Add")); + this.setName(com.fr.design.i18n.Toolkit.i18nText(("Fine-Design_Basic_Action_Add"))); this.setMnemonic('A'); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); } @@ -75,7 +75,7 @@ public class OldShortCutFactory extends AbstractShortCutFactory { */ private class AddItemMenuDef extends MenuDef { AddItemMenuDef(NameableCreator[] creators) { - this.setName(Inter.getLocText("FR-Action_Add")); + this.setName(com.fr.design.i18n.Toolkit.i18nText(("Fine-Design_Basic_Action_Add"))); this.setMnemonic('A'); this.setIconPath("/com/fr/design/images/control/addPopup.png"); wrapActionListener(creators); diff --git a/designer-base/src/main/java/com/fr/design/widget/EventCreator.java b/designer-base/src/main/java/com/fr/design/widget/EventCreator.java index 0ca2ed0b57..38a55865ad 100644 --- a/designer-base/src/main/java/com/fr/design/widget/EventCreator.java +++ b/designer-base/src/main/java/com/fr/design/widget/EventCreator.java @@ -6,10 +6,8 @@ import com.fr.design.gui.controlpane.NameableSelfCreator; import com.fr.design.gui.controlpane.UnrepeatedNameHelper; import com.fr.design.gui.ilist.ListModelElement; import com.fr.form.event.Listener; -import com.fr.form.ui.FileEditor; -import com.fr.form.ui.Widget; - import com.fr.general.NameObject; +import com.fr.report.web.util.ReportEngineEventMapping; import com.fr.stable.Nameable; public class EventCreator extends NameableSelfCreator { @@ -36,11 +34,14 @@ public class EventCreator extends NameableSelfCreator { } /* - * richer:国际化事件名称,所有需要国际化的事件都应按格式FR-Engine_Event_eventName来进行国际化 + * richer:国际化事件名称,所有需要国际化的事件都应根据使用的位置 + * 按格式 Fine-模块_xx 来进行国际化 */ public static final String switchLang(String eventName) { try { - return com.fr.design.i18n.Toolkit.i18nText("FR-Engine_Event_" + eventName); + // 通过映射 , 找到相对应的 properties 文件中的 key 值 + String localeKey = ReportEngineEventMapping.getLocaleName(eventName); + return com.fr.design.i18n.Toolkit.i18nText(localeKey); } catch (Exception e) { FRContext.getLogger().error(e.getMessage(), e); return eventName; diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java b/designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java index 46b802fe12..77cb10734b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java +++ b/designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java @@ -15,6 +15,7 @@ import com.fr.design.form.javascript.FormEmailPane; import com.fr.form.ui.Widget; import com.fr.general.NameObject; +import com.fr.report.web.util.ReportEngineEventMapping; import com.fr.stable.Nameable; import javax.swing.*; @@ -72,7 +73,9 @@ public class EventPropertyTable extends UIListControlPane { } private String switchLang(String eventName) { - return com.fr.design.i18n.Toolkit.i18nText("FR-Engine_Event_" + eventName); + // 在 properties 文件中找到相应的 key 值 + String localeKey = ReportEngineEventMapping.getLocaleName(eventName); + return com.fr.design.i18n.Toolkit.i18nText(localeKey); } /**