• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# How to make metadata changes
2
3## Introduction
4
5These steps outline how to edit the metadata for the phone number library to fix
6problems with validation or formatting.
7
8Note that we are currently not accepting validation, formatting, or timezone
9metadata pull requests, but you may use these guidelines to create changes in
10your own fork until we fix issues upstream. Please [file a corresponding
11issue](CONTRIBUTING.md#checklist-before-filing-an-issue) with us.
12
13You can read more about the pull request [contribution
14guidelines](CONTRIBUTING.md#pull-requests).
15
16## Details
17
18### Edit the data
19
20Edit the appropriate files:
21
22*   `resources/PhoneNumberMetadata.xml` for normal validation / formatting
23    issues
24*   `resources/ShortNumberMetadata.xml` for short-code data
25*   `resources/PhoneNumberAlternateFormats.xml` for alternate patterns for phone
26    number matching
27*   `resources/geocoding/xx` for geocoding data (where `xx` is the language code
28    you wish to edit)
29*   `resources/carrier/xx` for carrier mapping data
30
31Note:
32
33*   To track provenance for your own maintenance needs, consider including
34    sources for data where appropriate
35*   If multiple countries share a country calling code, check all of them are
36    updated. Formatting rules will only be listed by the country with
37    `mainCountryForCode` set to `true`.
38*   Details on each field in the xml file can be found at the top of the file
39    and in `resources/phonemetadata.proto`.
40
41### Generate data files
42
43#### Java
44
45```
46ant -f java/build.xml junit
47```
48
49This will generate new binary files under
50`java/libphonenumber/src/com/google/i18n/phonenumbers/data`,
51`geocoder/src/com/google/i18n/phonenumbers/carrier/data`, and
52`geocoder/src/com/google/i18n/phonenumbers/geocoding/data`.
53
54#### Javascript
55
56```
57ant -f java/build.xml build-js-metadata
58```
59
60This will generate new js metadata files; you should also now compile the
61changes, as per the instructions in `javascript/README`.
62
63#### C++
64
65See the [C++
66README](http://github.com/google/libphonenumber/blob/master/cpp/README)
67instructions for how to build and run C++. You should build it with
68`USE_LITE_METADATA` set to `ON` as well as `OFF`, which will generate both a
69`metadata.cc` and a `metadata_lite.cc` file.
70
71### Test changes
72
73#### Java
74
75Build a jar:
76
77```
78ant -f java/build.xml jar
79```
80
81Then [run your own demo](run-java-demo.md) and test your changes are as
82expected.
83
84#### Javascript
85
86See `javascript/README` for how to run the demo page in your browser.
87