QuioteNumberFormatter
The number formatter will format numbers according to a given format
Synopsis
Section titled “Synopsis”class QuioteNumberFormatter extends DecimalFormatter implements ITranslator
| Extends | DecimalFormatter |
| Implements | ITranslator |
| Since | 1.0.0 |
| Source | Translation/QuioteNumberFormatter.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
getContext(): ?Context | Retrieve the current application context. |
initialize(Context $context, array<string, mixed> $parameters = []): void | Initialize this Translator. |
localeChanged(QuioteLocale $newLocale): void | This method gets called by the translation manager when the default locale has been changed. |
reset(): void | Reset per-request locale state for worker compatibility. |
translate(mixed $message, string $domain, ?QuioteLocale $locale = null): string | Translates a message into the defined language. |
getContext()
Section titled “getContext()”final public function getContext(): ?Context
Retrieve the current application context.
Returns ?Context — The current Context instance.
initialize()
Section titled “initialize()”public function initialize(Context $context, array<string, mixed> $parameters = []): void
Initialize this Translator.
An associative array of initialization parameters
| Parameter | Type | Description |
|---|---|---|
$context | Context | The current application context. |
$parameters | array``<``string``, ``mixed``> | An associative array of initialization parameters |
localeChanged()
Section titled “localeChanged()”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.
| Parameter | Type | Description |
|---|---|---|
$newLocale | QuioteLocale | The new default locale. |
reset()
Section titled “reset()”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.
translate()
Section titled “translate()”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.
| Parameter | Type | Description |
|---|---|---|
$message | mixed | The message to be translated. |
$domain | string | The domain of the message. |
$locale | ?QuioteLocale | The locale to which the message should be translated. |
Returns string — The translated message.
Inherited methods
Section titled “Inherited methods”These come from an ancestor and are documented where they are declared.
| Method | Declared in | Description |
|---|---|---|
formatCurrency() | DecimalFormatter | Formats the given currency and returns the formatted result. |
formatNumber() | DecimalFormatter | Formats the given number and returns the formatted result. |
getFormat() | DecimalFormatter | Returns the format which is currently used to format numbers. |
getRoundingMode() | DecimalFormatter | Returns the rounding mode. |
getRoundingModeFromString() | DecimalFormatter | Maps a string rounding mode definition to the rounding mode constants. |
parse() | DecimalFormatter | Parses a string into float or int. |
setFormat() | DecimalFormatter | Sets the format to be used for formatting numbers. |
setRoundingMode() | DecimalFormatter | Sets the rounding mode. |