svelte-i18n
Advanced tools
Comparing version 0.0.0 to 0.0.1
126
package.json
{ | ||
"name": "svelte-i18n", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"license": "MIT", | ||
"main": "dist/i18n.js", | ||
"types": "src/index.d.ts", | ||
"description": "", | ||
"author": "Christian Kaisermann <christian@kaisermann.me>", | ||
"repository": "https://github.com/kaisermann", | ||
"keywords": [], | ||
"main": "dist/svelte-i18n.umd.js", | ||
"module": "dist/svelte-i18n.es5.js", | ||
"typings": "dist/types/svelte-i18n.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"author": "Christian Kaisermann <christian@kaisermann.me>", | ||
"repository": { | ||
"type": "git", | ||
"url": "" | ||
}, | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=6.0.0" | ||
}, | ||
"scripts": { | ||
"lint": "tslint -t codeFrame 'src/**/*.ts' 'test/**/*.ts'", | ||
"prebuild": "rimraf dist", | ||
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src", | ||
"start": "rollup -c rollup.config.ts -w", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:prod": "npm run lint && npm run test -- --coverage --no-cache", | ||
"deploy-docs": "ts-node tools/gh-pages-publish", | ||
"report-coverage": "cat ./coverage/lcov.info | coveralls", | ||
"commit": "git-cz", | ||
"semantic-release": "semantic-release", | ||
"semantic-release-prepare": "ts-node tools/semantic-release-prepare", | ||
"precommit": "lint-staged" | ||
"build": "microbundle --name='svelte-i18n'", | ||
"start": "microbundle watch --name='svelte-i18n'", | ||
"test": "jest --no-cache --verbose", | ||
"test:watch": "jest --no-cache --verbose --watchAll", | ||
"lint": "eslint \"src/**/*.js\"", | ||
"format": "prettier --loglevel silent --write \"src/**/*.js\" && eslint --fix \"src/**/*.js\"", | ||
"prepublishOnly": "npm run format && npm run test && npm run build" | ||
}, | ||
"lint-staged": { | ||
"{src,test}/**/*.ts": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "node_modules/cz-conventional-changelog" | ||
}, | ||
"validate-commit-msg": { | ||
"types": "conventional-commit-types", | ||
"helpMessage": "Use \"npm run commit\" instead, we use conventional-changelog format :) (https://github.com/commitizen/cz-cli)" | ||
} | ||
}, | ||
"jest": { | ||
"verbose": true, | ||
"testURL": "http://localhost/", | ||
"transform": { | ||
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js" | ||
"^.+\\.jsx?$": "babel-jest" | ||
}, | ||
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", | ||
"testRegex": "(/test/.*|\\.(test|spec))\\.js$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js" | ||
@@ -63,3 +32,4 @@ ], | ||
"/node_modules/", | ||
"/test/" | ||
"/test/", | ||
"/src/formatter.js" | ||
], | ||
@@ -76,43 +46,27 @@ "coverageThreshold": { | ||
}, | ||
"prettier": { | ||
"semi": false, | ||
"singleQuote": true | ||
}, | ||
"devDependencies": { | ||
"@types/deepmerge": "^2.1.0", | ||
"@types/jest": "^22.0.0", | ||
"@types/node": "^10.0.3", | ||
"colors": "^1.1.2", | ||
"commitizen": "^2.9.6", | ||
"coveralls": "^3.0.0", | ||
"cross-env": "^5.0.1", | ||
"cz-conventional-changelog": "^2.0.0", | ||
"husky": "^0.14.0", | ||
"jest": "^22.0.2", | ||
"lint-staged": "^7.1.3", | ||
"lodash.camelcase": "^4.3.0", | ||
"prettier": "^1.13.4", | ||
"prompt": "^1.0.0", | ||
"replace-in-file": "^3.0.0-beta.2", | ||
"rimraf": "^2.6.1", | ||
"rollup": "^0.59.2", | ||
"rollup-plugin-commonjs": "^9.0.0", | ||
"rollup-plugin-json": "^3.0.0", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"rollup-plugin-sourcemaps": "^0.4.2", | ||
"rollup-plugin-typescript2": "^0.11.1", | ||
"semantic-release": "^15.0.0", | ||
"svelte": "^2.9.7", | ||
"ts-jest": "^22.0.0", | ||
"ts-node": "^6.0.0", | ||
"tslint": "^5.8.0", | ||
"tslint-config-prettier": "^1.1.0", | ||
"tslint-config-standard": "^7.0.0", | ||
"typedoc": "^0.11.0", | ||
"typescript": "^2.6.2", | ||
"validate-commit-msg": "^2.12.2" | ||
"@babel/core": "^7.0.0-beta.56", | ||
"@babel/preset-env": "^7.0.0-beta.56", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-jest": "^23.4.2", | ||
"eslint": "^5.3.0", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-plugin-import": "^2.13.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-prettier": "^2.6.2", | ||
"eslint-plugin-promise": "^3.8.0", | ||
"eslint-plugin-standard": "^3.1.0", | ||
"jest": "^23.4.2", | ||
"microbundle": "^0.6.0", | ||
"prettier": "^1.14.1", | ||
"svelte": "^2.9.11" | ||
}, | ||
"peerDependencies": { | ||
"svelte": "^2.9.11" | ||
}, | ||
"dependencies": { | ||
"deepmerge": "^2.1.1" | ||
"deepmerge": "^2.1.1", | ||
"object-resolve-path": "^1.1.1" | ||
} | ||
} |
@@ -15,7 +15,5 @@ # svelte-i18n | ||
const store = new Store() | ||
/** i18n(svelteStore, arrayOfLocalesObjects) */ | ||
i18n(store, [ | ||
{ | ||
/** i18n(svelteStore, { dictionary }) */ | ||
const store = i18n(new Store(), { | ||
dictionary: { | ||
'pt-BR': { | ||
@@ -25,4 +23,4 @@ message: 'Mensagem', | ||
alert: 'Alerta', | ||
error: 'Erro' | ||
} | ||
error: 'Erro', | ||
}, | ||
}, | ||
@@ -33,22 +31,29 @@ 'en-US': { | ||
alert: 'Alert', | ||
error: 'Error' | ||
} | ||
} | ||
error: 'Error', | ||
}, | ||
}, | ||
}, | ||
/** Locales are deeply merged */ | ||
{ | ||
'pt-BR': { | ||
messages: { | ||
warn: 'Aviso', | ||
success: 'Sucesso' | ||
} | ||
}) | ||
/** | ||
* Extend the initial dictionary. | ||
* Dictionaries are deeply merged. | ||
* */ | ||
store.i18n.extendDictionary({ | ||
'pt-BR': { | ||
messages: { | ||
warn: 'Aviso', | ||
success: 'Sucesso', | ||
}, | ||
'en-US': { | ||
messages: { | ||
warn: 'Warn', | ||
success: 'Success' | ||
} | ||
} | ||
} | ||
]) | ||
}, | ||
'en-US': { | ||
messages: { | ||
warn: 'Warn', | ||
success: 'Success', | ||
}, | ||
}, | ||
}) | ||
/** Set the initial locale */ | ||
store.i18n.setLocale('en-US') | ||
``` | ||
@@ -60,7 +65,10 @@ | ||
<div> | ||
{$_('message')}: {$_.upper('messages.success')} | ||
{$_('message')}: {$_.upper('messages.success'))} | ||
</div> | ||
``` | ||
<!-- Will render for en-US --> | ||
Renders: | ||
```html | ||
Message: SUCCESS | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
126938
16
24
553
71
3
4
7
+ Addedobject-resolve-path@^1.1.1
+ Addedobject-resolve-path@1.1.1(transitive)
+ Addedsvelte@2.16.1(transitive)