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