Repository: baianat/vee-validate
Pull request #1995 (2019-04-06 17:18:03)

Translate the "is" rule messages in pt_PT and pt_BR languages
This PR adds the message translations in pt_PT and pt_BR of the rule: [is](https://baianat.github.io/vee-validate/guide/rules.html#is).


codecov[bot]: # [Codecov](https://codecov.io/gh/baianat/vee-validate/pull/1995?src=pr&el=h1) Report
> Merging [#1995](https://codecov.io/gh/baianat/vee-validate/pull/1995?src=pr&el=desc) into [master](https://codecov.io/gh/baianat/vee-validate/commit/2e2e0d962b2d1e8f42950bfc0b203e4b0de7d290?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/baianat/vee-validate/pull/1995/graphs/tree.svg?width=650&token=XFzlvHKFP5&height=150&src=pr)](https://codecov.io/gh/baianat/vee-validate/pull/1995?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #1995   +/-   ##
=======================================
  Coverage   95.98%   95.98%           
=======================================
  Files          62       62           
  Lines        2341     2341           
  Branches      729      729           
=======================================
  Hits         2247     2247           
  Misses         85       85           
  Partials        9        9
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/baianat/vee-validate/pull/1995?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/baianat/vee-validate/pull/1995?src=pr&el=footer). Last update [2e2e0d9...6ce0a4c](https://codecov.io/gh/baianat/vee-validate/pull/1995?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

codecov[bot]: # [Codecov](https://codecov.io/gh/baianat/vee-validate/pull/1995?src=pr&el=h1) Report
> Merging [#1995](https://codecov.io/gh/baianat/vee-validate/pull/1995?src=pr&el=desc) into [master](https://codecov.io/gh/baianat/vee-validate/commit/2e2e0d962b2d1e8f42950bfc0b203e4b0de7d290?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/baianat/vee-validate/pull/1995/graphs/tree.svg?width=650&token=XFzlvHKFP5&height=150&src=pr)](https://codecov.io/gh/baianat/vee-validate/pull/1995?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #1995   +/-   ##
=======================================
  Coverage   95.98%   95.98%           
=======================================
  Files          62       62           
  Lines        2341     2341           
  Branches      729      729           
=======================================
  Hits         2247     2247           
  Misses         85       85           
  Partials        9        9
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/baianat/vee-validate/pull/1995?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/baianat/vee-validate/pull/1995?src=pr&el=footer). Last update [2e2e0d9...6ce0a4c](https://codecov.io/gh/baianat/vee-validate/pull/1995?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/locale/pt_BR.js b/locale/pt_BR.js
index cb1d9804..3718af1e 100644
--- a/locale/pt_BR.js
+++ b/locale/pt_BR.js
@@ -23,6 +23,7 @@ const messages = {
   included: (field) => `O campo ${field} deve ter um valor válido.`,
   integer: (field) => `O campo ${field} deve ser um número inteiro.`,
   ip: (field) => `O campo ${field} deve ser um endereço IP válido.`,
+  is: (field) => `O valor inserido no campo ${field} não é válido.`,
   length: (field, [length, max]) => {
     if (max) {
       return `O tamanho do campo ${field} está entre ${length} e ${max}.`;
diff --git a/locale/pt_PT.js b/locale/pt_PT.js
index ba61481b..cf45c7f5 100644
--- a/locale/pt_PT.js
+++ b/locale/pt_PT.js
@@ -21,6 +21,7 @@ const messages = {
   image: (field) => `O campo ${field} deve ser uma imagem.`,
   included: (field) => `O campo ${field} deve ter um valor válido.`,
   ip: (field) => `O campo ${field} deve ser um endereço IP válido.`,
+  is: (field) => `O valor inserido no campo ${field} não é válido.`,
   max: (field, [length]) => `O campo ${field} não deve ter mais que ${length} caracteres.`,
   max_value: (field, [max]) => `O campo ${field} precisa ser ${max} ou menor.`,
   mimes: (field) => `O campo ${field} deve ser um tipo de ficheiro válido.`,
diff --git a/src/utils/index.js b/src/utils/index.js
index e642eef6..a6118b6e 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -544,19 +544,19 @@ export const fillRulesFromElement = (el: HTMLInputElement, rules: string | { [st
     const timeFormat = el.step && Number(el.step) < 60 ? 'HH:mm:ss' : 'HH:mm';
 
     if (el.type === 'date') {
-      return appendRule('date_format:YYYY-MM-DD', rules);
+      return appendRule('date_format:yyyy-MM-dd', rules);
     }
 
     if (el.type === 'datetime-local') {
-      return appendRule(`date_format:YYYY-MM-DDT${timeFormat}`, rules);
+      return appendRule(`date_format:yyyy-MM-ddT${timeFormat}`, rules);
     }
 
     if (el.type === 'month') {
-      return appendRule('date_format:YYYY-MM', rules);
+      return appendRule('date_format:yyyy-MM', rules);
     }
 
     if (el.type === 'week') {
-      return appendRule('date_format:YYYY-[W]WW', rules);
+      return appendRule('date_format:yyyy-[W]WW', rules);
     }
 
     if (el.type === 'time') {
diff --git a/src/utils/vnode.js b/src/utils/vnode.js
index bc58e254..13da33f7 100644
--- a/src/utils/vnode.js
+++ b/src/utils/vnode.js
@@ -111,8 +111,8 @@ export function getInputEventName (vnode, model) {
     return event;
   }
 
-  // Lazy Models typically use change event
-  if (model && model.modifiers && model.modifiers.lazy) {
+  // Lazy Models and select tag typically use change event
+  if ((model && model.modifiers && model.modifiers.lazy) || vnode.tag === 'select') {
     return 'change';
   }
 


Test patch:
diff --git a/tests/unit/resolver.js b/tests/unit/resolver.js
index 778a6831..6a845105 100644
--- a/tests/unit/resolver.js
+++ b/tests/unit/resolver.js
@@ -98,16 +98,16 @@ describe('resolves the rules', () => {
     expect(resolve(input)).toEqual({ min_value: ['10'], max_value: ['20'], decimal: [] });
 
     input.type = 'date';
-    expect(resolve(input)).toEqual({ date_format: ['YYYY-MM-DD'] });
+    expect(resolve(input)).toEqual({ date_format: ['yyyy-MM-dd'] });
 
     input.type = 'datetime-local';
-    expect(resolve(input)).toEqual({ date_format: ['YYYY-MM-DDTHH:mm'] });
+    expect(resolve(input)).toEqual({ date_format: ['yyyy-MM-ddTHH:mm'] });
 
     input.type = 'week';
-    expect(resolve(input)).toEqual({ date_format: ['YYYY-[W]WW'] });
+    expect(resolve(input)).toEqual({ date_format: ['yyyy-[W]WW'] });
 
     input.type = 'month';
-    expect(resolve(input)).toEqual({ date_format: ['YYYY-MM'] });
+    expect(resolve(input)).toEqual({ date_format: ['yyyy-MM'] });
 
     input.type = 'time';
     expect(resolve(input)).toEqual({ date_format: ['HH:mm'] });