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