Browse Source

REPORT-60661 国际化url适配

zheng-1641779399395
Henry.Wang 3 years ago
parent
commit
689adf8a38
  1. 3
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  2. 3
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  3. 4
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  4. 97
      designer-base/src/main/java/com/fr/design/i18n/UrlI18nManager.java
  5. 4
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java
  6. 4
      designer-base/src/main/java/com/fr/env/HelpLink.java
  7. 7
      designer-base/src/main/resources/com/fr/design/i18n/url_en.properties
  8. 7
      designer-base/src/main/resources/com/fr/design/i18n/url_ja_JP.properties
  9. 1
      designer-base/src/main/resources/com/fr/design/i18n/url_ko_KR.properties
  10. 7
      designer-base/src/main/resources/com/fr/design/i18n/url_zh.properties
  11. 7
      designer-base/src/main/resources/com/fr/design/i18n/url_zh_TW.properties
  12. 3
      designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java
  13. 3
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java

3
designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java

@ -9,6 +9,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.UrlI18nManager;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
@ -82,7 +83,7 @@ public class AboutPane extends JPanel {
addPhoneAndQQPane(contentPane);
// 官网
JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireConf("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL));
JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), UrlI18nManager.getInstance().getI18nUrl("website"));
// 支持邮箱
String defaultEmail = CloudCenter.getInstance().acquireConf("support.email", ProductConstants.SUPPORT_EMAIL);

3
designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java

@ -1,6 +1,7 @@
package com.fr.design.actions.help;
import com.fr.design.i18n.Toolkit;
import com.fr.design.i18n.UrlI18nManager;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
@ -28,7 +29,7 @@ public class TutorialAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind(createDocKey(), "http://help.finereport.com");
return UrlI18nManager.getInstance().getI18nUrl("help");
}
public String getOffLineWarnMessage() {

4
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -10,6 +10,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.i18n.UrlI18nManager;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -159,7 +160,8 @@ public class JDBCDefPane extends JPanel {
odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height));
odbcTipsLink.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help");
//String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help");
String url = UrlI18nManager.getInstance().getI18nUrl("odbc.help");
BrowseUtils.browser(url);
}
});

97
designer-base/src/main/java/com/fr/design/i18n/UrlI18nManager.java

@ -0,0 +1,97 @@
package com.fr.design.i18n;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.locale.LocaleBundle;
import com.fr.locale.LocaleFiles;
import com.fr.locale.LocaleManager;
import com.fr.locale.impl.FineLocaleManager;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class UrlI18nManager {
private static final String I18N_URL_PATH = "com/fr/design/i18n/url";
private static UrlI18nManager instance = new UrlI18nManager();
public static UrlI18nManager getInstance() {
return instance;
}
private LocaleManager localeManager = FineLocaleManager.create();
private UrlI18nManager() {
localeManager.addResource(I18N_URL_PATH);
}
public String getI18nUrl(String key) {
String i18NUrl = getI18nUrlFromCloudCenter(key);
if (StringUtils.isBlank(i18NUrl)) {
i18NUrl = getI18nUrlFromLocal(key);
}
return i18NUrl;
}
private String getI18nUrlFromCloudCenter(String key) {
List<String> availableKeys = getCloudCenterAvailableKeys(key);
for (String availableKey : availableKeys) {
String i18NUrl = CloudCenter.getInstance().acquireConf(availableKey);
if (!StringUtils.isBlank(i18NUrl)) {
return i18NUrl;
}
}
return StringUtils.EMPTY;
}
private List<String> getCloudCenterAvailableKeys(String key) {
List<String> availableKeys = new ArrayList<>();
availableKeys.add(key + "." + GeneralContext.getLocale() + "." + ProductConstants.MAIN_VERSION);
availableKeys.add(key + "." + Locale.ENGLISH + "." + ProductConstants.MAIN_VERSION);
availableKeys.add(key + "." + Locale.CHINA + "." + ProductConstants.MAIN_VERSION);
availableKeys.add(key + "." + GeneralContext.getLocale());
availableKeys.add(key + "." + Locale.ENGLISH);
availableKeys.add(key + "." + Locale.CHINA);
availableKeys.add(key + "." + ProductConstants.MAIN_VERSION);
availableKeys.add(key);
return availableKeys;
}
private String getI18nUrlFromLocal(String key) {
List<Locale> availableLocales = getAvailableLocales();
LocaleBundle localeBundle = null;
for (Locale availableLocale : availableLocales) {
localeBundle = localeManager.getLocalBundle(availableLocale);
if (isExist(localeBundle, localeManager, key)) {
break;
}
}
if (localeBundle != null) {
return localeBundle.getText(localeManager, key);
} else {
return StringUtils.EMPTY;
}
}
private List<Locale> getAvailableLocales() {
List<Locale> availableLocales = new ArrayList<>();
availableLocales.add(GeneralContext.getLocale());
availableLocales.add(Locale.ENGLISH);
availableLocales.add(Locale.CHINA);
return availableLocales;
}
private boolean isExist(LocaleBundle localeBundle, LocaleManager localeManager, String key) {
List<LocaleFiles> filesList = localeManager.getReverseList();
for (LocaleFiles files : filesList) {
if (files.contains(localeBundle.getLocale(), key)) {
return true;
}
}
return false;
}
}

