ttacon / libphonenumber

golang port of Google's libphonenumber
MIT License
619 stars 106 forks source link

[Question] Any plan to port PhoneNumberToTimeZonesMapper? #30

Open fabriziomoscon opened 8 years ago

fabriziomoscon commented 8 years ago

I would like to map a phonenumber to the relative timezone. The Google Java/Javascript library allows it. It would be good to have it in go as well.

The original file is this one: https://github.com/googlei18n/libphonenumber/blob/3ea1359a3e41bbb0a90ec253c00ba41712fb736b/java/geocoder/src/com/google/i18n/phonenumbers/PhoneNumberToTimeZonesMapper.java

I can help with a PR if @ttacon could provide me with some basic instructions. For example how to import the binary data for the timezone...

Please let me know what is the best way to proceed.

ttacon commented 8 years ago

Cool! PRs are always welcome! I don't have a ton of spare time to do this myself, but you should probably grab the binary data from the C project - the Java libphonenumber project data is encoded in Java's Object[Input|Output] format. From that, it's just generating whatever protobuf structures (I'm assuming it's protobufs) that are required to extract the necessary data.

fabriziomoscon commented 8 years ago

@ttacon there is no *.proto files for timezones. I have only found this map: https://github.com/googlei18n/libphonenumber/blob/3ea1359a3e41bbb0a90ec253c00ba41712fb736b/resources/timezones/map_data.txt

I can see you generated the *.pb.go files from: https://github.com/googlei18n/libphonenumber/blob/3ea1359a3e41bbb0a90ec253c00ba41712fb736b/resources/phonemetadata.proto https://github.com/googlei18n/libphonenumber/blob/3ea1359a3e41bbb0a90ec253c00ba41712fb736b/resources/phonenumber.proto

but I would need to implement a map like this one: https://github.com/ttacon/libphonenumber/blob/master/countrycodetoregionmap.go

unless there are reasons not to do so