SAP SMP 3.0 国际化 i18n

以SMP SDK Kapsel API中的Logon模块为例,这个模块缺省只有英文English语言包。

在执行

cordova -d platform add android
cordova -d plugin add C:\SAP\MobileSDK3\KapselSDK\plugins\logon

命令之后,项目中多了两个语言资源文件:

plugins\com.sap.mp.cordova.plugins.logon\www\common\assets\i18n\i18n.properties

platforms\android\assets\www\smp\logon\i18n\i18n.properties


偷懒起见,我直接复制i18n.propertie并修改文件名为i18n_zh.properties

platforms\android\assets\www\smp\logon\i18n\i18n_zh.properties


修改i18n_zh.properties,比如

FLD_USER_LABEL=用户名

注意保持文件为UTF-8编码。


在eclipse Android开发环境中直接重新运行这个项目应用即可,注意Android模拟器的语言也要设置为zh_CN。

-------------------------------------------------------------------------------------

在logon模块的i18n.js 代码片段中


        jQuery.sap.require("jquery.sap.resources");
        var locale = sap.ui.getCore().getConfiguration().getLanguage();
        var i18n = jQuery.sap.resources({'url' : "../i18n/i18n.properties", 'locale': locale});


        getLocalizedString = function(key){
            return i18n.getText(key);
        }

调用了 jQuery.sap.resources 方法

这个方法是SAP UI5中的API

-------------------------------------------------------------------------------------

参考:

使用 jQuery.i18n.properties 实现 Web 前端的国际化
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值