ソースを参照

#510: Add French phone number validator, thanks to @dlucazeau

phuoc 11 年 前
コミット
f550a12285

+ 1 - 0
CHANGELOG.md

@@ -6,6 +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): The [phone](http://bootstrapvalidator.com/validators/phone/) validator now supports French phone number, thanks to [@dlucazeau](https://github.com/dlucazeau)
 
 __Improvements__
 

+ 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-07-19 9:08:03 AM
+ * @version     v0.5.1-dev, built on 2014-07-19 9:22:12 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

+ 9 - 2
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-07-19 9:08:03 AM
+ * @version     v0.5.1-dev, built on 2014-07-19 9:22:12 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
@@ -4512,6 +4512,7 @@
         country: 'Please enter a valid phone number in %s',
         countries: {
             GB: 'United Kingdom',
+            FR: 'France',
             US: 'USA'
         }
     });
@@ -4523,7 +4524,7 @@
         },
 
         // The supported countries
-        COUNTRY_CODES: ['GB', 'US'],
+        COUNTRY_CODES: ['GB', 'FR', 'US'],
 
         /**
          * Return true if the input value contains a valid phone number for the country
@@ -4570,6 +4571,12 @@
             		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 'FR':
+                    // http://regexr.com/395dq
+                    value   = $.trim(value);
+                    isValid = (/^(?:(?:(?:\+|00)33\D?(?:\D?\(0\)\D?)?)|0){1}[1-9]{1}(?:\D?\d{2}){4}$/).test(value);
+                    break;
+
                 case 'US':
                 /* falls through */
                 default:

ファイルの差分が大きいため隠しています
+ 3 - 3
dist/js/bootstrapValidator.min.js


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

@@ -229,6 +229,7 @@
             country: 'Geef een geldig telefoon nummer van %s',
             countries: {
                 GB: 'Verenigd Koninkrijk',
+                FR: 'Frankrijk',
                 US: 'VS'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Моля, въведете валиден телефонен номер в %s',
             countries: {
                 GB: 'Великобритания',
+                FR: 'Франция',
                 US: 'САЩ'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Prosím zadejte správné telefoní číslo pro %s',
             countries: {
                 GB: 'Velkou Británii',
+                FR: 'Francii',
                 US: 'Spojené Státy Americké'
             }
         },

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

@@ -228,8 +228,9 @@
             countryNotSupported: 'Der Ländercode %s wird nicht unterstützt',
             country: 'Bitte valide Telefonnummer für %s eingeben',
             countries: {
-                GB: 'United Kingdom',
-                US: 'USA'
+                GB: 'Vereinigtes Königreich',
+                FR: 'Frankreich',
+                US: 'Vereinigte Staaten'
             }
         },
         regexp: {

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

@@ -229,6 +229,7 @@
             country: 'Please enter a valid phone number in %s',
             countries: {
                 GB: 'United Kingdom',
+                FR: 'France',
                 US: 'USA'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Por favor ingrese un número válido de teléfono en %s',
             countries: {
                 GB: 'Reino Unido',
+                FR: 'Francia',
                 US: 'EE.UU.'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Veuillez fournir un numéro de téléphone valide pour %s',
             countries: {
                 GB: 'le Royaume Uni',
+                FR: 'la France',
                 US: 'les USA'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Kérlek, hogy érvényes %s telefonszámot adj meg',
             countries: {
                 GB: 'Egyesült Királyság beli',
+                FR: 'francia',
                 US: 'Egyesült Államok beli'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Wprowadź poprawny numer telefonu w kraju %s',
             countries: {
                 GB: 'Wielka Brytania',
+                FR: 'Francja',
                 US: 'USA'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Vui lòng nhập số điện thoại hợp lệ của %s',
             countries: {
                 GB: 'Vương quốc Anh',
+                FR: 'Pháp',
                 US: 'Mỹ'
             }
         },

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

@@ -229,7 +229,8 @@
             country: '请输入有效的 %s 电话号码',
             countries: {
                 GB: '英国',
-                US: '美国'
+                FR: '法国',
+                US: '美国'
             }
         },
         regexp: {

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

@@ -229,6 +229,7 @@
             country: '請輸入有效的 %s 電話號碼',
             countries: {
                 GB: '英國',
+                FR: '法國',
                 US: '美國'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Geef een geldig telefoon nummer van %s',
             countries: {
                 GB: 'Verenigd Koninkrijk',
+                FR: 'Frankrijk',
                 US: 'VS'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Моля, въведете валиден телефонен номер в %s',
             countries: {
                 GB: 'Великобритания',
+                FR: 'Франция',
                 US: 'САЩ'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Prosím zadejte správné telefoní číslo pro %s',
             countries: {
                 GB: 'Velkou Británii',
+                FR: 'Francii',
                 US: 'Spojené Státy Americké'
             }
         },

+ 3 - 2
src/js/language/de_DE.js

@@ -228,8 +228,9 @@
             countryNotSupported: 'Der Ländercode %s wird nicht unterstützt',
             country: 'Bitte valide Telefonnummer für %s eingeben',
             countries: {
-                GB: 'United Kingdom',
-                US: 'USA'
+                GB: 'Vereinigtes Königreich',
+                FR: 'Frankreich',
+                US: 'Vereinigte Staaten'
             }
         },
         regexp: {

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

@@ -229,6 +229,7 @@
             country: 'Please enter a valid phone number in %s',
             countries: {
                 GB: 'United Kingdom',
+                FR: 'France',
                 US: 'USA'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Por favor ingrese un número válido de teléfono en %s',
             countries: {
                 GB: 'Reino Unido',
+                FR: 'Francia',
                 US: 'EE.UU.'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Veuillez fournir un numéro de téléphone valide pour %s',
             countries: {
                 GB: 'le Royaume Uni',
+                FR: 'la France',
                 US: 'les USA'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Kérlek, hogy érvényes %s telefonszámot adj meg',
             countries: {
                 GB: 'Egyesült Királyság beli',
+                FR: 'francia',
                 US: 'Egyesült Államok beli'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Wprowadź poprawny numer telefonu w kraju %s',
             countries: {
                 GB: 'Wielka Brytania',
+                FR: 'Francja',
                 US: 'USA'
             }
         },

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

@@ -229,6 +229,7 @@
             country: 'Vui lòng nhập số điện thoại hợp lệ của %s',
             countries: {
                 GB: 'Vương quốc Anh',
+                FR: 'Pháp',
                 US: 'Mỹ'
             }
         },

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

@@ -229,7 +229,8 @@
             country: '请输入有效的 %s 电话号码',
             countries: {
                 GB: '英国',
-                US: '美国'
+                FR: '法国',
+                US: '美国'
             }
         },
         regexp: {

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

@@ -229,6 +229,7 @@
             country: '請輸入有效的 %s 電話號碼',
             countries: {
                 GB: '英國',
+                FR: '法國',
                 US: '美國'
             }
         },

+ 2 - 2
src/js/validator/phone.js

@@ -17,7 +17,7 @@
         },
 
         // The supported countries
-        COUNTRY_CODES: ['GB', 'FR', US'],
+        COUNTRY_CODES: ['GB', 'FR', 'US'],
 
         /**
          * Return true if the input value contains a valid phone number for the country
@@ -66,7 +66,7 @@
 
                 case 'FR':
                     // http://regexr.com/395dq
-                    value = $.trim(value);
+                    value   = $.trim(value);
                     isValid = (/^(?:(?:(?:\+|00)33\D?(?:\D?\(0\)\D?)?)|0){1}[1-9]{1}(?:\D?\d{2}){4}$/).test(value);
                     break;