From 15204c0209c41b395babd312c55d9d3589176a5b Mon Sep 17 00:00:00 2001 From: Damien SOREL Date: Fri, 31 Mar 2017 14:07:06 +0200 Subject: [PATCH] Fix #458 Translate operator name in "Operator not multiple" message --- src/data.js | 19 ++++++++++++++++++- src/i18n/az.json | 2 +- src/i18n/bg.json | 2 +- src/i18n/cs.json | 2 +- src/i18n/el.json | 2 +- src/i18n/en.json | 2 +- src/i18n/fa-IR.json | 4 ++-- src/i18n/fr.json | 2 +- src/i18n/he.json | 2 +- src/i18n/pl.json | 2 +- src/i18n/pt-BR.json | 2 +- src/i18n/ru.json | 2 +- src/i18n/sq.json | 2 +- src/i18n/tr.json | 2 +- src/i18n/ua.json | 2 +- src/i18n/zh-CN.json | 2 +- 16 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/data.js b/src/data.js index 41b78090..48f3547a 100644 --- a/src/data.js +++ b/src/data.js @@ -49,7 +49,7 @@ QueryBuilder.prototype._validateValue = function(rule, value) { for (var i = 0; i < operator.nb_inputs; i++) { if (!operator.multiple && $.isArray(value[i]) && value[i].length > 1) { - result = ['operator_not_multiple', operator.type]; + result = ['operator_not_multiple', operator.type, this.translate('operators', operator.type)]; break; } @@ -591,6 +591,23 @@ QueryBuilder.prototype.getGroupFlags = function(flags, all) { } }; +/** + * Retrieve a translation in the `lang` object + * @param {string} [category] + * @param {string} key + * @returns {string} + */ +QueryBuilder.prototype.translate = function(category, key) { + if (!key) { + key = category; + category = undefined; + } + + var translation = (category ? this.lang[category] : this.lang)[key]; + + return this.change('translate', translation, category, key); +}; + /** * Translates a label * @param {string|object} label diff --git a/src/i18n/az.json b/src/i18n/az.json index 3cc13816..5e12334f 100644 --- a/src/i18n/az.json +++ b/src/i18n/az.json @@ -52,6 +52,6 @@ "datetime_exceed_min": "{0} sonra olmalıdır", "datetime_exceed_max": "{0} əvvəl olmalıdır", "boolean_not_valid": "Loqik olmayan", - "operator_not_multiple": "{0} operatoru çoxlu məna daşımır" + "operator_not_multiple": "\"{1}\" operatoru çoxlu məna daşımır" } } \ No newline at end of file diff --git a/src/i18n/bg.json b/src/i18n/bg.json index 27083bb4..095d01cc 100644 --- a/src/i18n/bg.json +++ b/src/i18n/bg.json @@ -56,6 +56,6 @@ "datetime_exceed_min": "Трябва да е след {0}", "datetime_exceed_max": "Трябва да е преди {0}", "boolean_not_valid": "Не е булева", - "operator_not_multiple": "Оператора {0} не може да приеме множество стойности" + "operator_not_multiple": "Оператора \"{1}\" не може да приеме множество стойности" } } diff --git a/src/i18n/cs.json b/src/i18n/cs.json index 522e6978..448cc97d 100644 --- a/src/i18n/cs.json +++ b/src/i18n/cs.json @@ -52,6 +52,6 @@ "datetime_exceed_min": "Musí být po {0}", "datetime_exceed_max": "Musí být do {0}", "boolean_not_valid": "Nelogické", - "operator_not_multiple": "Operátor {0} nepodporuje mnoho hodnot" + "operator_not_multiple": "Operátor \"{1}\" nepodporuje mnoho hodnot" } } \ No newline at end of file diff --git a/src/i18n/el.json b/src/i18n/el.json index 9e141a73..0c988473 100644 --- a/src/i18n/el.json +++ b/src/i18n/el.json @@ -52,6 +52,6 @@ "datetime_exceed_min": "Νεότερο από {0}", "datetime_exceed_max": "Παλαιότερο από {0}", "boolean_not_valid": "Δεν είναι BOOLEAN", - "operator_not_multiple": "Η συνθήκη {0} δεν μπορεί να δεχθεί πολλαπλές τιμές" + "operator_not_multiple": "Η συνθήκη \"{1}\" δεν μπορεί να δεχθεί πολλαπλές τιμές" } } \ No newline at end of file diff --git a/src/i18n/en.json b/src/i18n/en.json index b5828139..a0e9fd12 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -56,6 +56,6 @@ "datetime_exceed_min": "Must be after {0}", "datetime_exceed_max": "Must be before {0}", "boolean_not_valid": "Not a boolean", - "operator_not_multiple": "Operator {0} cannot accept multiple values" + "operator_not_multiple": "Operator \"{1}\" cannot accept multiple values" } } \ No newline at end of file diff --git a/src/i18n/fa-IR.json b/src/i18n/fa-IR.json index a6da0959..2900248c 100644 --- a/src/i18n/fa-IR.json +++ b/src/i18n/fa-IR.json @@ -21,7 +21,7 @@ "less_or_equal": "کمتر یا مساوی با", "greater": "بزرگتر از", "greater_or_equal": "بزرگتر یا مساوی با", - "between": "مابین", + "between": "مابین", "begins_with": "شروع شود با", "not_begins_with": "شروع نشود با", "contains": "شامل شود", @@ -55,6 +55,6 @@ "datetime_exceed_min": "باید بعد از {0} باشد", "datetime_exceed_max": "باید قبل از {0} باشد", "boolean_not_valid": "مقدار دودویی وارد کنید", - "operator_not_multiple": "اپراتور {0} نمی تواند چند مقدار قبول کند" + "operator_not_multiple": "اپراتور \"{1}\" نمی تواند چند مقدار قبول کند" } } \ No newline at end of file diff --git a/src/i18n/fr.json b/src/i18n/fr.json index 9d73e09d..56cbad52 100644 --- a/src/i18n/fr.json +++ b/src/i18n/fr.json @@ -56,6 +56,6 @@ "datetime_exceed_min": "Doit être après {0}", "datetime_exceed_max": "Doit être avant {0}", "boolean_not_valid": "N'est pas un booléen", - "operator_not_multiple": "L'opérateur {0} ne peut utiliser plusieurs valeurs" + "operator_not_multiple": "L'opérateur \"{1}\" ne peut utiliser plusieurs valeurs" } } \ No newline at end of file diff --git a/src/i18n/he.json b/src/i18n/he.json index 99f2acf9..d1009042 100644 --- a/src/i18n/he.json +++ b/src/i18n/he.json @@ -56,6 +56,6 @@ "datetime_exceed_min": "התאריך חייב להיות אחרי {0}", "datetime_exceed_max": "התאריך חייב להיות לפני {0}", "boolean_not_valid": "זהו לא בוליאני", - "operator_not_multiple": "האופרטור {0} לא יכול לקבל ערכים מרובים" + "operator_not_multiple": "האופרטור \"{1}\" לא יכול לקבל ערכים מרובים" } } \ No newline at end of file diff --git a/src/i18n/pl.json b/src/i18n/pl.json index 09060e10..c27069f4 100644 --- a/src/i18n/pl.json +++ b/src/i18n/pl.json @@ -56,6 +56,6 @@ "datetime_exceed_min": "Musi być po {0}", "datetime_exceed_max": "Musi być przed {0}", "boolean_not_valid": "Niepoprawna wartość logiczna", - "operator_not_multiple": "Operator {0} nie przyjmuje wielu wartości" + "operator_not_multiple": "Operator \"{1}\" nie przyjmuje wielu wartości" } } \ No newline at end of file diff --git a/src/i18n/pt-BR.json b/src/i18n/pt-BR.json index db936baf..f822aa83 100644 --- a/src/i18n/pt-BR.json +++ b/src/i18n/pt-BR.json @@ -56,6 +56,6 @@ "datetime_exceed_max": "É necessário ser inferior a {0}", "datetime_empty": "Nenhuma data selecionada", "boolean_not_valid": "Não é um valor booleano", - "operator_not_multiple": "O operador {0} não aceita valores múltiplos" + "operator_not_multiple": "O operador \"{1}\" não aceita valores múltiplos" } } \ No newline at end of file diff --git a/src/i18n/ru.json b/src/i18n/ru.json index 9248db0f..33a343e8 100644 --- a/src/i18n/ru.json +++ b/src/i18n/ru.json @@ -54,6 +54,6 @@ "datetime_exceed_min": "Должно быть, после {0}", "datetime_exceed_max": "Должно быть, до {0}", "boolean_not_valid": "Не логическое", - "operator_not_multiple": "Оператор {0} не поддерживает много значений" + "operator_not_multiple": "Оператор \"{1}\" не поддерживает много значений" } } \ No newline at end of file diff --git a/src/i18n/sq.json b/src/i18n/sq.json index 508a5cdd..415244bd 100644 --- a/src/i18n/sq.json +++ b/src/i18n/sq.json @@ -55,6 +55,6 @@ "datetime_exceed_min": "Duhet të jetë pas {0}", "datetime_exceed_max": "Duhet të jetë para {0}", "boolean_not_valid": "Nuk është boolean", - "operator_not_multiple": "Operatori {0} nuk mund të pranojë vlera të shumëfishta" + "operator_not_multiple": "Operatori \"{1}\" nuk mund të pranojë vlera të shumëfishta" } } \ No newline at end of file diff --git a/src/i18n/tr.json b/src/i18n/tr.json index 4d5280b1..2b2d0295 100644 --- a/src/i18n/tr.json +++ b/src/i18n/tr.json @@ -56,6 +56,6 @@ "datetime_exceed_min": "{0} Tarihinden daha sonrası olmalı.", "datetime_exceed_max": "{0} Tarihinden daha öncesi olmalı.", "boolean_not_valid": "Değer Doğru/Yanlış(bool) olmalı", - "operator_not_multiple": "Operatör {0} birden fazla değer kabul etmiyor" + "operator_not_multiple": "Operatör \"{1}\" birden fazla değer kabul etmiyor" } } diff --git a/src/i18n/ua.json b/src/i18n/ua.json index 5276347b..2d1c5c2d 100644 --- a/src/i18n/ua.json +++ b/src/i18n/ua.json @@ -52,6 +52,6 @@ "datetime_exceed_min": "Повинне бути, після {0}", "datetime_exceed_max": "Повинне бути, до {0}", "boolean_not_valid": "Не логічне", - "operator_not_multiple": "Оператор {0} не підтримує багато значень" + "operator_not_multiple": "Оператор \"{1}\" не підтримує багато значень" } } \ No newline at end of file diff --git a/src/i18n/zh-CN.json b/src/i18n/zh-CN.json index 51ddfe39..666ca685 100644 --- a/src/i18n/zh-CN.json +++ b/src/i18n/zh-CN.json @@ -56,6 +56,6 @@ "datetime_exceed_min": "必须在{0}之后", "datetime_exceed_max": "必须在{0}之前", "boolean_not_valid": "不是布尔值", - "operator_not_multiple": "选项{0}无法接受多个值" + "operator_not_multiple": "选项\"{1}\"无法接受多个值" } } \ No newline at end of file