Browse Source

Merge pull request #337 in DESIGN/design from ~RICHIE/design:release/10.0 to release/10.0

* commit '97d8a2f8690e65b98b3cf7e3dc2c147c71fb6527':
  CORE-116 国际化拆分设计器、服务器和web
research/10.0
ju 6 years ago
parent
commit
8f2190e687
  1. 10
      designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java
  2. 31
      designer-base/src/main/java/com/fr/design/i18n/Toolkit.java
  3. 13
      designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java
  4. 14
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java
  5. 19
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

10
designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java

@ -122,12 +122,14 @@ public class LocalePane extends BasicPane {
private void initPredefinedProperties() { private void initPredefinedProperties() {
Map<Locale, String> supportLocaleMap = InterProviderFactory.getProvider().getSupportLocaleMap(); Map<Locale, String> supportLocaleMap = InterProviderFactory.getProvider().getSupportLocaleMap();
Map<String, String> map; // richie:暂时去掉设计器中国际化键值对的显示
Map<String, String> map = new HashMap<>();
List<String> sortKeys = new ArrayList<String>(); List<String> sortKeys = new ArrayList<String>();
map = InterProviderFactory.getProvider().getLocalBundle(Locale.SIMPLIFIED_CHINESE).getMap(); //map = InterProviderFactory.getProvider().getLocalBundle(Locale.SIMPLIFIED_CHINESE).getMap();
sortKeys.addAll(map.keySet()); sortKeys.addAll(map.keySet());
Collections.sort(sortKeys); Collections.sort(sortKeys);

31
designer-base/src/main/java/com/fr/design/i18n/Toolkit.java

@ -1,48 +1,57 @@
package com.fr.design.i18n; package com.fr.design.i18n;
import com.fr.general.GeneralContext;
import com.fr.general.log.MessageFormatter; import com.fr.general.log.MessageFormatter;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.locale.LocaleManager;
import com.fr.locale.impl.FineLocaleManager;
/** /**
* 设计器国际化类后面会不再依赖InterProviderFactory * 设计器国际化类后面会不再依赖InterProviderFactory
*/ */
public class Toolkit { public class Toolkit {
private static LocaleManager localeManager = FineLocaleManager.create();
static {
addResource("com/fr/design/i18n/main");
}
public static void addResource(String path) {
localeManager.addResource(path);
}
/** /**
* 设计器国际化方法 * 设计器国际化方法
*
* @param key 国际化键 * @param key 国际化键
* @return 国际化值 * @return 国际化值
*/ */
public static String i18nText(String key) { public static String i18nText(String key) {
return InterProviderFactory.getProvider().getLocText(key); return localeManager.getLocalBundle(GeneralContext.getLocale()).getText(localeManager, key);
} }
/** /**
* 带格式化内容的国际化方法 * 带格式化内容的国际化方法
* Toolkit.i18nText("Fine-Design_xxx", 1, 2)假设Fine-Design_xxx的中文值为我来计算{}+{}输出结果为我来计算1+2 * Toolkit.i18nText("Fine-Design_xxx", 1, 2)假设Fine-Design_xxx的中文值为我来计算{}+{}输出结果为我来计算1+2
* @param key 格式化文本 *
* @param key 格式化文本
* @param args 格式化参数 * @param args 格式化参数
* @return 国际化值 * @return 国际化值
*/ */
public static String i18nText(String key, Object... args) { public static String i18nText(String key, Object... args) {
String format = InterProviderFactory.getProvider().getLocText(key); String format = InterProviderFactory.getProvider().getLocText(key);
MessageFormatter.FormattingTuple tuple = MessageFormatter.arrayFormat(format, args); MessageFormatter.FormattingTuple tuple = MessageFormatter.arrayFormat(format, args);
return tuple.getMessage(); return localeManager.getLocalBundle(GeneralContext.getLocale()).getText(localeManager, tuple.getMessage());
} }
/** /**
* 太鸡儿多了改不完先加上慢慢改 * 太鸡儿多了改不完先加上慢慢改
*
* @deprecated * @deprecated
*/ */
public static String i18nTextArray(String[] keys) { public static String i18nTextArray(String[] keys) {
return InterProviderFactory.getProvider().getLocText(keys); return InterProviderFactory.getProvider().getLocText(keys);
} }
/**
* 太鸡儿多了改不完先加上慢慢改
* @deprecated
*/
public static String i18nTextArray(String[] keys, String[] delimiter) {
return InterProviderFactory.getProvider().getLocText(keys, delimiter);
}
} }

13
designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java

@ -11,7 +11,11 @@ import com.fr.design.module.ChartHyperlinkGroup;
import com.fr.design.module.ChartPreStyleAction; import com.fr.design.module.ChartPreStyleAction;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.form.ui.ChartEditor; import com.fr.form.ui.ChartEditor;
import com.fr.locale.InterMutableKey;
import com.fr.locale.LocaleMarker;
import com.fr.locale.LocaleScope;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.module.extension.Prepare;
import com.fr.plugin.chart.vanchart.imgevent.design.DesignImageEvent; import com.fr.plugin.chart.vanchart.imgevent.design.DesignImageEvent;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
@ -21,7 +25,7 @@ import com.fr.van.chart.map.server.ChartMapEditorAction;
/** /**
* Created by juhaoyu on 2018/6/27. * Created by juhaoyu on 2018/6/27.
*/ */
public class ChartDesignerActivator extends Activator { public class ChartDesignerActivator extends Activator implements Prepare {
@Override @Override
public void start() { public void start() {
@ -49,7 +53,12 @@ public class ChartDesignerActivator extends Activator {
DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance());
DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper());
} }
@Override
public void prepare() {
addMutable(InterMutableKey.Path, LocaleMarker.create("com/fr/design/i18n/chart", LocaleScope.DESIGN));
}
@Override @Override
public void stop() { public void stop() {

14
designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java

@ -11,29 +11,29 @@ import java.util.List;
* Created by juhaoyu on 2018/6/27. * Created by juhaoyu on 2018/6/27.
*/ */
public class DesignerAppActivator extends Activator implements Prepare { public class DesignerAppActivator extends Activator implements Prepare {
@Override @Override
public void start() { public void start() {
List<App> appList = rightCollectMutable(App.KEY); List<App> appList = rightCollectMutable(App.KEY);
for (App app : appList) { for (App app : appList) {
DesignerFrame.registApp(app); DesignerFrame.registApp(app);
} }
} }
@Override @Override
public void stop() { public void stop() {
List<App> appList = rightCollectMutable(App.KEY); List<App> appList = rightCollectMutable(App.KEY);
for (App app : appList) { for (App app : appList) {
DesignerFrame.removeApp(app); DesignerFrame.removeApp(app);
} }
} }
@Override @Override
public void prepare() { public void prepare() {
addMutable(App.KEY, new CptApp(), new FormApp(), new XlsApp(), new XlsxApp()); addMutable(App.KEY, new CptApp(), new FormApp(), new XlsApp(), new XlsxApp());
} }
} }

19
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -27,6 +27,7 @@ import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.hyperlink.ReportletHyperlinkPane; import com.fr.design.hyperlink.ReportletHyperlinkPane;
import com.fr.design.hyperlink.WebHyperlinkPane; import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.javascript.EmailPane; import com.fr.design.javascript.EmailPane;
import com.fr.design.javascript.JavaScriptImplPane; import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane; import com.fr.design.javascript.ParameterJavaScriptPane;
@ -58,7 +59,6 @@ import com.fr.design.parameter.WorkBookParameterReader;
import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane;
import com.fr.form.stable.ElementCaseThumbnailProcessor; import com.fr.form.stable.ElementCaseThumbnailProcessor;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ModuleContext; import com.fr.general.ModuleContext;
import com.fr.general.xml.GeneralXMLTools; import com.fr.general.xml.GeneralXMLTools;
import com.fr.js.EmailJavaScript; import com.fr.js.EmailJavaScript;
@ -67,10 +67,11 @@ import com.fr.js.ParameterJavaScript;
import com.fr.js.ReportletHyperlink; import com.fr.js.ReportletHyperlink;
import com.fr.js.WebHyperlink; import com.fr.js.WebHyperlink;
import com.fr.locale.InterMutableKey; import com.fr.locale.InterMutableKey;
import com.fr.locale.LocaleMarker;
import com.fr.locale.LocaleScope;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.log.LogHandler; import com.fr.log.LogHandler;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.module.extension.Prepare;
import com.fr.quickeditor.cellquick.CellBiasTextPainterEditor; import com.fr.quickeditor.cellquick.CellBiasTextPainterEditor;
import com.fr.quickeditor.cellquick.CellDSColumnEditor; import com.fr.quickeditor.cellquick.CellDSColumnEditor;
import com.fr.quickeditor.cellquick.CellFormulaQuickEditor; import com.fr.quickeditor.cellquick.CellFormulaQuickEditor;
@ -114,12 +115,18 @@ import static com.fr.stable.module.Module.ENGINE_MODULE;
* 触发原来的DesignerModule的启动 * 触发原来的DesignerModule的启动
* 之后慢慢将DesignerModule拆成Activator * 之后慢慢将DesignerModule拆成Activator
*/ */
public class DesignerActivator extends Activator implements Prepare { public class DesignerActivator extends Activator {
private LogHandler<DesignerLogAppender> logHandler = null; private LogHandler<DesignerLogAppender> logHandler = null;
@Override @Override
public void start() { public void start() {
List<LocaleMarker> markers = rightCollectMutable(InterMutableKey.Path);
for (LocaleMarker marker : markers) {
if (marker.match(LocaleScope.DESIGN)) {
Toolkit.addResource(marker.getPath());
}
}
designerModuleStart(); designerModuleStart();
preLoadPane(); preLoadPane();
loadLogAppender(); loadLogAppender();
@ -403,10 +410,4 @@ public class DesignerActivator extends Activator implements Prepare {
unloadLogAppender(); unloadLogAppender();
DesignerSocketIO.close(); DesignerSocketIO.close();
} }
@Override
public void prepare() {
addMutable(InterMutableKey.Path, "com/fr/design/i18n/main", "com/fr/design/i18n/chart");
}
} }
Loading…
Cancel
Save