Skip to content

Commit

Permalink
Merge pull request mikeerickson#122 from Jimmy-YMJ/master
Browse files Browse the repository at this point in the history
Add Chinese (zh) localization
  • Loading branch information
David Tang committed Aug 23, 2016
2 parents 199e222 + 1e12ee1 commit a8ff631
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
spec/checklist.md
coverage
npm-debug.log
.idea
7 changes: 7 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ module.exports = function(grunt) {
},
dest: 'dist/lang/tr.js'
},
zhLang: {
src: [],
options: {
require: ['./src/lang/zh:./lang/zh']
},
dest: 'dist/lang/zh.js'
},
dist: {
files: {
'dist/validator.js': 'src/validator.js'
Expand Down
39 changes: 39 additions & 0 deletions dist/lang/zh.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"./lang/zh":[function(require,module,exports){
module.exports = {
accepted: ':attribute必须是可接受的.',
alpha: ':attribute只能包含字母.',
alpha_dash: ':attribute只能包含字母,连字符和下划线.',
alpha_num: ':attribute只能包含字母和数字.',
between: ':attribute的(大小,长度等)只能在:min和:max之间.',
confirmed: ':attribute确认不一致.',
email: ':attribute格式不正确.',
date: ':attribute日期格式错误.',
def: ':attribute属性错误.',
digits: ':attribute必须是:digits位小数.',
different: ':attribute和:different必须不同.',
'in': '选择的:attribute无效',
integer: ':attribute必须是一个整数.',
min: {
numeric: ':attribute不能小于:min.',
string: ':attribute长度不能小于:min.'
},
max: {
numeric: ':attribute不能大于:max.',
string: ':attribute长度不能大于:max.'
},
not_in: '所选的:attribute无效.',
numeric: ':attribute必须是一个数字.',
required: ':attribute不能为空.',
required_if: '当:other是:value时,:attribute不能为空.',
same: ':attribute和:same必须一致.',
size: {
numeric: ':attribute必须等于:size.',
string: ':attribute的长度必须等于:size.'
},
string: ':attribute必须是一个字符串.',
url: ':attribute格式不正确.',
regex: ':attribute格式不正确.',
attributes: {}
};

},{}]},{},[]);
2 changes: 1 addition & 1 deletion dist/validator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! validatorjs - v3.4.0 - - 2016-08-21 */
/*! validatorjs - v3.4.0 - - 2016-08-22 */
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Validator = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
function AsyncResolvers(onFailedOne, onResolvedAll) {
this.onResolvedAll = onResolvedAll;
Expand Down
2 changes: 1 addition & 1 deletion dist/validator.min.js

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions src/lang/zh.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
accepted: ':attribute必须是可接受的.',
alpha: ':attribute只能包含字母.',
alpha_dash: ':attribute只能包含字母,连字符和下划线.',
alpha_num: ':attribute只能包含字母和数字.',
between: ':attribute的(大小,长度等)只能在:min和:max之间.',
confirmed: ':attribute确认不一致.',
email: ':attribute格式不正确.',
date: ':attribute日期格式错误.',
def: ':attribute属性错误.',
digits: ':attribute必须是:digits位小数.',
different: ':attribute和:different必须不同.',
'in': '选择的:attribute无效',
integer: ':attribute必须是一个整数.',
min: {
numeric: ':attribute不能小于:min.',
string: ':attribute长度不能小于:min.'
},
max: {
numeric: ':attribute不能大于:max.',
string: ':attribute长度不能大于:max.'
},
not_in: '所选的:attribute无效.',
numeric: ':attribute必须是一个数字.',
required: ':attribute不能为空.',
required_if: '当:other是:value时,:attribute不能为空.',
same: ':attribute和:same必须一致.',
size: {
numeric: ':attribute必须等于:size.',
string: ':attribute的长度必须等于:size.'
},
string: ':attribute必须是一个字符串.',
url: ':attribute格式不正确.',
regex: ':attribute格式不正确.',
attributes: {}
};

0 comments on commit a8ff631

Please sign in to comment.