Civil Date PHP Package

Locale
in package

AbstractYes

Represents a regional locale and its localization services.

A locale controls localized era names, month names, weekday names, seasons, number words, numeral parsing, text direction, and the first day of the week.

Tags
see
LocaleBuilder
LocaleRegistry

Table of Contents

Properties

$languageTag  : string
Locale language tag containing a language and optional region.

Methods

abbreviatedDayOfWeekFromName()  : DayOfWeek|null
Parses a localized abbreviated day-of-week name.
abbreviatedDayOfWeekName()  : string
Formats an abbreviated day-of-week name.
abbreviatedEraFromName()  : Calendar|null
Parses a localized abbreviated era display name.
abbreviatedEraName()  : string
Formats an abbreviated era display name.
abbreviatedMonthFromName()  : int|null
Parses a localized abbreviated month name.
abbreviatedMonthName()  : string
Formats an abbreviated month name.
customizeFor()  : LocaleBuilder
Creates a locale builder for another language tag using this locale's behavior.
dayOfWeekFromName()  : DayOfWeek|null
Parses a localized day-of-week name.
dayOfWeekName()  : string
Formats a day-of-week name.
eraFromName()  : Calendar|null
Parses a localized era display name.
eraName()  : string
Formats an era display name.
isRightToLeft()  : bool
Returns whether formatted output uses right-to-left text direction.
languageTag()  : string
Returns the locale language tag.
localize()  : string
Returns application-specific localized text for a custom key.
monthFromName()  : int|null
Parses a localized month name.
monthName()  : string
Formats a month name.
numberLocalizer()  : NumberLocalizer
Returns the number localizer used by this locale.
seasonFromName()  : Season|null
Parses a localized season name.
seasonName()  : string
Formats a season name.
textNormalizer()  : TextNormalizer
Returns the text normalizer used by this locale.
__construct()  : mixed
Creates a locale definition.

Properties

$languageTag read-only

Locale language tag containing a language and optional region.

protected string $languageTag

Methods

abbreviatedMonthFromName()

Parses a localized abbreviated month name.

public abbreviatedMonthFromName(Calendar $calendar, string $name) : int|null
Parameters
$calendar : Calendar

Calendar identifier.

$name : string

Localized abbreviated month name.

Tags
see
Locale::abbreviatedMonthName()
Locale::monthFromName()
Return values
int|null

Matching month number, or null when unrecognized.

abbreviatedMonthName()

Formats an abbreviated month name.

public abbreviatedMonthName(Calendar $calendar, int $month) : string
Parameters
$calendar : Calendar

Calendar identifier.

$month : int

Month number.

Tags
see
Locale::abbreviatedMonthFromName()
Locale::monthName()
Return values
string

Localized abbreviated month name, or the full month name when abbreviations are unsupported.

customizeFor()

Creates a locale builder for another language tag using this locale's behavior.

public customizeFor(string $languageTag) : LocaleBuilder

The custom locale inherits all behavior from this locale unless the builder overrides a specific value.

Parameters
$languageTag : string

Language tag for the customized locale.

Tags
see
LocaleBuilder::build()
CustomLocale
Return values
LocaleBuilder

Locale builder initialized from this locale.

eraFromName()

Parses a localized era display name.

public abstract eraFromName(string $name) : Calendar|null
Parameters
$name : string

Localized era name.

Tags
see
Locale::eraName()
Return values
Calendar|null

Matching calendar, or null when unrecognized.

eraName()

Formats an era display name.

public abstract eraName(Calendar $calendar) : string
Parameters
$calendar : Calendar

Calendar identifier.

Tags
see
Locale::eraFromName()
Return values
string

Localized era name.

isRightToLeft()

Returns whether formatted output uses right-to-left text direction.

public abstract isRightToLeft() : bool
Return values
bool

True for right-to-left output; false for left-to-right output.

languageTag()

Returns the locale language tag.

public languageTag() : string
Return values
string

Locale language tag.

localize()

Returns application-specific localized text for a custom key.

public localize(string $key) : string
Parameters
$key : string

Custom localization key.

Return values
string

Localized text, or the key when no localization is defined.

seasonFromName()

Parses a localized season name.

public abstract seasonFromName(string $name) : Season|null
Parameters
$name : string

Localized season name.

Tags
see
Locale::seasonName()
Return values
Season|null

Matching season, or null when unrecognized.

textNormalizer()

Returns the text normalizer used by this locale.

public abstract textNormalizer() : TextNormalizer
Return values
TextNormalizer

Locale text normalizer.

__construct()

Creates a locale definition.

protected __construct(string $languageTag) : mixed
Parameters
$languageTag : string

Locale language tag containing a language and optional region.

Tags
throws
InvalidArgumentException

If the language tag is invalid.

On this page

Search results