Package

ViewHelpers

ViewHelper Documentation

format.currency

Formats a given float to a currency representation.

= Examples =

<f:format.currency>123.456</f:format.currency> 123,46

<f:format.currency currencySign="$" decimalSeparator="." thousandsSeparator="," prependCurrency="false", separateCurrency="true", decimals="2">54321</f:format.currency> 54,321.00 $

{someNumber -> f:format.currency(thousandsSeparator: ',', currencySign: '')} 54,321,00 (depending on the value of {someNumber})

{someNumber -> f:format.currency(currencySign: '', forceLocale: true)} 54.321,00 (depending on the value of {someNumber} and the current locale)

{someNumber -> f:format.currency(currencySign: 'EUR', forceLocale: 'de_DE')} 54.321,00 EUR (depending on the value of {someNumber})

{someNumber -> f:format.currency(currencySign: '', prependCurrency: 'true')} 54.321,00 (depending on the value of {someNumber})

{someNumber -> f:format.currency(currencySign: '', separateCurrency: 'false', decimals: '0')} 54.321 (depending on the value of {someNumber})

Note: This ViewHelper is intended to help you with formatting numbers into monetary units. Complex calculations and/or conversions should be done before the number is passed.

Also be aware that if the `locale is set, all arguments except for the currency sign (which then becomes mandatory) are ignored and the CLDR (Common Locale Data Repository) is used for formatting. Fore more information about localization see section Internationalization & Localization Framework` in the Flow documentation.

Additionally, if `currencyCode` is set, rounding and decimal digits are replaced by the rules for the respective currency (e.g. JPY never has decimal digits, CHF is rounded using 5 decimals.)

Arguments

forceLocale anySimpleType

Whether if, and what, Locale should be used. May be boolean, string or \Neos\Flow\I18n\Locale

currencySign string

(optional) The currency sign, eg $ or .

decimalSeparator string

(optional) The separator for the decimal point.

thousandsSeparator string

(optional) The thousands separator.

prependCurrency boolean

(optional) Indicates if currency symbol should be placed before or after the numeric value.

separateCurrency boolean

(optional) Indicates if a space character should be placed between the number and the currency sign.

decimals integer

(optional) The number of decimal places.

currencyCode string

(optional) The ISO 4217 currency code of the currency to format. Used to set decimal places and rounding.

ViewHelper Resources

Schema Resources