NativeLang NativeScript 国际化插件

我要开发同款
匿名用户2015年08月03日
50阅读
开发技术JavaScript
所属分类NativeScript插件、手机/移动开发、NativeScript 插件
授权协议MIT

作品详情

NativeLang是NativeScript的国际化插件。

创建文件:

├── app <----------------- run npm install from here│   ├── App_Resources│   │   └── ...│   ├── tns_modules│   │   └── ...│   ├── app.css│   ├── app.js│   ├── main-page.js│   ├── main-page.xml│   ├── main-view-model.js│   ├── node_modules│   │   └── nativelang <-- The install will place the module's code here│   │       └── ...│   └── package.json <---- The install will register “nativelang" as a dependency here└── platforms    ├── android    │   └── res    │       ├── values <---------- English    │       |   └── strings.xml    │       ├── values-es <------- Spanish    │       |   └── strings.xml    │       └── values-fr <------- Fransih    │           └── strings.xml    └── ios

文件:

<!-- platforms/android/res/values/strings.xml --><?xml version="1.0" encoding="UTF-8"?><resources>    <string name="app_name" formatted="false">Example 1</string>    <string name="other" formatted="false">Other</string>    ... More strings</resources><!-- platforms/android/res/values-es/strings.xml --><?xml version="1.0" encoding="UTF-8"?><resources>    <string name="app_name" formatted="false">Ejemplo 1</string>    <string name="other" formatted="false">Otro</string>    ... Y mas cadenas</resources>

使用:

app/app.js

GLOBAL.L = require( "./node_modules/nativelang/lib" )();

xml

<Label  text={{ L('other')}} />
查看全文
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论