Class \Prado\I18N\TNumberFormat
The format used for numbers can be selected by specifying the Type attribute. The known types are "decimal", "currency", "percentage", "scientific", "spellout", "ordinal" and "duration"
If someone from US want to see sales figures from a store in Germany (say using the EURO currency), formatted using the german currency, you would need to use the attribute Culture="de_DE" to get the currency right, e.g. 100,00. The decimal and grouping separator is then also from the de_DE locale. This may lead to some confusion because people from US know the "," as thousand separator. Therefore a "Currency" attribute is available, so that the output from the following example results in 100.00.
<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" />
Class hierarchy
- \Prado\I18N\TNumberFormat implements IDataRenderer
- \Prado\I18N\TI18NControl
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Author: Fabio Bas <ctrlaltca[at]gmail[dot]com>
public
|
|
public
|
getData() : string
Get the numberic value for this control.
This method is required by IDataRenderer. It is the same as getValue(). |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
setCurrency(string $currency) : mixed
Set the 3-letter ISO 4217 code. For example, the code
"USD" represents the US Dollar and "EUR" represents the Euro currency.
|
public
|
setData(string $value) : mixed
Set the numberic value for this control.
This method is required by IDataRenderer. It is the same as setValue(). |
public
|
|
public
|
|
public
|
|
public
|
|
protected
|
getFormattedValue() : string
Formats the localized number, be it currency or decimal, or percentage.
If the culture is not specified, the default application culture will be used. |
protected
|
getFormatter(string $culture, mixed $type) : NumberFormatter
Formats the localized number, be it currency or decimal, or percentage.
If the culture is not specified, the default application culture will be used. |