blob: b2a42717cf7632775f782489dfe84b028b5bf7a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
Info:
=====
Google's JavaScript library for parsing, formatting, and validating
international phone numbers.
How to setup:
=============
1. Checkout closure-library next to libphonenumber:
e.g.
svn checkout http://libphonenumber.googlecode.com/svn/trunk/ ~/src/libphonenumber
svn checkout http://closure-library.googlecode.com/svn/trunk/ ~/src/closure-library
(Or change the path of the <script src=""> in the html pages to point to
wherever base.js is located.)
2. Run the unit tests to make sure everything is working. Open the following
pages with your web browser:
javascript/i18n/phonenumbers/phonenumberutil_test.html
javascript/i18n/phonenumbers/asyoutypeformatter_test.html
3. Run the demo: javascript/i18n/phonenumbers/demo.html
How to update:
==============
The JavaScript library is ported from the Java implementation (revision 524).
When the Java project gets updated follow these steps to update the JavaScript
project:
1. If the protocol buffers (phonemetadata.proto and phonenumber.proto)
have changed:
a. Manually update the .pb.js files with the changes of the .proto files.
b. Manually update the toJsArray() Java methods in
tools/java/java-build/src/com/google/i18n/phonenumbers/BuildMetadataJsonFromXml.java
c. Build tools/java/java-build/target/java-build-1.0-SNAPSHOT-jar-with-dependencies.jar
by running:
mvn -f tools/java/java-build/pom.xml package
2. If the phone number metadata in the XML format has changed
(resources/PhoneNumberMetaData.xml)
run the following commands to regenerate metadata.js and
metadatafortesting.js:
ant -f java/build.xml build-js-metadata
3. Manually port any changes of the Java code to the JavaScript code:
PhoneNumberUtil.java => phonenumberutil.js
AsYouTypeFormatter.java => asyoutypeformatter.js
PhoneNumberUtilTest.java => phonenumberutil_test.js
AsYouTypeFormatterTest.java => asyoutypeformatter_test.js
TODO:
=====
Port functionality to extract phone-numbers from text (findNumbers).
Port offline phone number geocoder.
Enable PhoneNumberUtil to handle all digits, rather than a subset
(JavaScript has no equivalent to the Java Character.digit).
Port ShortNumberUtil.
|