Skip to content

Commit

Permalink
Support default display for {0}
Browse files Browse the repository at this point in the history
  • Loading branch information
niceue committed Jan 13, 2016
1 parent f55d7c9 commit 1a01af4
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dist/jquery.validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@
5. default message;
*/
msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(){
return me._getDisplay(el, field.display) || arguments[1];
return me._getDisplay(el, field.display) || arguments[1] || me.messages[0];
});
}
if (!isValid) field.isValid = isValid;
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.validator.min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dist/local/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@

// Default error messages
messages: {
fallback: "This field is not valid.",
0: "This field",
fallback: "{0} is not valid.",
loading: "Validating...",
error: "Network Error.",
timeout: "Request timed out.",
required: "This field is required.",
required: "{0} is required.",
remote: "Please try another name.",
integer: {
'*': "Please enter an integer.",
Expand Down
5 changes: 3 additions & 2 deletions dist/local/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@

// Default error messages
messages: {
fallback: "このフィールドは有効ではありません",
0: "このフィールド",
fallback: "{0}は有効ではありません",
loading: "検証プロセス...",
error: "ネットワークエラー",
timeout: "要求がタイムアウトしました",
required: "このフィールドは必須です",
required: "{0}は必須です",
remote: "この値が使用されている",
integer: {
'*': "整数を入力してください",
Expand Down
1 change: 1 addition & 0 deletions dist/local/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

// Default error messages
messages: {
0: "",
fallback: "{0}格式不正确",
loading: "正在验证...",
error: "网络异常",
Expand Down
1 change: 1 addition & 0 deletions dist/local/zh-TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

// Default error messages
messages: {
0: "",
fallback: "{0}格式不正確",
loading: "正在驗證...",
error: "網絡異常",
Expand Down
2 changes: 1 addition & 1 deletion src/jquery.validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@
5. default message;
*/
msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(){
return me._getDisplay(el, field.display) || arguments[1];
return me._getDisplay(el, field.display) || arguments[1] || me.messages[0];
});
}
if (!isValid) field.isValid = isValid;
Expand Down
5 changes: 3 additions & 2 deletions src/local/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ exports.rules = {
};

exports.lang = {
fallback: "This field is not valid.",
0: 'This field',
fallback: "{0} is not valid.",
loading: "Validating...",

error: "Network Error.",
timeout: "Request timed out.",

required: "This field is required.",
required: "{0} is required.",
remote: "Please try another name.",

integer_nzp: "Please enter an integer.",
Expand Down
5 changes: 3 additions & 2 deletions src/local/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ exports.rules = {
};

exports.lang = {
fallback: "このフィールドは有効ではありません",
0: "このフィールド",
fallback: "{0}は有効ではありません",
loading: "検証プロセス...",

error: "ネットワークエラー",
timeout: "要求がタイムアウトしました",

digits: "番号を入力してください",

required: "このフィールドは必須です",
required: "{0}は必須です",
remote: "この値が使用されている",

integer_nzp: "整数を入力してください",
Expand Down
1 change: 1 addition & 0 deletions src/local/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ exports.rules = {
};

exports.lang = {
0: "",
fallback: "{0}格式不正确",
loading: "正在验证...",

Expand Down
1 change: 1 addition & 0 deletions src/local/zh-TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exports.rules = {
};

exports.lang = {
0: "",
fallback: "{0}格式不正確",
loading: "正在驗證...",

Expand Down

1 comment on commit 1a01af4

@niceue
Copy link
Owner Author

@niceue niceue commented on 1a01af4 Jan 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved #207

Please sign in to comment.