You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Shaopeng Jia 6f875ace84 Update JS project to Java version r53. Patch submitted by tronikos. 16 years ago
..
i18n/phonenumbers Update JS project to Java version r53. Patch submitted by tronikos. 11 years ago
README Update JS project to Java version r53. Patch submitted by tronikos. 11 years ago

README

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 53).
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 following JavaScript functions in
javascript/i18n/phonenumbers/phonenumberutil.js:
i18n.phonenumbers.PhoneNumberDesc.prototype.exactlySameAs(other)
i18n.phonenumbers.PhoneNumber.prototype.exactlySameAs(other)
c. Manually update the toJsArray() Java methods in
/java/resources/com/google/i18n/phonenumbers/BuildMetadataJsonFromXml.java

2. If the phone number metadata in the XML format has changed
(java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml)
run the following commands to regenerate metadata.js and
metadatafortesting.js:

ant -f java/build.xml
java -cp java/build/classes \
com.google.i18n.phonenumbers.BuildMetadataJsonFromXml \
java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml \
javascript/i18n/phonenumbers/metadata.js false
java -cp java/build/classes \
com.google.i18n.phonenumbers.BuildMetadataJsonFromXml \
java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml \
javascript/i18n/phonenumbers/metadatalite.js true
java -cp java/build/classes \
com.google.i18n.phonenumbers.BuildMetadataJsonFromXml \
java/resources/com/google/i18n/phonenumbers/test/PhoneNumberMetaDataForTesting.xml \
javascript/i18n/phonenumbers/metadatafortesting.js false

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