func loadInternationalFormat()

in builder.go [153:178]


func loadInternationalFormat(metadata *PhoneMetadata, numberFormatElement *NumberFormatE, nationalFormat *NumberFormat) bool {
	intlFormat := &NumberFormat{}
	intlFormatPattern := numberFormatElement.InternationalFormat
	hasExplicitIntlFormatDefined := false

	if len(intlFormatPattern) > 1 {
		panic("Invalid number of intlFormat patterns for country: " + metadata.GetId())

	} else if len(intlFormatPattern) == 0 {
		// Default to use the same as the national pattern if none is defined.
		intlFormat.merge(nationalFormat)
	} else {
		intlFormat.Pattern = sp(numberFormatElement.Pattern)
		setLeadingDigitsPatterns(numberFormatElement, intlFormat)
		intlFormatPatternValue := intlFormatPattern[0]
		if intlFormatPatternValue != "NA" {
			intlFormat.Format = sp(intlFormatPatternValue)
		}
		hasExplicitIntlFormatDefined = true
	}

	if intlFormat.Format != nil {
		metadata.IntlNumberFormat = append(metadata.IntlNumberFormat, intlFormat)
	}
	return hasExplicitIntlFormatDefined
}