@vee-validate/i18n
Advanced tools
Comparing version 4.0.0-alpha.6 to 4.0.0-alpha.7
@@ -6,2 +6,18 @@ # Change Log | ||
# [4.0.0-alpha.7](https://github.com/logaretm/vee-validate/compare/@vee-validate/i18n@4.0.0-alpha.6...@vee-validate/i18n@4.0.0-alpha.7) (2020-09-15) | ||
### Bug Fixes | ||
* add positional information to the zh_CN locale closes [#2898](https://github.com/logaretm/vee-validate/issues/2898) ([f5f44eb](https://github.com/logaretm/vee-validate/commit/f5f44ebb523db0f4d726cb8a07881d7c981c785c)) | ||
### Features | ||
* invoke generateMessage handler for local functions closes [#2893](https://github.com/logaretm/vee-validate/issues/2893) ([e9fe773](https://github.com/logaretm/vee-validate/commit/e9fe77365877edda51548c9539ec085fff91586b)) | ||
# [4.0.0-alpha.6](https://github.com/logaretm/vee-validate/compare/@vee-validate/i18n@4.0.0-alpha.5...@vee-validate/i18n@4.0.0-alpha.6) (2020-08-29) | ||
@@ -8,0 +24,0 @@ |
@@ -8,6 +8,6 @@ { | ||
"alpha_spaces": "{field}只能包含字母字符和空格", | ||
"between": "{field}必须在{min}与{max}之间", | ||
"confirmed": "{field}不能和{target}匹配", | ||
"digits": "{field}必须是数字,且精确到{length}位数", | ||
"dimensions": "{field}必须在{width}像素与{height}像素之间", | ||
"between": "{field}必须在0:{min}与1:{max}之间", | ||
"confirmed": "{field}不能和0:{target}匹配", | ||
"digits": "{field}必须是数字,且精确到0:{length}位数", | ||
"dimensions": "{field}必须在0:{width}像素与1:{height}像素之间", | ||
"email": "{field}不是一个有效的邮箱", | ||
@@ -19,8 +19,8 @@ "excluded": "{field}不是一个有效值", | ||
"integer": "{field}必须是整数", | ||
"length": "{field}长度必须为{length}", | ||
"max": "{field}不能超过{length}个字符", | ||
"max_value": "{field}必须小于或等于{max}", | ||
"length": "{field}长度必须为0:{length}", | ||
"max": "{field}不能超过0:{length}个字符", | ||
"max_value": "{field}必须小于或等于0:{max}", | ||
"mimes": "{field}不是一个有效的文件类型", | ||
"min": "{field}必须至少有{length}个字符", | ||
"min_value": "{field}必须大于或等于{min}", | ||
"min": "{field}必须至少有0:{length}个字符", | ||
"min_value": "{field}必须大于或等于0:{min}", | ||
"numeric": "{field}只能包含数字字符", | ||
@@ -30,4 +30,4 @@ "regex": "{field}格式无效", | ||
"required_if": "{field}是必须的", | ||
"size": "{field}必须小于{size}KB" | ||
"size": "{field}必须小于0:{size}KB" | ||
} | ||
} |
@@ -5,3 +5,3 @@ interface FieldContext { | ||
form: Record<string, any>; | ||
rule: { | ||
rule?: { | ||
name: string; | ||
@@ -8,0 +8,0 @@ params?: Record<string, any> | any[]; |
/** | ||
* vee-validate v4.0.0-alpha.6 | ||
* vee-validate v4.0.0-alpha.7 | ||
* (c) 2020 Abdelrahman Awad | ||
@@ -59,2 +59,5 @@ * @license MIT | ||
const { field, rule, form } = ctx; | ||
if (!rule) { | ||
return `${field} is not valid`; | ||
} | ||
// find if specific message for that field was specified. | ||
@@ -68,3 +71,3 @@ message = ((_c = (_b = (_a = this.container[locale]) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b[field]) === null || _c === void 0 ? void 0 : _c[rule.name]) || ((_e = (_d = this.container[locale]) === null || _d === void 0 ? void 0 : _d.messages) === null || _e === void 0 ? void 0 : _e[rule.name]); | ||
? message(ctx) | ||
: interpolate(message, Object.assign(Object.assign({}, form), { field: fieldName, params: ctx.rule.params })); | ||
: interpolate(message, Object.assign(Object.assign({}, form), { field: fieldName, params: rule.params })); | ||
} | ||
@@ -71,0 +74,0 @@ merge(dictionary) { |
/** | ||
* vee-validate v4.0.0-alpha.6 | ||
* vee-validate v4.0.0-alpha.7 | ||
* (c) 2020 Abdelrahman Awad | ||
@@ -65,2 +65,5 @@ * @license MIT | ||
const { field, rule, form } = ctx; | ||
if (!rule) { | ||
return `${field} is not valid`; | ||
} | ||
// find if specific message for that field was specified. | ||
@@ -74,3 +77,3 @@ message = ((_c = (_b = (_a = this.container[locale]) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b[field]) === null || _c === void 0 ? void 0 : _c[rule.name]) || ((_e = (_d = this.container[locale]) === null || _d === void 0 ? void 0 : _d.messages) === null || _e === void 0 ? void 0 : _e[rule.name]); | ||
? message(ctx) | ||
: interpolate(message, Object.assign(Object.assign({}, form), { field: fieldName, params: ctx.rule.params })); | ||
: interpolate(message, Object.assign(Object.assign({}, form), { field: fieldName, params: rule.params })); | ||
} | ||
@@ -77,0 +80,0 @@ merge(dictionary) { |
/** | ||
* vee-validate v4.0.0-alpha.6 | ||
* vee-validate v4.0.0-alpha.7 | ||
* (c) 2020 Abdelrahman Awad | ||
* @license MIT | ||
*/ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).VeeValidateI18n={})}(this,(function(e){"use strict";function n(e,i){return Object.keys(i).forEach(r=>{if(null!==(o=i[r])&&o&&"object"==typeof o&&!Array.isArray(o))return e[r]||(e[r]={}),void n(e[r],i[r]);var o;e[r]=i[r]}),e}class i{constructor(e,n){this.container={},this.locale=e,this.merge(n)}resolve(e){return this.format(this.locale,e)}format(e,n){var i,r,o,t,a,s,l,c;let u;const{field:d,rule:f,form:m}=n;u=(null===(o=null===(r=null===(i=this.container[e])||void 0===i?void 0:i.fields)||void 0===r?void 0:r[d])||void 0===o?void 0:o[f.name])||(null===(a=null===(t=this.container[e])||void 0===t?void 0:t.messages)||void 0===a?void 0:a[f.name]),u||(u=d+" is not valid");const p=null!==(c=null===(l=null===(s=this.container[e])||void 0===s?void 0:s.names)||void 0===l?void 0:l[d])&&void 0!==c?c:d;return"function"==typeof u?u(n):(v=u,h=Object.assign(Object.assign({},m),{field:p,params:n.rule.params}),v.replace(/(\d:)?{([^}]+)}/g,(function(e,n,i){if(!n||!h.params)return i in h?h[i]:h.params&&i in h.params?h.params[i]:`{${i}}`;if(!Array.isArray(h.params))return i in h.params?h.params[i]:`{${i}}`;const r=Number(n.replace(":",""));return r in h.params?h.params[r]:`${n}{${i}}`})));var v,h}merge(e){n(this.container,e)}}let r;e.localize=function(e,n){r||(r=new i("en",{}));const o=e=>r.resolve(e);return"string"==typeof e?(r.locale=e,n&&r.merge({[e]:n}),o):(r.merge(e),o)},e.setLocale=function(e){r.locale=e},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).VeeValidateI18n={})}(this,(function(e){"use strict";function n(e,i){return Object.keys(i).forEach(r=>{if(null!==(o=i[r])&&o&&"object"==typeof o&&!Array.isArray(o))return e[r]||(e[r]={}),void n(e[r],i[r]);var o;e[r]=i[r]}),e}class i{constructor(e,n){this.container={},this.locale=e,this.merge(n)}resolve(e){return this.format(this.locale,e)}format(e,n){var i,r,o,t,a,s,l,c;let u;const{field:d,rule:f,form:m}=n;if(!f)return d+" is not valid";u=(null===(o=null===(r=null===(i=this.container[e])||void 0===i?void 0:i.fields)||void 0===r?void 0:r[d])||void 0===o?void 0:o[f.name])||(null===(a=null===(t=this.container[e])||void 0===t?void 0:t.messages)||void 0===a?void 0:a[f.name]),u||(u=d+" is not valid");const p=null!==(c=null===(l=null===(s=this.container[e])||void 0===s?void 0:s.names)||void 0===l?void 0:l[d])&&void 0!==c?c:d;return"function"==typeof u?u(n):(v=u,h=Object.assign(Object.assign({},m),{field:p,params:f.params}),v.replace(/(\d:)?{([^}]+)}/g,(function(e,n,i){if(!n||!h.params)return i in h?h[i]:h.params&&i in h.params?h.params[i]:`{${i}}`;if(!Array.isArray(h.params))return i in h.params?h.params[i]:`{${i}}`;const r=Number(n.replace(":",""));return r in h.params?h.params[r]:`${n}{${i}}`})));var v,h}merge(e){n(this.container,e)}}let r;e.localize=function(e,n){r||(r=new i("en",{}));const o=e=>r.resolve(e);return"string"==typeof e?(r.locale=e,n&&r.merge({[e]:n}),o):(r.merge(e),o)},e.setLocale=function(e){r.locale=e},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@vee-validate/i18n", | ||
"version": "4.0.0-alpha.6", | ||
"version": "4.0.0-alpha.7", | ||
"description": "Localization module for VeeValidate", | ||
@@ -28,3 +28,3 @@ "author": "Abdelrahman Awad <logaretm1@gmail.com>", | ||
}, | ||
"gitHead": "660d2de5c13799802653c61db27cf7ac590dbff4" | ||
"gitHead": "9abd8a90ba688e2a8cf89ef543d9ce0ca8fe6143" | ||
} |
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
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
101314
1623