__('Selected country', 'give'),
// Screen reader text for when no country is selected
'noCountrySelected' => __('No country selected', 'give'),
// Aria label for the country list element
'countryListAriaLabel' => __('List of countries', 'give'),
// Placeholder for the search input in the dropdown (when countrySearch enabled)
'searchPlaceholder' => __('Search', 'give'),
// Screen reader text for when the search produces no results
'zeroSearchResults' => __('No results found', 'give'),
// Screen reader text for when the search produces 1 result
'oneSearchResult' => __('1 result found', 'give'),
// Screen reader text for when the search produces multiple results, where ${count} will be replaced by the count
'multipleSearchResults' => __('${count} results found', 'give'),
]);
return $i18n;
}
/**
* @since 3.9.0
*/
public static function getErrorMap(): array
{
return [
__('Invalid number.', 'give'),
__('Invalid country code.', 'give'),
__('Invalid number: too short.', 'give'),
__('Invalid number: too long.', 'give'),
__('Invalid number.', 'give'),
];
}
/**
* @since 3.9.0
*/
public static function getInitialCountry(): string
{
return strtolower(give_get_country());
}
/**
* @since 3.9.0
*/
public static function getShowSelectedDialCode(): bool
{
return true;
}
/**
* @since 3.9.0
*/
public static function getStrictMode(): bool
{
return true;
}
/**
* @since 3.9.0
*/
public static function getUseFullscreenPopup(): bool
{
return false;
}
/**
* @since 3.9.0
*/
public static function getSettings(): array
{
return [
'initialCountry' => self::getInitialCountry(),
'showSelectedDialCode' => self::getShowSelectedDialCode(),
'strictMode' => self::getStrictMode(),
'i18n' => self::getI18n(),
'cssUrl' => self::getCssUrl(),
'scriptUrl' => self::getScriptUrl(),
'utilsScriptUrl' => self::getUtilsScriptUrl(),
'errorMap' => self::getErrorMap(),
'useFullscreenPopup' => self::getUseFullscreenPopup(),
];
}
/**
* @since 4.16.4 Escaped the value attribute output.
* @since 3.9.0
*/
public static function getHtmlInput(string $value, string $id, string $class = '', string $name = ''): string
{
if (empty($name)) {
$name = $id;
}
ob_start();
?>