浏览代码

#638: Add Brazil phone number validator, thanks to [@fhferreira](https://github.com/fhferreira)

phuoc 11 年之前
父节点
当前提交
af361b8df9

+ 1 - 1
CHANGELOG.md

@@ -6,7 +6,7 @@ __New features__
 
 * [#218](https://github.com/nghuuphuoc/bootstrapvalidator/issues/218), [#531](https://github.com/nghuuphuoc/bootstrapvalidator/pull/531): Add meid validator, thanks to [@troymccabe](https://github.com/troymccabe)
 * [#267](https://github.com/nghuuphuoc/bootstrapvalidator/issues/267), [#532](https://github.com/nghuuphuoc/bootstrapvalidator/pull/532): Add imo validator, thanks to [@troymccabe](https://github.com/troymccabe)
-* [#510](https://github.com/nghuuphuoc/bootstrapvalidator/pull/510), [#536](https://github.com/nghuuphuoc/bootstrapvalidator/pull/536): The [phone](http://bootstrapvalidator.com/validators/phone/) validator now supports French, Spanish phone number, thanks to [@dlucazeau](https://github.com/dlucazeau) and [@vadail](https://github.com/vadail)
+* The [phone](http://bootstrapvalidator.com/validators/phone/) validator now supports Brazil ([#638](https://github.com/nghuuphuoc/bootstrapvalidator/pull/638)), French ([#510](https://github.com/nghuuphuoc/bootstrapvalidator/pull/510)), Spanish ([#536](https://github.com/nghuuphuoc/bootstrapvalidator/pull/536)) phone number, thanks to [@fhferreira](https://github.com/fhferreira), [@dlucazeau](https://github.com/dlucazeau) and [@vadail](https://github.com/vadail)
 * [#519](https://github.com/nghuuphuoc/bootstrapvalidator/pull/519), [#637](https://github.com/nghuuphuoc/bootstrapvalidator/pull/637): Add validator for Iceland and South African [VAT](http://bootstrapvalidator.com/validators/vat/) numbers, thanks to [@evilchili](https://github.com/evilchili)
 
 __Improvements__

+ 1 - 0
CONTRIBUTORS.md

@@ -20,6 +20,7 @@ I would like to give big thanks to the following contributors:
 * [@ericnakagawa](https://github.com/ericnakagawa)
 * [@etorres](https://github.com/etorres)
 * [@evilchili](https://github.com/evilchili)
+* [@fhferreira](https://github.com/fhferreira)
 * [@Francismori7](https://github.com/Francismori7)
 * [@gercheq](https://github.com/gercheq)
 * [@grzesiek](https://github.com/grzesiek)

+ 1 - 1
dist/css/bootstrapValidator.min.css

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.1-dev, built on 2014-08-05 6:09:00 AM
+ * @version     v0.5.1-dev, built on 2014-08-08 7:01:35 PM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

+ 33 - 7
dist/js/bootstrapValidator.js

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.1-dev, built on 2014-08-05 6:09:00 AM
+ * @version     v0.5.1-dev, built on 2014-08-08 7:01:35 PM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
@@ -4525,6 +4525,7 @@
         countryNotSupported: 'The country code %s is not supported',
         country: 'Please enter a valid phone number in %s',
         countries: {
+            BR: 'Brazil',
             ES: 'Spain',
             FR: 'France',
             GB: 'United Kingdom',
@@ -4539,7 +4540,7 @@
         },
 
         // The supported countries
-        COUNTRY_CODES: ['ES', 'FR', 'GB', 'US'],
+        COUNTRY_CODES: ['BR', 'ES', 'FR', 'GB', 'US'],
 
         /**
          * Return true if the input value contains a valid phone number for the country
@@ -4578,6 +4579,12 @@
 
             var isValid = true;
             switch (country.toUpperCase()) {
+                case 'BR':
+                    // Test: http://regexr.com/399m1
+                    value   = $.trim(value);
+                    isValid = (/^(([\d]{4}[-.\s]{1}[\d]{3}[-.\s]{1}[\d]{4})|((\(?\+?[0-9]{2}\)?\s?)?(\(?\d{2}\)?\s?)?\d{4,5}[-.\s]?\d{4}))$/).test(value);
+                    break;
+
                 case 'ES':
                     // http://regex101.com/r/rB9mA9/1
                     value   = $.trim(value);
@@ -4596,7 +4603,7 @@
             		value   = $.trim(value);
             		isValid = (/^\(?(?:(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?\(?(?:0\)?[\s-]?\(?)?|0)(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}|\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4}|\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3})|\d{5}\)?[\s-]?\d{4,5}|8(?:00[\s-]?11[\s-]?11|45[\s-]?46[\s-]?4\d))(?:(?:[\s-]?(?:x|ext\.?\s?|\#)\d+)?)$/).test(value);
                     break;
-
+                
                 case 'US':
                 /* falls through */
                 default:
@@ -5227,6 +5234,7 @@
             HU: 'Hungarian',
             HR: 'Croatian',
             IE: 'Irish',
+            IS: 'Iceland',
             IT: 'Italian',
             LT: 'Lithuanian',
             LU: 'Luxembourg',
@@ -5255,7 +5263,7 @@
         // Supported country codes
         COUNTRY_CODES: [
             'AT', 'BE', 'BG', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'EL', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU',
-            'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'RS', 'SE', 'SK', 'SI', 'ZA'
+            'IE', 'IS', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'RS', 'SE', 'SK', 'SI', 'ZA'
         ],
 
         /**
@@ -5994,6 +6002,19 @@
         },
 
         /**
+         * Validate Icelandic VAT (VSK) number
+         * Examples:
+         * - Valid: 12345, 123456
+         * - Invalid: 1234567
+         *
+         * @params {String} value VAT number
+         * @returns {Boolean}
+         */
+        _is: function(value) {
+            return /^IS\d{5,6}$/.test(value);
+        },
+
+        /**
          * Validate Italian VAT number, which consists of 11 digits.
          * - First 7 digits are a company identifier
          * - Next 3 are the province of residence
@@ -6433,7 +6454,7 @@
          * @returns {Boolean}
          */
          _za: function(value) {
-            return /^4\d{9}$/.test(value);
+            return /^ZA4\d{9}$/.test(value);
         }
     };
 }(window.jQuery));
@@ -6499,7 +6520,8 @@
             NL: 'Dutch postal code',
             SE: 'Swiss postal code',
             SG: 'Singapore postal code',
-            US: 'US zip code'
+            US: 'US zip code',
+            BR: 'Brazilian postal code'
         }
     });
 
@@ -6509,7 +6531,7 @@
             country: 'country'
         },
 
-        COUNTRY_CODES: ['CA', 'DK', 'GB', 'IT', 'NL', 'SE', 'SG', 'US'],
+        COUNTRY_CODES: ['CA', 'DK', 'GB', 'IT', 'NL', 'SE', 'SG', 'US', 'BR'],
 
         /**
          * Return true if and only if the input value is a valid country zip code
@@ -6592,6 +6614,10 @@
                 case 'SG':
                     isValid = /^([0][1-9]|[1-6][0-9]|[7]([0-3]|[5-9])|[8][0-2])(\d{4})$/i.test(value);
                     break;
+                    
+                case 'BR':
+                    isValid = /^(\d{2})([\.]?)(\d{3})([\-]?)(\d{3})$/.test(value);
+                    break;
 
                 case 'US':
                 /* falls through */

文件差异内容过多而无法显示
+ 3 - 3
dist/js/bootstrapValidator.min.js


+ 2 - 0
dist/js/language/be_NL.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'De land code %s is niet ondersteund',
             country: 'Geef een geldig telefoon nummer van %s',
             countries: {
+                BR: 'Brazilië',
                 ES: 'Spanje',
                 FR: 'Frankrijk',
                 GB: 'Verenigd Koninkrijk',
@@ -295,6 +296,7 @@
                 HU: 'Hongaars',
                 HR: 'Kroatisch',
                 IE: 'Iers',
+                IS: 'IJsland',
                 IT: 'Italiaans',
                 LT: 'Litouwse',
                 LU: 'Luxemburgs',

+ 2 - 0
dist/js/language/bg_BG.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Държавата %s не се поддържа',
             country: 'Моля, въведете валиден телефонен номер в %s',
             countries: {
+                BR: 'Бразилия',
                 ES: 'Испания',
                 FR: 'Франция',
                 GB: 'Великобритания',
@@ -295,6 +296,7 @@
                 HU: 'Унгарски',
                 HR: 'Хърватски',
                 IE: 'Ирландски',
+                IS: 'Исландия',
                 IT: 'Италиански',
                 LT: 'Литовски',
                 LU: 'Люксембург',

+ 2 - 0
dist/js/language/cs_CZ.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Telefoní číslo pro %s není podporované',
             country: 'Prosím zadejte správné telefoní číslo pro %s',
             countries: {
+                BR: 'Brazílii',
                 ES: 'Španělsko',
                 FR: 'Francii',
                 GB: 'Velkou Británii',
@@ -295,6 +296,7 @@
                 HU: 'Maďarsko',
                 HR: 'Chorvatsko',
                 IE: 'Irsko',
+                IS: 'Island',
                 IT: 'Itálie',
                 LT: 'Litvu',
                 LU: 'Lucembursko',

+ 2 - 0
dist/js/language/da_DK.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Landekoden %s understøttes desværre ikke',
             country: 'Udfyld venligst dette felt med et gyldigt telefonnummer i %s',
             countries: {
+                BR: 'Brasilien',
                 ES: 'Spanien',
                 FR: 'Frankrig',
                 GB: 'England',
@@ -295,6 +296,7 @@
                 HU: 'ungarnsk',
                 HR: 'kroatisk',
                 IE: 'irsk',
+                IS: 'island',
                 IT: 'italiensk',
                 LT: 'litauisk',
                 LU: 'luxembourgsk',

+ 2 - 0
dist/js/language/de_DE.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Der Ländercode %s wird nicht unterstützt',
             country: 'Bitte valide Telefonnummer für %s eingeben',
             countries: {
+                BR: 'Brasilien',
                 ES: 'Spanien',
                 FR: 'Frankreich',
                 GB: 'Vereinigtes Königreich',
@@ -295,6 +296,7 @@
                 HU: 'Ungarisch',
                 HR: 'Kroatisch',
                 IE: 'Irisch',
+                IS: 'Island',
                 IT: 'Italienisch',
                 LT: 'Lithauisch',
                 LU: 'Luxemburgerisch',

+ 2 - 0
dist/js/language/en_US.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'The country code %s is not supported',
             country: 'Please enter a valid phone number in %s',
             countries: {
+                BR: 'Brazil',
                 ES: 'Spain',
                 FR: 'France',
                 GB: 'United Kingdom',
@@ -295,6 +296,7 @@
                 HU: 'Hungarian',
                 HR: 'Croatian',
                 IE: 'Irish',
+                IS: 'Iceland',
                 IT: 'Italian',
                 LT: 'Lithuanian',
                 LU: 'Luxembourg',

+ 2 - 0
dist/js/language/es_CL.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'El código del país %s no está soportado',
             country: 'Por favor ingrese un número válido de teléfono en %s',
             countries: {
+                BR: 'Brasil',
                 ES: 'España',
                 FR: 'Francia',
                 GB: 'Reino Unido',
@@ -295,6 +296,7 @@
                 HU: 'Húngaro',
                 HR: 'Croata',
                 IE: 'Irlandés',
+                IS: 'Islandia',
                 IT: 'Italiano',
                 LT: 'Lituano',
                 LU: 'Luxemburgués',

+ 2 - 0
dist/js/language/es_ES.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'El código del país %s no está soportado',
             country: 'Por favor introduce un número válido de teléfono en %s',
             countries: {
+                BR: 'Brasil',
                 ES: 'España',
                 FR: 'Francia',
                 GB: 'Reino Unido',
@@ -295,6 +296,7 @@
                 HU: 'Húngaro',
                 HR: 'Croata',
                 IE: 'Irlandés',
+                IS: 'Islandia',
                 IT: 'Italiano',
                 LT: 'Lituano',
                 LU: 'Luxemburgués',

+ 2 - 0
dist/js/language/fr_FR.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Le code de pays %s n\'est pas accepté',
             country: 'Veuillez fournir un numéro de téléphone valide pour %s',
             countries: {
+                BR: 'Brésil',
                 ES: 'las Espagne',
                 FR: 'la France',
                 GB: 'le Royaume Uni',
@@ -295,6 +296,7 @@
                 HU: 'hongrois',
                 HR: 'croate',
                 IE: 'irlandais',
+                IS: 'Islande',
                 IT: 'italien',
                 LT: 'lithuanien',
                 LU: 'luxembourgeois',

+ 2 - 0
dist/js/language/gr_EL.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Ο κωδικός χώρας %s δεν υποστηρίζεται',
             country: 'Παρακαλώ εισάγετε ένα έγκυρο αριθμό τηλεφώνου στην %s',
             countries: {
+                BR: 'Βραζιλία',
                 ES: 'Ισπανία',
                 FR: 'Γαλλία',
                 GB: 'Ηνωμένο Βασίλειο',
@@ -295,6 +296,7 @@
                 HU: 'Ουγγαρίας',
                 HR: 'Κροατίας',
                 IE: 'Ιρλανδίας',
+                IS: 'Ισλανδία',
                 IT: 'Ιταλίας',
                 LT: 'Λιθουανίας',
                 LU: 'Λουξεμβούργου',

+ 2 - 0
dist/js/language/hu_HU.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'A(z) %s országkód nem támogatott',
             country: 'Kérlek, hogy érvényes %s telefonszámot adj meg',
             countries: {
+                BR: 'brazil',
                 ES: 'spanyol',
                 FR: 'francia',
                 GB: 'Egyesült Királyság beli',
@@ -295,6 +296,7 @@
                 HU: 'magyar',
                 HR: 'horvát',
                 IE: 'ír',
+                IS: 'izlandi',
                 IT: 'olasz',
                 LT: 'litván',
                 LU: 'luxemburgi',

+ 2 - 0
dist/js/language/it_IT.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Il codice nazione %s non e supportato',
             country: 'Si prega di inserire un numero di telefono valido in %s',
             countries: {
+                BR: 'Brasile',
                 ES: 'Spagna',
                 FR: 'Francia',
                 GB: 'Regno Unito',
@@ -295,6 +296,7 @@
                 HU: 'Ungheria',
                 HR: 'Croazia',
                 IE: 'Irlanda',
+                IS: 'Islanda',
                 IT: 'Italia',
                 LT: 'Lituania',
                 LU: 'Lussemburgo',

+ 2 - 0
dist/js/language/pl_PL.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Kod kraju %s nie jest wspierany',
             country: 'Wprowadź poprawny numer telefonu w kraju %s',
             countries: {
+                BR: 'Brazylia',
                 ES: 'Hiszpania',
                 FR: 'Francja',
                 GB: 'Wielka Brytania',
@@ -295,6 +296,7 @@
                 HU: 'węgierski',
                 HR: 'chorwacki',
                 IE: 'irlandzki',
+                IS: 'Islandia',
                 IT: 'włoski',
                 LT: 'litewski',
                 LU: 'luksemburski',

+ 3 - 1
dist/js/language/pt_BR.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'O código de país %s não é suportado',
             country: 'Por favor insira um número de telefone válido %s',
             countries: {
+                BR: 'Brasil',
                 ES: 'Espanha',
                 FR: 'França',
                 GB: 'Reino Unido',
@@ -295,7 +296,8 @@
                 HU: 'Húngaro',
                 HR: 'Croata',
                 IE: 'irlandês',
-                TI: 'Italiano',
+                IS: 'Islândia',
+                IT: 'Italiano',
                 LT: 'Lituânia',
                 LU: 'Luxemburgo',
                 LV: 'Letão',

+ 2 - 0
dist/js/language/tr_TR.js

@@ -228,6 +228,7 @@
             countryNotSupported: '%s ülke kodu desteklenmemektedir',
             country: '%s de geçerli bir telefon numarası giriniz',
             countries: {
+                BR: 'Brezilya',
                 ES: 'İspanya',
                 FR: 'Fransa',
                 GB: 'İngiltere',
@@ -295,6 +296,7 @@
                 HU: 'Macar',
                 HR: 'Hırvat',
                 IE: 'Irlandalı',
+                IS: 'İzlanda',
                 IT: 'Italyan',
                 LT: 'Litvanyalı',
                 LU: 'Lüksemburglu',

+ 2 - 0
dist/js/language/vi_VN.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Mã quốc gia %s không được hỗ trợ',
             country: 'Vui lòng nhập số điện thoại hợp lệ của %s',
             countries: {
+                BR: 'Brazil',
                 ES: 'Tây Ban Nha',
                 FR: 'Pháp',
                 GB: 'Vương quốc Anh',
@@ -295,6 +296,7 @@
                 HU: 'Hungari',
                 HR: 'Croatia',
                 IE: 'Ireland',
+                IS: 'Iceland',
                 IT: 'Ý',
                 LT: 'Lithuania',
                 LU: 'Luxembourg',

+ 2 - 0
dist/js/language/zh_CN.js

@@ -228,6 +228,7 @@
             countryNotSupported: '不支援该国家代码%s',
             country: '请输入有效的 %s 电话号码',
             countries: {
+                BR: '巴西',
                 ES: '西班牙',
                 GB: '英国',
                 FR: '法国',
@@ -295,6 +296,7 @@
                 HU: '匈牙利',
                 HR: '克罗地亚',
                 IE: '爱尔兰',
+                IS: '冰岛',
                 IT: '意大利',
                 LT: '立陶宛',
                 LU: '卢森堡',

+ 2 - 0
dist/js/language/zh_TW.js

@@ -228,6 +228,7 @@
             countryNotSupported: '不支援該國家代碼 %s',
             country: '請輸入有效的 %s 電話號碼',
             countries: {
+                BR: '巴西',
                 ES: '西班牙',
                 FR: '法國',
                 GB: '英國',
@@ -295,6 +296,7 @@
                 HU: '匈牙利',
                 HR: '克羅地亞',
                 IE: '愛爾蘭',
+                IS: '冰島',
                 IT: '意大利',
                 LT: '立陶宛',
                 LU: '盧森堡',

+ 1 - 0
src/js/language/be_NL.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'De land code %s is niet ondersteund',
             country: 'Geef een geldig telefoon nummer van %s',
             countries: {
+                BR: 'Brazilië',
                 ES: 'Spanje',
                 FR: 'Frankrijk',
                 GB: 'Verenigd Koninkrijk',

+ 1 - 0
src/js/language/bg_BG.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Държавата %s не се поддържа',
             country: 'Моля, въведете валиден телефонен номер в %s',
             countries: {
+                BR: 'Бразилия',
                 ES: 'Испания',
                 FR: 'Франция',
                 GB: 'Великобритания',

+ 1 - 0
src/js/language/cs_CZ.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Telefoní číslo pro %s není podporované',
             country: 'Prosím zadejte správné telefoní číslo pro %s',
             countries: {
+                BR: 'Brazílii',
                 ES: 'Španělsko',
                 FR: 'Francii',
                 GB: 'Velkou Británii',

+ 1 - 0
src/js/language/da_DK.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Landekoden %s understøttes desværre ikke',
             country: 'Udfyld venligst dette felt med et gyldigt telefonnummer i %s',
             countries: {
+                BR: 'Brasilien',
                 ES: 'Spanien',
                 FR: 'Frankrig',
                 GB: 'England',

+ 1 - 0
src/js/language/de_DE.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Der Ländercode %s wird nicht unterstützt',
             country: 'Bitte valide Telefonnummer für %s eingeben',
             countries: {
+                BR: 'Brasilien',
                 ES: 'Spanien',
                 FR: 'Frankreich',
                 GB: 'Vereinigtes Königreich',

+ 1 - 0
src/js/language/en_US.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'The country code %s is not supported',
             country: 'Please enter a valid phone number in %s',
             countries: {
+                BR: 'Brazil',
                 ES: 'Spain',
                 FR: 'France',
                 GB: 'United Kingdom',

+ 1 - 0
src/js/language/es_CL.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'El código del país %s no está soportado',
             country: 'Por favor ingrese un número válido de teléfono en %s',
             countries: {
+                BR: 'Brasil',
                 ES: 'España',
                 FR: 'Francia',
                 GB: 'Reino Unido',

+ 1 - 0
src/js/language/es_ES.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'El código del país %s no está soportado',
             country: 'Por favor introduce un número válido de teléfono en %s',
             countries: {
+                BR: 'Brasil',
                 ES: 'España',
                 FR: 'Francia',
                 GB: 'Reino Unido',

+ 1 - 0
src/js/language/fr_FR.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Le code de pays %s n\'est pas accepté',
             country: 'Veuillez fournir un numéro de téléphone valide pour %s',
             countries: {
+                BR: 'Brésil',
                 ES: 'las Espagne',
                 FR: 'la France',
                 GB: 'le Royaume Uni',

+ 1 - 0
src/js/language/gr_EL.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Ο κωδικός χώρας %s δεν υποστηρίζεται',
             country: 'Παρακαλώ εισάγετε ένα έγκυρο αριθμό τηλεφώνου στην %s',
             countries: {
+                BR: 'Βραζιλία',
                 ES: 'Ισπανία',
                 FR: 'Γαλλία',
                 GB: 'Ηνωμένο Βασίλειο',

+ 1 - 0
src/js/language/hu_HU.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'A(z) %s országkód nem támogatott',
             country: 'Kérlek, hogy érvényes %s telefonszámot adj meg',
             countries: {
+                BR: 'brazil',
                 ES: 'spanyol',
                 FR: 'francia',
                 GB: 'Egyesült Királyság beli',

+ 1 - 0
src/js/language/it_IT.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Il codice nazione %s non e supportato',
             country: 'Si prega di inserire un numero di telefono valido in %s',
             countries: {
+                BR: 'Brasile',
                 ES: 'Spagna',
                 FR: 'Francia',
                 GB: 'Regno Unito',

+ 1 - 0
src/js/language/pl_PL.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Kod kraju %s nie jest wspierany',
             country: 'Wprowadź poprawny numer telefonu w kraju %s',
             countries: {
+                BR: 'Brazylia',
                 ES: 'Hiszpania',
                 FR: 'Francja',
                 GB: 'Wielka Brytania',

+ 1 - 0
src/js/language/pt_BR.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'O código de país %s não é suportado',
             country: 'Por favor insira um número de telefone válido %s',
             countries: {
+                BR: 'Brasil',
                 ES: 'Espanha',
                 FR: 'França',
                 GB: 'Reino Unido',

+ 1 - 0
src/js/language/tr_TR.js

@@ -228,6 +228,7 @@
             countryNotSupported: '%s ülke kodu desteklenmemektedir',
             country: '%s de geçerli bir telefon numarası giriniz',
             countries: {
+                BR: 'Brezilya',
                 ES: 'İspanya',
                 FR: 'Fransa',
                 GB: 'İngiltere',

+ 1 - 0
src/js/language/vi_VN.js

@@ -228,6 +228,7 @@
             countryNotSupported: 'Mã quốc gia %s không được hỗ trợ',
             country: 'Vui lòng nhập số điện thoại hợp lệ của %s',
             countries: {
+                BR: 'Brazil',
                 ES: 'Tây Ban Nha',
                 FR: 'Pháp',
                 GB: 'Vương quốc Anh',

+ 1 - 0
src/js/language/zh_CN.js

@@ -228,6 +228,7 @@
             countryNotSupported: '不支援该国家代码%s',
             country: '请输入有效的 %s 电话号码',
             countries: {
+                BR: '巴西',
                 ES: '西班牙',
                 GB: '英国',
                 FR: '法国',

+ 1 - 0
src/js/language/zh_TW.js

@@ -228,6 +228,7 @@
             countryNotSupported: '不支援該國家代碼 %s',
             country: '請輸入有效的 %s 電話號碼',
             countries: {
+                BR: '巴西',
                 ES: '西班牙',
                 FR: '法國',
                 GB: '英國',

+ 9 - 30
src/js/validator/phone.js

@@ -4,11 +4,11 @@
         countryNotSupported: 'The country code %s is not supported',
         country: 'Please enter a valid phone number in %s',
         countries: {
+            BR: 'Brazil',
             ES: 'Spain',
             FR: 'France',
             GB: 'United Kingdom',
-            US: 'USA',
-            BR: 'Brazil'
+            US: 'USA'
         }
     });
 
@@ -19,7 +19,7 @@
         },
 
         // The supported countries
-        COUNTRY_CODES: ['ES', 'FR', 'GB', 'US', 'BR'],
+        COUNTRY_CODES: ['BR', 'ES', 'FR', 'GB', 'US'],
 
         /**
          * Return true if the input value contains a valid phone number for the country
@@ -58,6 +58,12 @@
 
             var isValid = true;
             switch (country.toUpperCase()) {
+                case 'BR':
+                    // Test: http://regexr.com/399m1
+                    value   = $.trim(value);
+                    isValid = (/^(([\d]{4}[-.\s]{1}[\d]{3}[-.\s]{1}[\d]{4})|((\(?\+?[0-9]{2}\)?\s?)?(\(?\d{2}\)?\s?)?\d{4,5}[-.\s]?\d{4}))$/).test(value);
+                    break;
+
                 case 'ES':
                     // http://regex101.com/r/rB9mA9/1
                     value   = $.trim(value);
@@ -77,33 +83,6 @@
             		isValid = (/^\(?(?:(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?\(?(?:0\)?[\s-]?\(?)?|0)(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}|\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4}|\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3})|\d{5}\)?[\s-]?\d{4,5}|8(?:00[\s-]?11[\s-]?11|45[\s-]?46[\s-]?4\d))(?:(?:[\s-]?(?:x|ext\.?\s?|\#)\d+)?)$/).test(value);
                     break;
                 
-                case 'BR':
-                    // Test: http://regexr.com/399m1
-                    /*
-                     *  0800-000-0000
-                     *  0800 000 0000
-                     *  0800.000.0000
-                     *  08000000000
-                     *  1692089-4635
-                     *  16920894635
-                     *  16992089-4635
-                     *  16 99202-4635
-                     *  (16)99202-4635
-                     *  (16)92089-4635
-                     *  (16) 92089-4635
-                     *  (15) 4343-4343
-                     *  +55 15 3702-7523
-                     *  (+55) 15 3702-7523
-                     *  (+55)1537027523
-                     *  (+55)(15)3702-7523
-                     *  (+55) 15 3702-7523
-                     *  (+55) 15 99202-7523
-                     *  99202-4635
-                     */
-                    value   = $.trim(value);
-                    isValid = (/^(([\d]{4}[-.\s]{1}[\d]{3}[-.\s]{1}[\d]{4})|((\(?\+?[0-9]{2}\)?\s?)?(\(?\d{2}\)?\s?)?\d{4,5}[-.\s]?\d{4}))$/).test(value);
-                    break;
-
                 case 'US':
                 /* falls through */
                 default: