Browse Source

Fix markdown preview

pull/813/head
Ante Lucic 10 years ago
parent
commit
b5ce6e6f13
1 changed files with 45 additions and 60 deletions
  1. +45
    -60
      javascript/README.md

+ 45
- 60
javascript/README.md View File

@ -6,50 +6,44 @@ international phone numbers.
How to setup:
=============
1. Checkout closure-library, closure-compiler, closure-linter and python-gflags
next to libphonenumber:
1. Checkout closure-library, closure-compiler, closure-linter and python-gflags next to libphonenumber:
e.g.
git clone https://github.com/googlei18n/libphonenumber/
git clone https://github.com/google/closure-library/
git clone https://github.com/google/closure-compiler.git
svn checkout http://closure-linter.googlecode.com/svn/trunk/ ~/src/closure-linter
svn checkout http://python-gflags.googlecode.com/svn/trunk/ ~/src/python-gflags
* `git clone https://github.com/googlei18n/libphonenumber/`
(If you don't checkout the dependencies next to libphonenumber:
a. change the path of the <script src=""> in the html pages to point to wherever
base.js is located
b. update javascript/build.xml with the correct paths)
* `git clone https://github.com/google/closure-library/`
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
* `git clone https://github.com/google/closure-compiler.git`
3. Run the demo: javascript/i18n/phonenumbers/demo.html
* `svn checkout http://closure-linter.googlecode.com/svn/trunk/ ~/src/closure-linter`
* `svn checkout http://python-gflags.googlecode.com/svn/trunk/ ~/src/python-gflags`
How to compile:
===============
1. Build Closure's compiler.jar:
If you don't checkout the dependencies next to libphonenumber:
1. Change the path of the `<script src="">` in the html pages to point to wherever base.js is located
2. Update `javascript/build.xml` with the correct paths
3. 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`
e.g.
ant -f ~/src/closure-compiler/build.xml
4. Run the demo: `javascript/i18n/phonenumbers/demo.html`
2. Compile the demo.js and all its dependencies to one file: demo-compiled.js:
ant -f javascript/build.xml compile-demo
How to compile:
===============
1. Build Closure's compiler.jar:
`ant -f ~/src/closure-compiler/build.xml`
3. Run the compiled demo: javascript/i18n/phonenumbers/demo-compiled.html
2. Compile the demo.js and all its dependencies to one file: `demo-compiled.js`:
`ant -f javascript/build.xml compile-demo`
3. Run the compiled demo: `javascript/i18n/phonenumbers/demo-compiled.html`
How to use:
===========
To use and compile the library in your own project, use the
javascript/i18n/phonenumbers/demo.js as an example. You will need to
goog.exportSymbol all the methods you use in your html so that the compiler
won't rename them. You can then invoke the compiler similarly to how the
compile-demo ant target in javascript/build.xml invokes it.
To use and compile the library in your own project, use the `javascript/i18n/phonenumbers/demo.js` as an example. You will need to goog.exportSymbol all the methods you use in your html so that the compiler won't rename them. You can then invoke the compiler similarly to how the compile-demo ant target in `javascript/build.xml` invokes it.
How to update:
@ -58,44 +52,35 @@ The JavaScript library is ported from the Java implementation (revision 536).
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
1. If the protocol buffers (phonemetadata.proto and phonenumber.proto) have changed:
* Manually update the .pb.js files with the changes of the .proto files.
* Manually update the toJsArray() Java methods in tools/java/java-build/src/com/google/i18n/phonenumbers/BuildMetadataJsonFromXml.java
* 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`:
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`
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
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
4. Run the Closure Compiler to get your changes syntax and type checked. This will also generate `demo-compiled.js` used by `demo-compiler.html`
4. Run the Closure Compiler to get your changes syntax and type checked.
This will also generate demo-compiled.js used by demo-compiler.html
(TODO: Use target "compile" rather than "compile-demo" once
visibility issues for getExtractedNationalPrefix_ have been resolved):
(TODO: Use target "compile" rather than "compile-demo" once visibility issues for getExtractedNationalPrefix_ have been resolved):
ant -f javascript/build.xml compile-demo
`ant -f javascript/build.xml compile-demo`
5. Run the Closure Linter to lint the JavaScript files:
5. Run the Closure Linter to lint the JavaScript files:
ant -f javascript/build.xml lint
`ant -f javascript/build.xml lint`
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 ShortNumberInfo.
1. Port functionality to extract phone-numbers from text (findNumbers).
2. Port offline phone number geocoder.
3. Enable PhoneNumberUtil to handle all digits, rather than a subset (JavaScript has no equivalent to the Java Character.digit).
4. Port ShortNumberInfo.

Loading…
Cancel
Save