File: making-metadata-changes.md

package info (click to toggle)
libphonenumber 8.12.57%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 99,276 kB
  • sloc: cpp: 52,362; xml: 48,242; javascript: 31,137; java: 29,151; ansic: 482; jsp: 228; sh: 44; makefile: 24
file content (85 lines) | stat: -rw-r--r-- 2,461 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# How to make metadata changes

## Introduction

These steps outline how to edit the metadata for the phone number library to fix
problems with validation or formatting.

Note that we cannot accept pull requests to modify metadata directly, but you may
use these guidelines to create changes in your own fork until we fix issues
upstream. Please [file a corresponding issue](CONTRIBUTING.md#checklist-before-filing-an-issue)
with us.

You can read more about the pull request [contribution guidelines](CONTRIBUTING.md#pull-requests).

## Details

### Edit the data

Edit the appropriate files:

*   `resources/PhoneNumberMetadata.xml` for normal validation / formatting
    issues
*   `resources/ShortNumberMetadata.xml` for short-code data
*   `resources/PhoneNumberAlternateFormats.xml` for alternate patterns for phone
    number matching
*   `resources/geocoding/xx` for geocoding data (where `xx` is the language code
    you wish to edit)
*   `resources/carrier/xx` for carrier mapping data

Note:

*   To track provenance for your own maintenance needs, consider including
    sources for data where appropriate
*   If multiple countries share a country calling code, check all of them are
    updated. Formatting rules will only be listed by the country with
    `mainCountryForCode` set to `true`.
*   Details on each field in the xml file can be found at the top of the file
    and in `resources/phonemetadata.proto`.

### Generate data files

#### Java

```
ant -f java/build.xml junit
```

This will generate new binary files under
`java/libphonenumber/src/com/google/i18n/phonenumbers/data`,
`geocoder/src/com/google/i18n/phonenumbers/carrier/data`, and
`geocoder/src/com/google/i18n/phonenumbers/geocoding/data`.

#### Javascript

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

This will generate new js metadata files; you should also now compile the
changes, as per the instructions in `javascript/README`.

#### C++

See the [C++
README](http://github.com/google/libphonenumber/blob/master/cpp/README)
instructions for how to build and run C++. You should build it with
`USE_LITE_METADATA` set to `ON` as well as `OFF`, which will generate both a
`metadata.cc` and a `metadata_lite.cc` file.

### Test changes

#### Java

Build a jar:

```
ant -f java/build.xml jar
```

Then [run your own demo](run-java-demo.md) and test your changes are as
expected.

#### Javascript

See `javascript/README` for how to run the demo page in your browser.