Skip to content

QuioteNumberFormatter

The number formatter will format numbers according to a given format

class QuioteNumberFormatter extends DecimalFormatter implements ITranslator

ExtendsDecimalFormatter
ImplementsITranslator
Since1.0.0
SourceTranslation/QuioteNumberFormatter.php
MethodDescription
getContext(): ?ContextRetrieve the current application context.
initialize(Context $context, array<string, mixed> $parameters = []): voidInitialize this Translator.
localeChanged(QuioteLocale $newLocale): voidThis method gets called by the translation manager when the default locale has been changed.
reset(): voidReset per-request locale state for worker compatibility.
translate(mixed $message, string $domain, ?QuioteLocale $locale = null): stringTranslates a message into the defined language.

final public function getContext(): ?Context

Retrieve the current application context.

Returns ?Context — The current Context instance.

public function initialize(Context $context, array<string, mixed> $parameters = []): void

Initialize this Translator.

An associative array of initialization parameters

ParameterTypeDescription
$contextContextThe current application context.
$parametersarray``<``string``, ``mixed``>An associative array of initialization parameters

public function localeChanged(QuioteLocale $newLocale): void

This method gets called by the translation manager when the default locale has been changed.

The new default locale.

ParameterTypeDescription
$newLocaleQuioteLocaleThe new default locale.

public function reset(): void

Reset per-request locale state for worker compatibility.

context, customFormat and translationDomain are configured once from initialize() parameters and never restored afterward — clearing them here would silently fall back to the hardcoded default number format for every subsequent request. Only locale (and the derived format fields cleared by parent::reset(), which localeChanged() always recomputes) are per-request.

public function translate(mixed $message, string $domain, ?QuioteLocale $locale = null): string

Translates a message into the defined language.

The locale to which the message should be translated.

ParameterTypeDescription
$messagemixedThe message to be translated.
$domainstringThe domain of the message.
$locale?QuioteLocaleThe locale to which the message should be translated.

Returns string — The translated message.

These come from an ancestor and are documented where they are declared.

MethodDeclared inDescription
formatCurrency()DecimalFormatterFormats the given currency and returns the formatted result.
formatNumber()DecimalFormatterFormats the given number and returns the formatted result.
getFormat()DecimalFormatterReturns the format which is currently used to format numbers.
getRoundingMode()DecimalFormatterReturns the rounding mode.
getRoundingModeFromString()DecimalFormatterMaps a string rounding mode definition to the rounding mode constants.
parse()DecimalFormatterParses a string into float or int.
setFormat()DecimalFormatterSets the format to be used for formatting numbers.
setRoundingMode()DecimalFormatterSets the rounding mode.