Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
themeEclipse
firstline1
titleLocaleFinder.java
linenumberstrue
package com.fr.stable.fun;

/**
 * @author richie
 * @date 2015-07-09
 * @since 8.0
 * 插件中的国际化文件寻找接口
 */
public interface LocaleFinder extends Level {
    
    String MARK_STRING = "LocaleFinder";

    int CURRENT_LEVEL = 1;

    /**
     * 查找国际化文件的路径
     *
     * @return 国际化文件的路径
     */
    String find();
}


四、支持版本

产品线

版本

支持情况

备注

FR8.0支持
FR9.0支持
FR10.0支持
BI3.6支持
BI4.0支持
BI5.1支持
BI5.1.2支持
BI5.1.3支持

五、插件注册

Code Block
languagexml
themeEclipse
firstline1
titleplugin.xml
linenumberstrue
<extra-core>
        <LocaleFinder class="your class name"/>
</extra-core>

...

Code Block
languagejs
themeEclipse
titledemo_en_US.properties
linenumberstrue
Plugin-Demo_Hello_World=Hello World
Plugin-Demo_Number=number:{}

上面这组国际化定义,我们一共声明了对简中和英文环境的支持上面这组国际化定义,声明了对简中和英文环境的支持

实际调用时:有以下几种调用方式

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
//设计器调用
InterProviderFactory.getDesignI18nProvider().getLocText("Plugin-Demo_Hello_World");
InterProviderFactory.getDesignI18nProvider().getLocText("Plugin-Demo_Number","100");
//或者
Toolkit.getLocText("Plugin-Demo_Hello_World");
Toolkit.getLocText("Plugin-Demo_Number","100");

//服务端调用
InterProviderFactory.getProvider().getLocText("Plugin-Demo_Hello_World");
InterProviderFactory.getProvider().getLocText("Plugin-Demo_Number","100");

//前端报表预览调用
FR.i18nText("Plugin-Demo_Hello_World");
FR.i18nText("Plugin-Demo_Number","100");

//前端决策平台或仪表板调用
BI.i18nText("Plugin-Demo_Hello_World");
BI.i18nText("Plugin-Demo_Number","100");

注:国际化定义中,可以通过 {} 进行动态拼接

常用的国际化列表为 

语言国际化key
简中zh 或 zh_CN
繁中zh_TW
英文en 或 en_US
日文ja_JP
韩文ko_KR


八、常用链接

demo地址:demo-locale-finder

九、开源案例

...

免责声明:所有文档中的开源示例,均为开发者自行开发并提供。仅用于参考和学习使用,开发者和官方均无义务对开源案例所涉及的所有成果进行教学和指导。禁止用于任何商业用途,若作为商用一切后果责任由使用者自行承担。

open-JSD-7944

open-JSD-7814

open-JSD-7803

open-JSD-7706

open-JSD-6952

open-JSD-6890