Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "ajv-i18n", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Internationalised error messages for ajv JSON-Schema validator", | ||
"main": "index.js", | ||
"files": [ | ||
"localize/", | ||
"LICENSE" | ||
], | ||
"scripts": { | ||
"test": "mocha spec/*.spec.js -R spec", | ||
"build": "node scripts/compile-locales.js", | ||
"prepublish": "npm run build" | ||
"prepublish": "npm run build", | ||
"test": "npm run build && mocha spec/*.spec.js -R spec" | ||
}, | ||
@@ -29,3 +33,3 @@ "repository": { | ||
"devDependencies": { | ||
"ajv": "^1.3.2", | ||
"ajv": "^1.4.0", | ||
"dot": "^1.0.3", | ||
@@ -32,0 +36,0 @@ "js-beautify": "^1.5.10", |
# ajv-i18n | ||
Internationalised error messages for [Ajv](https://github.com/epoberezkin/ajv) JSON-Schema validator | ||
Internationalised error messages for [Ajv](https://github.com/epoberezkin/ajv) - currently the fastest JSON-Schema validator | ||
In progress... | ||
## Supported locales | ||
At the moment these locales are supported: `en` and `ru`. | ||
Please contribute those that you need to use. | ||
## Install | ||
@@ -12,2 +18,3 @@ | ||
## Usage | ||
@@ -21,2 +28,3 @@ | ||
// option `i18n` is required for this package to work | ||
var ajv = Ajv({ allErrors: true, i18n: true }); | ||
@@ -30,3 +38,3 @@ var validate = ajv.compile(schema); | ||
// string with all errors and data paths | ||
console.log(ajv.errorsText(errors, { separator: '\n', })); | ||
console.log(ajv.errorsText(errors, { separator: '\n' })); | ||
} | ||
@@ -51,1 +59,22 @@ ``` | ||
See [Ajv docs](https://github.com/epoberezkin/ajv) for more information. | ||
## Tests | ||
``` | ||
npm install | ||
git submodule update --init | ||
npm test | ||
``` | ||
## Contributing | ||
Functions that localize error messages are generated using doT templates in [messages](https://github.com/epoberezkin/ajv-i18n/tree/master/messages/index.js) and [localize.jst](https://github.com/epoberezkin/ajv-i18n/tree/master/localize/localize.jst) template. Templates are precompiled so doT is not a run-time dependency. | ||
`npm run build` - compiles functions to [localize](https://github.com/epoberezkin/ajv/tree/master/localize) folder. | ||
## License | ||
[MIT](https://github.com/epoberezkin/ajv-i18n/blob/master/LICENSE) |
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
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
77
0
12821
7
262