4
designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java

@ -5,6 +5,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.i18n.UrlI18nManager;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
@ -49,7 +50,8 @@ public class CheckFontInfoDialog extends JDialog implements ActionListener {
JPanel messagePanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
MessageWithLink linkMessage = new MessageWithLink(Toolkit.i18nText("Fine_Designer_Check_Font_Message"),
Toolkit.i18nText("Fine_Designer_Check_Font_Install_Font"),
CloudCenter.getInstance().acquireUrlByKind("help.install.font", "https://help.fanruan.com/finereport/doc-view-3999.html"));
UrlI18nManager.getInstance().getI18nUrl("help.install.font")
);
linkMessage.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink"));
messagePanel.add(linkMessage);

4
designer-base/src/main/java/com/fr/env/HelpLink.java vendored

@ -1,5 +1,6 @@
package com.fr.env;
import com.fr.design.i18n.UrlI18nManager;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.locale.InterProviderFactory;
@ -18,8 +19,7 @@ public class HelpLink {
public static String getLink(String solution) {
Map<String, String> map = new HashMap<>();
LocaleMark<String> linkMark = LocaleCenter.getMark(RemoteDesignLocaleMark.class);
String link = linkMark.getValue();
String link = UrlI18nManager.getInstance().getI18nUrl("help.remote.design");
map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Change_PassWord"), StringUtils.EMPTY);
map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Cert_Error_Solution"), link);
map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Connection_Unknown_Error_Solution"), link);

7
designer-base/src/main/resources/com/fr/design/i18n/url_en.properties

@ -0,0 +1,7 @@
help=https://help.fanruan.com/finereport-en/
help.remote.design=https://help.fanruan.com/finereport-en/doc-view-3862.html?source=4
odbc.help=https://help.fanruan.com/finereport-en/doc-view-289.html
plugin.mobile.style=https://help.fanruan.com/finereport-en/doc-view-2656.html
help.install.font=https://help.fanruan.com/finereport-en/doc-view-3875.html
website=https://www.finereport.com/en/
nine.point.help=https://help.fanruan.com/finereport-en/doc-view-3876.html

7
designer-base/src/main/resources/com/fr/design/i18n/url_ja_JP.properties

@ -0,0 +1,7 @@
help=https://help.fanruan.com/finereport-jp/
help.remote.design=https://help.fanruan.com/finereport-jp/doc-view-3891.html
odbc.help=https://help.fanruan.com/finereport-jp/doc-view-289.html
plugin.mobile.style=https://help.fanruan.com/finereport-jp/doc-view-2656.html
help.install.font=https://help.fanruan.com/finereport-jp/doc-view-3892.html
website=https://www.finereport.com/jp/
nine.point.help=https://help.fanruan.com/finereport-jp/doc-view-3896.html

1
designer-base/src/main/resources/com/fr/design/i18n/url_ko_KR.properties

@ -0,0 +1 @@
website=https://www.finereport.com/kr/

7
designer-base/src/main/resources/com/fr/design/i18n/url_zh.properties

@ -0,0 +1,7 @@
help=https://help.fanruan.com/finereport/
help.remote.design=https://help.fanruan.com/finereport/doc-view-3925.html
odbc.help=https://help.fanruan.com/finereport/doc-view-289.html
plugin.mobile.style=https://help.fanruan.com/finereport/doc-view-2656.html
help.install.font=https://help.fanruan.com/finereport/doc-view-3999.html
website=https://www.finereport.com/
nine.point.help=https://help.fanruan.com/finereport/doc-view-4135.html

7
designer-base/src/main/resources/com/fr/design/i18n/url_zh_TW.properties

@ -0,0 +1,7 @@
help=https://help.fanruan.com/finereport-tw/
help.remote.design=https://help.fanruan.com/finereport/doc-view-3925.html
odbc.help=https://help.fanruan.com/finereport/doc-view-289.html
plugin.mobile.style=https://help.fanruan.com/finereport/doc-view-2656.html
help.install.font=https://help.fanruan.com/finereport/doc-view-3999.html
website=https://www.finereport.com/tw/
nine.point.help=https://help.fanruan.com/finereport-tw/doc-view-4519.html

3
designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java

@ -20,6 +20,7 @@ import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.UrlI18nManager;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -121,7 +122,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
public void actionPerformed(ActionEvent e) {
Desktop desktop = Desktop.getDesktop();
try {
desktop.browse(new URI(TWEAK_NINE_POINT_HELP_URL));
desktop.browse(new URI(UrlI18nManager.getInstance().getI18nUrl("nine.point.help")));
} catch (IOException | URISyntaxException ioException) {
ioException.printStackTrace();
}

3
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java

@ -9,6 +9,7 @@ import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.ParameterExpandablePaneUIProvider;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.UrlI18nManager;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -104,7 +105,7 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
@Override
public void mouseClicked(MouseEvent e) {
try {
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("plugin.mobile.style")));
Desktop.getDesktop().browse(new URI(UrlI18nManager.getInstance().getI18nUrl("plugin.mobile.style")));
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
}

Loading…
Cancel
Save