A Symfony bundle of the Intl-Format wrapper library for PHP intl messages. This bundle is currently in development and might introduce BC breaks.
You can install it with Composer.
composer require senseexception/intl-format-bundle
If the composer installation with symfony/flex didn't already register the bundle, you need to register it into your bundles.php manually:
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Budgegeria\Bundle\IntlFormatBundle\BudgegeriaIntlFormatBundle::class => ['all' => true],
// ...
];
By default a configuration doesn't need to be added if the needed locale is en_US
and USD
the currency. For any other
locale or currency you can add the following configuration to your project and configure the needed locale and currency
values:
budgegeria_intl_format:
locale: 'de_DE'
currency: 'EUR'
IntlFormatBundle implements the functionality of Intl-Format and provides Twig extensions for using the documented type specifiers of the library.
Internationalization text formatting:
{{ "This is the %ordinal time that the number %integer appear"|intl_format(4, 6000) }}
{# This is the 4th time that the number 6.000 appear #}
Internationalization text formatting:
{{ intl_format("This is the %ordinal time that the number %integer appear", 4, 6000) }}
{# This is the 4th time that the number 6.000 appear #}
Currency symbol of configured locale:
{{ currency_symbol() }}
{# € #}