phonelib 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +11 -2
- data/data/extended_data.dat +0 -0
- data/data/libphonenumber/FAQ.md +166 -0
- data/data/libphonenumber/README.md +1 -1
- data/data/libphonenumber/cpp/CMakeLists.txt +16 -3
- data/data/libphonenumber/cpp/src/phonenumbers/lite_metadata.cc +9337 -9341
- data/data/libphonenumber/cpp/src/phonenumbers/metadata.cc +9948 -9951
- data/data/libphonenumber/cpp/src/phonenumbers/short_metadata.cc +1285 -1280
- data/data/libphonenumber/debian/control +1 -1
- data/data/libphonenumber/java/carrier/pom.xml +4 -4
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/225_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/234_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/235_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/251_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/675_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/91_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/993_en +0 -0
- data/data/libphonenumber/java/demo/pom.xml +6 -6
- data/data/libphonenumber/java/demo/src/com/google/phonenumbers/PhoneNumberParserServlet.java +4 -3
- data/data/libphonenumber/java/geocoder/pom.xml +4 -4
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1380_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1825_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/212_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/46_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/config +0 -0
- data/data/libphonenumber/java/internal/prefixmapper/pom.xml +3 -3
- data/data/libphonenumber/java/libphonenumber/pom.xml +2 -2
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/MultiFileMetadataSourceImpl.java +9 -1
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java +2 -2
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AG +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AI +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AS +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BB +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BM +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BS +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BW +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CA +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CK +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DJ +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DM +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DO +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GD +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GM +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GU +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JM +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KN +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KY +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LC +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MA +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MP +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MS +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NA +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NG +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PG +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PR +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SE +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SK +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SX +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TC +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TD +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TM +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TT +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VC +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VG +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VI +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_KR +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_PT +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/SingleFilePhoneNumberMetadataProto +0 -0
- data/data/libphonenumber/java/pom.xml +1 -1
- data/data/libphonenumber/java/release_notes.txt +47 -7
- data/data/libphonenumber/javascript/i18n/phonenumbers/demo-compiled.js +171 -169
- data/data/libphonenumber/javascript/i18n/phonenumbers/metadata.js +61 -57
- data/data/libphonenumber/javascript/i18n/phonenumbers/metadatalite.js +61 -57
- data/data/libphonenumber/resources/PhoneNumberMetadata.xml +165 -155
- data/data/libphonenumber/resources/ShortNumberMetadata.xml +41 -7
- data/data/libphonenumber/resources/carrier/en/225.txt +1 -0
- data/data/libphonenumber/resources/carrier/en/234.txt +15 -4
- data/data/libphonenumber/resources/carrier/en/235.txt +1 -0
- data/data/libphonenumber/resources/carrier/en/251.txt +1 -0
- data/data/libphonenumber/resources/carrier/en/675.txt +6 -5
- data/data/libphonenumber/resources/carrier/en/91.txt +1 -0
- data/data/libphonenumber/resources/carrier/en/993.txt +1 -0
- data/data/libphonenumber/resources/geocoding/en/1.txt +2 -0
- data/data/libphonenumber/resources/geocoding/en/212.txt +1 -0
- data/data/libphonenumber/resources/geocoding/en/46.txt +15 -0
- data/data/libphonenumber/resources/geocoding/fr/212.txt +1 -0
- data/data/libphonenumber/resources/phonemetadata.proto +1 -1
- data/data/libphonenumber/tools/java/common/src/com/google/i18n/phonenumbers/BuildMetadataFromXml.java +4 -5
- data/data/libphonenumber/tools/java/cpp-build/target/cpp-build-1.0-SNAPSHOT-jar-with-dependencies.jar +0 -0
- data/data/libphonenumber/tools/java/data/pom.xml +1 -1
- data/data/libphonenumber/tools/java/java-build/target/java-build-1.0-SNAPSHOT-jar-with-dependencies.jar +0 -0
- data/data/phone_data.dat +0 -0
- data/lib/phonelib/core.rb +13 -0
- data/lib/phonelib/phone.rb +10 -4
- data/lib/phonelib/version.rb +1 -1
- metadata +5 -12
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1726_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1730_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1838_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1851_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1888_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/225_fr +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/238_pt +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/242_fr +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/269_fr +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/55_pt +0 -0
@@ -5659,7 +5659,10 @@
|
|
5659
5659
|
2[01389]|
|
5660
5660
|
3(?:
|
5661
5661
|
2|
|
5662
|
-
|
5662
|
+
3[039]|
|
5663
|
+
45|
|
5664
|
+
66|
|
5665
|
+
88|
|
5663
5666
|
9[18]
|
5664
5667
|
)|
|
5665
5668
|
82
|
@@ -5687,9 +5690,11 @@
|
|
5687
5690
|
<nationalNumberPattern>
|
5688
5691
|
1(?:
|
5689
5692
|
17|
|
5690
|
-
|
5693
|
+
2[139]|
|
5691
5694
|
3(?:
|
5692
|
-
|
5695
|
+
3[09]|
|
5696
|
+
66|
|
5697
|
+
88|
|
5693
5698
|
9[18]
|
5694
5699
|
)|
|
5695
5700
|
82
|
@@ -5703,10 +5708,11 @@
|
|
5703
5708
|
1(?:
|
5704
5709
|
1[78]|
|
5705
5710
|
28|
|
5711
|
+
330|
|
5706
5712
|
82
|
5707
5713
|
)
|
5708
5714
|
</nationalNumberPattern>
|
5709
|
-
<possibleNumberPattern>\d{3}</possibleNumberPattern>
|
5715
|
+
<possibleNumberPattern>\d{3,4}</possibleNumberPattern>
|
5710
5716
|
<exampleNumber>118</exampleNumber>
|
5711
5717
|
</tollFree>
|
5712
5718
|
</territory>
|
@@ -7825,17 +7831,45 @@
|
|
7825
7831
|
<!-- http://www.anacom.pt/render.jsp?categoryId=279098 -->
|
7826
7832
|
<territory id="PT">
|
7827
7833
|
<generalDesc>
|
7828
|
-
<nationalNumberPattern>1\d{2}</nationalNumberPattern>
|
7829
|
-
<possibleNumberPattern>\d{3}</possibleNumberPattern>
|
7834
|
+
<nationalNumberPattern>1\d{2,5}</nationalNumberPattern>
|
7835
|
+
<possibleNumberPattern>\d{3,6}</possibleNumberPattern>
|
7830
7836
|
</generalDesc>
|
7831
7837
|
<shortCode>
|
7832
|
-
<nationalNumberPattern>
|
7838
|
+
<nationalNumberPattern>
|
7839
|
+
11(?:
|
7840
|
+
[2578]|
|
7841
|
+
6(?:
|
7842
|
+
000|
|
7843
|
+
111
|
7844
|
+
)
|
7845
|
+
)
|
7846
|
+
</nationalNumberPattern>
|
7833
7847
|
<exampleNumber>112</exampleNumber>
|
7834
7848
|
</shortCode>
|
7835
7849
|
<emergency>
|
7836
7850
|
<nationalNumberPattern>11[25]</nationalNumberPattern>
|
7837
7851
|
<exampleNumber>112</exampleNumber>
|
7838
7852
|
</emergency>
|
7853
|
+
<expandedEmergency>
|
7854
|
+
<nationalNumberPattern>
|
7855
|
+
116(?:
|
7856
|
+
000|
|
7857
|
+
111
|
7858
|
+
)
|
7859
|
+
</nationalNumberPattern>
|
7860
|
+
<possibleNumberPattern>\d{6}</possibleNumberPattern>
|
7861
|
+
<exampleNumber>116000</exampleNumber>
|
7862
|
+
</expandedEmergency>
|
7863
|
+
<tollFree>
|
7864
|
+
<nationalNumberPattern>
|
7865
|
+
116(?:
|
7866
|
+
000|
|
7867
|
+
111
|
7868
|
+
)
|
7869
|
+
</nationalNumberPattern>
|
7870
|
+
<possibleNumberPattern>\d{6}</possibleNumberPattern>
|
7871
|
+
<exampleNumber>116000</exampleNumber>
|
7872
|
+
</tollFree>
|
7839
7873
|
</territory>
|
7840
7874
|
|
7841
7875
|
<!-- Palau -->
|
@@ -12,6 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
# NITEL and Mtel are brand names of the same consortium. They are merged under
|
16
|
+
# NATCOM, and as of Nov 2015 are known as Ntel.
|
17
|
+
|
15
18
|
234173|Starcomms
|
16
19
|
234174|Starcomms
|
17
20
|
2341804|Starcomms
|
@@ -136,18 +139,23 @@
|
|
136
139
|
2346987|Starcomms
|
137
140
|
2346988|Starcomms
|
138
141
|
2346989|Starcomms
|
139
|
-
|
140
|
-
|
142
|
+
234701|Airtel
|
143
|
+
2347020|Smile
|
144
|
+
2347021|Ntel
|
145
|
+
2347022|Ntel
|
146
|
+
2347023|Zoom
|
147
|
+
2347024|Prestel
|
141
148
|
2347025|Visafone
|
142
149
|
2347026|Visafone
|
150
|
+
2347027|Multilinks
|
143
151
|
2347028|Starcomms
|
144
152
|
2347029|Starcomms
|
145
153
|
234703|MTN
|
146
154
|
234704|Visafone
|
147
155
|
234705|Glo
|
148
156
|
234706|MTN
|
149
|
-
234707|Glo
|
150
157
|
234708|Airtel
|
158
|
+
234709|Multilinks
|
151
159
|
2347380|Starcomms
|
152
160
|
2347381|Starcomms
|
153
161
|
2347382|Starcomms
|
@@ -167,9 +175,11 @@
|
|
167
175
|
2347782|Starcomms
|
168
176
|
2347783|Starcomms
|
169
177
|
2347784|Starcomms
|
178
|
+
2348010|Megatech
|
179
|
+
2348011|Megatech
|
170
180
|
234802|Airtel
|
171
181
|
234803|MTN
|
172
|
-
234804|
|
182
|
+
234804|Ntel
|
173
183
|
234805|Glo
|
174
184
|
234806|MTN
|
175
185
|
234807|Glo
|
@@ -241,6 +251,7 @@
|
|
241
251
|
234902|Airtel
|
242
252
|
234903|MTN
|
243
253
|
234905|Glo
|
254
|
+
234908|Etisalat
|
244
255
|
234909|Etisalat
|
245
256
|
234980|Starcomms
|
246
257
|
234987|Starcomms
|
@@ -13,17 +13,18 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
# http://www.itu.int/oth/T02020000A4/en
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
# but most online sources including the company's own web site still refer to bmobile.
|
16
|
+
# bmobile changed its name in 2009 to bemobile, which is the name used in the
|
17
|
+
# ITU document, but most online sources including the company's own web site
|
18
|
+
# still refer to bmobile.
|
20
19
|
|
21
20
|
67520150|bmobile/Telikom
|
22
21
|
67570|Digicel
|
23
22
|
67571|Digicel
|
24
23
|
67572|Digicel
|
25
24
|
67573|Digicel
|
25
|
+
67574|Digicel
|
26
|
+
67575|bmobile
|
26
27
|
67576|bmobile
|
27
28
|
675775|Telikom
|
29
|
+
67578|Telikom
|
28
30
|
67579|Digicel
|
29
|
-
|
@@ -8567,6 +8567,7 @@
|
|
8567
8567
|
1361994|Corpus Christi, TX
|
8568
8568
|
1364|Kentucky
|
8569
8569
|
1365|Ontario
|
8570
|
+
1380|Ohio
|
8570
8571
|
1385|Utah
|
8571
8572
|
1386|Florida
|
8572
8573
|
1386218|Orange City, FL
|
@@ -29141,6 +29142,7 @@
|
|
29141
29142
|
1819983|Saint-André-Avellin, QC
|
29142
29143
|
1819985|Thurso, QC
|
29143
29144
|
1819986|Gatineau, QC
|
29145
|
+
1825|Alberta
|
29144
29146
|
1828|North Carolina
|
29145
29147
|
1828210|Asheville, NC
|
29146
29148
|
1828213|Asheville, NC
|
@@ -36,6 +36,7 @@
|
|
36
36
|
46159|Mariefred
|
37
37
|
4616|Eskilstuna-Torshälla
|
38
38
|
46171|Enköping
|
39
|
+
46173|Öregrund-Östhammar
|
39
40
|
46174|Alunda
|
40
41
|
46175|Hallstavik-Rimbo
|
41
42
|
46176|Norrtälje
|
@@ -45,10 +46,12 @@
|
|
45
46
|
46220|Hallstahammar-Surahammar
|
46
47
|
46221|Köping
|
47
48
|
46222|Skinnskatteberg
|
49
|
+
46223|Fagersta-Norberg
|
48
50
|
46224|Sala-Heby
|
49
51
|
46225|Hedemora-Säter
|
50
52
|
46226|Avesta-Krylbo
|
51
53
|
46227|Kungsör
|
54
|
+
4623|Falun
|
52
55
|
46240|Ludvika-Smedjebacken
|
53
56
|
46241|Gagnef-Floda
|
54
57
|
46243|Borlänge
|
@@ -58,6 +61,7 @@
|
|
58
61
|
46250|Mora-Orsa
|
59
62
|
46251|Älvdalen
|
60
63
|
46253|Idre-Särna
|
64
|
+
46258|Furudal
|
61
65
|
4626|Gävle-Sandviken
|
62
66
|
46270|Söderhamn
|
63
67
|
46271|Alfta-Edsbyn
|
@@ -73,7 +77,9 @@
|
|
73
77
|
46297|Ockelbo-Hamrånge
|
74
78
|
46300|Kungsbacka
|
75
79
|
46301|Hindås
|
80
|
+
46302|Lerum
|
76
81
|
46303|Kungälv
|
82
|
+
46304|Orust-Tjörn
|
77
83
|
4631|Gothenburg
|
78
84
|
46320|Kinna
|
79
85
|
46321|Ulricehamn
|
@@ -134,6 +140,7 @@
|
|
134
140
|
46492|Vimmerby
|
135
141
|
46493|Gamleby
|
136
142
|
46494|Kisa
|
143
|
+
46495|Hultsfred-Virserum
|
137
144
|
46496|Mariannelund
|
138
145
|
46498|Gotland
|
139
146
|
46499|Mönsterås
|
@@ -147,6 +154,7 @@
|
|
147
154
|
46510|Lidköping
|
148
155
|
46511|Skara-Götene
|
149
156
|
46512|Vara-Nossebro
|
157
|
+
46513|Herrljunga
|
150
158
|
46514|Grästorp
|
151
159
|
46515|Falköping
|
152
160
|
46520|Trollhättan
|
@@ -168,6 +176,7 @@
|
|
168
176
|
46552|Deje
|
169
177
|
46553|Molkom
|
170
178
|
46554|Kil
|
179
|
+
46555|Grums
|
171
180
|
46560|Torsby
|
172
181
|
46563|Hagfors-Munkfors
|
173
182
|
46564|Sysslebäck
|
@@ -181,6 +190,7 @@
|
|
181
190
|
46583|Askersund
|
182
191
|
46584|Laxå
|
183
192
|
46585|Fjugesta-Svartå
|
193
|
+
46586|Karlskoga-Degerfors
|
184
194
|
46587|Nora
|
185
195
|
46589|Arboga
|
186
196
|
46590|Filipstad
|
@@ -221,6 +231,7 @@
|
|
221
231
|
46691|Torpshammar
|
222
232
|
46692|Liden
|
223
233
|
46693|Bräcke-Gällö
|
234
|
+
46695|Stugun
|
224
235
|
46696|Hammarstrand
|
225
236
|
468|Stockholm
|
226
237
|
4690|Umeå
|
@@ -228,6 +239,7 @@
|
|
228
239
|
46911|Piteå
|
229
240
|
46912|Byske
|
230
241
|
46913|Lövånger
|
242
|
+
46914|Burträsk
|
231
243
|
46915|Bastuträsk
|
232
244
|
46916|Jörn
|
233
245
|
46918|Norsjö
|
@@ -249,14 +261,17 @@
|
|
249
261
|
46940|Vilhelmina
|
250
262
|
46941|Åsele
|
251
263
|
46942|Dorotea
|
264
|
+
46943|Fredrika
|
252
265
|
46950|Lycksele
|
253
266
|
46951|Storuman
|
254
267
|
46952|Sorsele
|
255
268
|
46953|Malå
|
256
269
|
46954|Tärnaby
|
270
|
+
46960|Arvidsjaur
|
257
271
|
46961|Arjeplog
|
258
272
|
46970|Gällivare
|
259
273
|
46971|Jokkmokk
|
274
|
+
46973|Porjus
|
260
275
|
46975|Hakkas
|
261
276
|
46976|Vuollerim
|
262
277
|
46977|Korpilombolo
|
@@ -82,7 +82,7 @@ message NumberFormat {
|
|
82
82
|
// commonly seen this number written by people without the leading 0, for
|
83
83
|
// example as (20) XXXX XXXX, this field would be set to true. This will be
|
84
84
|
// inherited from the value set for the territory in the XML file, unless a
|
85
|
-
//
|
85
|
+
// national_prefix_optional_when_formatting is defined specifically for this
|
86
86
|
// NumberFormat.
|
87
87
|
optional bool national_prefix_optional_when_formatting = 6;
|
88
88
|
|
@@ -294,10 +294,10 @@ public class BuildMetadataFromXml {
|
|
294
294
|
}
|
295
295
|
|
296
296
|
/**
|
297
|
-
*
|
298
|
-
*
|
299
|
-
*
|
300
|
-
*
|
297
|
+
* Extracts the available formats from the provided DOM element. If it does not contain any
|
298
|
+
* nationalPrefixFormattingRule, the one passed-in is retained; similarly for
|
299
|
+
* nationalPrefixOptionalWhenFormatting. The nationalPrefix, nationalPrefixFormattingRule and
|
300
|
+
* nationalPrefixOptionalWhenFormatting values are provided from the parent (territory) element.
|
301
301
|
*/
|
302
302
|
// @VisibleForTesting
|
303
303
|
static void loadAvailableFormats(PhoneMetadata metadata,
|
@@ -324,7 +324,6 @@ public class BuildMetadataFromXml {
|
|
324
324
|
} else {
|
325
325
|
format.nationalPrefixFormattingRule = nationalPrefixFormattingRule;
|
326
326
|
}
|
327
|
-
|
328
327
|
if (numberFormatElement.hasAttribute(NATIONAL_PREFIX_OPTIONAL_WHEN_FORMATTING)) {
|
329
328
|
format.nationalPrefixOptionalWhenFormatting =
|
330
329
|
Boolean.valueOf(numberFormatElement.getAttribute(
|
Binary file
|
Binary file
|
data/data/phone_data.dat
CHANGED
Binary file
|
data/lib/phonelib/core.rb
CHANGED
@@ -77,6 +77,19 @@ module Phonelib
|
|
77
77
|
@@parse_special = special
|
78
78
|
end
|
79
79
|
|
80
|
+
# strict check for validator, doesn't sanitize number
|
81
|
+
@@strict_check = false
|
82
|
+
|
83
|
+
# getter for strict check flag
|
84
|
+
def strict_check
|
85
|
+
@@strict_check
|
86
|
+
end
|
87
|
+
|
88
|
+
# setter for strict check flag
|
89
|
+
def strict_check=(strict)
|
90
|
+
@@strict_check = strict
|
91
|
+
end
|
92
|
+
|
80
93
|
# gem constants definition
|
81
94
|
|
82
95
|
# Main data file
|
data/lib/phonelib/phone.rb
CHANGED
@@ -34,7 +34,11 @@ module Phonelib
|
|
34
34
|
|
35
35
|
# method to get sanitized phone number (only numbers)
|
36
36
|
def sanitized
|
37
|
-
@sanitized
|
37
|
+
@sanitized = if Phonelib.strict_check
|
38
|
+
@original
|
39
|
+
else
|
40
|
+
@original && @original.gsub(/[^0-9]+/, '') || ''
|
41
|
+
end
|
38
42
|
end
|
39
43
|
|
40
44
|
# Returns all phone types that matched valid patterns
|
@@ -135,21 +139,23 @@ module Phonelib
|
|
135
139
|
end
|
136
140
|
|
137
141
|
# Returns formatted national number
|
138
|
-
def national
|
142
|
+
def national(formatted = true)
|
139
143
|
return @national_number unless valid?
|
140
144
|
format_match, format_string = get_formatting_data
|
141
145
|
|
142
146
|
if format_match
|
143
|
-
format_string.gsub(/\$\d/) { |el| format_match[el[1].to_i] }
|
147
|
+
out = format_string.gsub(/\$\d/) { |el| format_match[el[1].to_i] }
|
148
|
+
formatted ? out : out.gsub(/[^0-9]/, '')
|
144
149
|
else
|
145
150
|
@national_number
|
146
151
|
end
|
147
152
|
end
|
148
153
|
|
149
154
|
# Returns e164 formatted phone number
|
150
|
-
def international
|
155
|
+
def international(formatted = true)
|
151
156
|
return nil if sanitized.nil? || sanitized.empty?
|
152
157
|
return "+#{sanitized}" unless valid?
|
158
|
+
return "#{@data[country][Core::COUNTRY_CODE]}#{@national_number}" unless formatted
|
153
159
|
|
154
160
|
format = @data[country][:format]
|
155
161
|
if matches = @national_number.match(/#{format[Core::PATTERN]}/)
|