libphonenumber-csharp / javascript /

Filename Size Date modified Message
2.2 KB
Google's JavaScript library for parsing, formatting, and validating
international phone numbers.

How to setup:
1.  Checkout closure-library next to libphonenumber:

svn checkout ~/src/libphonenumber
svn checkout ~/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:

3.  Run the demo: javascript/i18n/phonenumbers/demo.html

How to update:
The JavaScript library is ported from the Java implementation (revision 469).
When the Java project gets updated follow these steps to update the JavaScript

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
  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
    run the following commands to regenerate metadata.js and

    ant -f java/build.xml build-js-metadata

3.  Manually port any changes of the Java code to the JavaScript code: => phonenumberutil.js => asyoutypeformatter.js => phonenumberutil_test.js => asyoutypeformatter_test.js

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.