geocoding

package
v2.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Port of java/geocoder/src/com/google/i18n/phonenumbers/geocoding/PhoneNumberOfflineGeocoder.java.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDescriptionForNumber

func GetDescriptionForNumber(number *phonenumbers.PhoneNumber, lang string) (string, error)

GetDescriptionForNumber returns a text description in the given language for the given phone number: the name of the geographical area it is from for geographical numbers, otherwise the name of the country, and the empty string for numbers of an unknown type.

func GetDescriptionForNumberForUserRegion

func GetDescriptionForNumberForUserRegion(number *phonenumbers.PhoneNumber, lang string, userRegion string) (string, error)

GetDescriptionForNumberForUserRegion is as per GetDescriptionForValidNumberForUserRegion but explicitly checks the validity of the number passed in.

func GetDescriptionForValidNumber

func GetDescriptionForValidNumber(number *phonenumbers.PhoneNumber, lang string) (string, error)

GetDescriptionForValidNumber returns a text description in the given language for the geographical area the number is from, falling back to the country name. The number is assumed to be valid.

func GetDescriptionForValidNumberForUserRegion

func GetDescriptionForValidNumberForUserRegion(number *phonenumbers.PhoneNumber, lang string, userRegion string) (string, error)

GetDescriptionForValidNumberForUserRegion is as per GetDescriptionForValidNumber but also considers the region of the user. If the phone number is from the same region as the user, only a lower-level description will be returned, if one exists. Otherwise, the phone number's region will be returned, with optionally some more detailed information.

For example, for a user from the region "US" (United States), we would show "Mountain View, CA" for a particular number, omitting the United States from the description. For a user from the United Kingdom (region "GB"), for the same number we may show "Mountain View, CA, United States" or even just "United States". The number is assumed to be valid. userRegion should be a two-letter upper-case CLDR region code.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL