refactor(@embark/i18n): introduce embark-i18n package

This commit is contained in:
Pascal Precht 2019-05-06 13:09:23 +02:00
parent 9acf256dc7
commit 8255ddb80d
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
17 changed files with 89 additions and 5 deletions

View File

@ -0,0 +1,4 @@
engine-strict = true
package-lock = false
save-exact = true
scripts-prepend-node-path = true

View File

@ -0,0 +1,6 @@
# `embark-i18n`
i18n support for Embark
Visit [embark.status.im](https://embark.status.im/) to get started with
[Embark](https://github.com/embark-framework/embark).

View File

@ -0,0 +1,65 @@
{
"name": "embark-i18n",
"version": "4.1.0-beta.0",
"author": "Iuri Matias <iuri.matias@gmail.com>",
"contributors": [],
"description": "i18n Support for Embark",
"homepage": "https://github.com/embark-framework/embark/tree/master/packages/embark-i18n#readme",
"bugs": "https://github.com/embark-framework/embark/issues",
"keywords": [
"blockchain",
"dapps",
"ethereum",
"ipfs",
"serverless",
"solc",
"solidity"
],
"files": [
"dist"
],
"license": "MIT",
"repository": {
"directory": "packages/embark-i18n",
"type": "git",
"url": "https://github.com/embark-framework/embark.git"
},
"main": "./dist/index.js",
"scripts": {
"build": "cross-env BABEL_ENV=node babel src --extensions \".js,.ts\" --out-dir dist --root-mode upward --source-maps",
"ci": "npm run qa",
"clean": "npm run reset",
"lint": "npm-run-all lint:*",
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
"package": "npm pack",
"// qa": "npm-run-all lint typecheck build package",
"qa": "npm-run-all lint build package",
"reset": "npx rimraf dist embark-*.tgz package",
"start": "npm run watch",
"typecheck": "tsc",
"watch": "run-p watch:*",
"watch:build": "npm run build -- --verbose --watch",
"watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch"
},
"dependencies": {
"@babel/runtime-corejs2": "7.3.1",
"colors": "1.3.2",
"i18n": "0.8.3",
"os-locale": "2.1.0"
},
"devDependencies": {
"@babel/cli": "7.2.3",
"@babel/core": "7.2.2",
"cross-env": "5.2.0",
"eslint": "5.7.0",
"npm-run-all": "4.1.5",
"rimraf": "2.6.3",
"tslint": "5.16.0",
"typescript": "3.4.5"
},
"engines": {
"node": ">=8.12.0",
"npm": ">=6.4.1",
"yarn": ">=1.12.3"
}
}

View File

@ -20,7 +20,7 @@ enum SupportedLanguage {
const DEFAULT_LANGUAGE = SupportedLanguage.En;
i18n.configure({
directory: path.join(__dirname, "../../../../", "locales"),
directory: path.join(__dirname, "../", "locales"),
locales: Object.values(SupportedLanguage),
register: global,
syncFiles: false,

View File

@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["src/**/*"]
}

View File

@ -0,0 +1,3 @@
{
"extends": "../../tslint.json"
}

View File

@ -1,3 +1,4 @@
import { __ } from 'i18n';
const bip39 = require("bip39");
const hdkey = require('ethereumjs-wallet/hdkey');
const ethereumjsWallet = require('ethereumjs-wallet');

View File

@ -101,6 +101,7 @@
"embark-core": "^4.1.0-beta.0",
"embark-deployment": "^4.1.0-beta.0",
"embark-ens": "^4.1.0-beta.0",
"embark-i18n": "^4.1.0-beta.0",
"embark-library-manager": "^4.1.0-beta.0",
"embark-logger": "^4.1.0-beta.0",
"embark-plugin-cmd": "^4.1.0-beta.0",

View File

@ -1,6 +1,6 @@
import * as i18n from 'embark-i18n';
const program = require('commander');
const EmbarkController = require('./cmd_controller.js');
const i18n = require('../lib/core/i18n/i18n.js');
const fs = require('../lib/core/fs.js');
let embark = new EmbarkController();

View File

@ -1,6 +1,6 @@
import * as i18n from 'embark-i18n';
import { ProcessWrapper } from 'embark-core';
const BlockchainClient = require('./blockchain');
const i18n = require('../../core/i18n/i18n.js');
const constants = require('embark-core/constants');
let blockchainProcess;

View File

@ -1,9 +1,9 @@
/*global __dirname, describe, it, before, after, require*/
import * as i18n from 'embark-i18n';
const assert = require('assert');
const sinon = require('sinon');
let TestLogger = require('../lib/utils/test_logger');
const Web3 = require('web3');
const i18n = require('../lib/core/i18n/i18n');
const fs = require('../lib/core/fs');
import { getWeiBalanceFromString, getHexBalanceFromString, AccountParser } from 'embark-utils';
i18n.setOrDetectLocale('en');

View File

@ -4,7 +4,7 @@ import { File, Types } from "../../../lib/core/file";
const assert = require('assert');
// TODO: need to rethink i18n and how that is required in each module
require('../../../lib/core/i18n/i18n');
require('embark-i18n');
const Compiler = require('embark-compiler');
const Plugins = require('../../../lib/core/plugins.js');