Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ajv-i18n

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ajv-i18n - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

localize/en/index.js

12

package.json
{
"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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc