i18nc-core

11.2.4 • Public • Published

I18NC-CORE

NPM Version NPM Downloads NPM License License Status

Install

npm install i18nc-core --save

Usage

var i18nc = require('i18nc-core');
// options: https://bacra.github.io/i18nc-core/?p=options
var ret = i18nc(code, options);
 
ret.code    // output code
ret.dirtyWords
ret.codeTranslateWords
ret.funcTranslateWords
ret.usedTranslateWords
ret.I18NArgsTranslateWords
ret.subScopeDatas

Example

Input Code

var word = "中文1";
define(function()
{
  var word = "中文2";
  var word = I18N('中文', 'sub type');
});
 
var word = '简体';
var word = I18N('%s中文%s课堂', ['<span>', '</span>']);
function I18N(){}

Output Code

var word = I18N('中文1');
define(function()
{
  var word = I18N('中文2');
  var word = I18N('中文', 'sub type');
});
 
var word = I18N('简体');
var word = I18N('%s中文%s课堂', ['<span>', '</span>']);
function I18N(h,f,i){
  var a=I18N;
  ...
  // a.__FILE_KEY__='*';a.__FUNCTION_VERSION__='5';a.__TRANSLATE_JSON__={};
  a.K='*';a.V='5';a.D={};
  ...
  var q=l||k||h;var p=0;
  return(''+q).replace(/%s|%\{.+?\}/g,function(){var a=f[p++];return a===undefined||a===null?'':a;});
}

Upgrade

Wiki

Dependencies (11)

Dev Dependencies (10)

Package Sidebar

Install

npm i i18nc-core

Weekly Downloads

28

Version

11.2.4

License

MIT

Unpacked Size

1.57 MB

Total Files

27

Last publish

Collaborators

  • bacra