https://github.com/senseexception/intlformatbundle
A Symfony bundle of the IntlFormat wrapper library for PHP intl messages
https://github.com/senseexception/intlformatbundle
formatter icu internationalization intl intl-format php-intl-messages sprintf symfony-bundle timezone
Last synced: 6 months ago
JSON representation
A Symfony bundle of the IntlFormat wrapper library for PHP intl messages
- Host: GitHub
- URL: https://github.com/senseexception/intlformatbundle
- Owner: SenseException
- License: mit
- Created: 2016-04-11T22:04:21.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-03-08T19:50:55.000Z (7 months ago)
- Last Synced: 2025-03-29T15:34:34.248Z (6 months ago)
- Topics: formatter, icu, internationalization, intl, intl-format, php-intl-messages, sprintf, symfony-bundle, timezone
- Language: PHP
- Homepage:
- Size: 102 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IntlFormatBundle
A Symfony bundle of the [Intl-Format wrapper library](https://github.com/SenseException/intl-format) for PHP intl messages.
This bundle is currently in development and might introduce BC breaks.[](https://packagist.org/packages/senseexception/intl-format-bundle)
[](https://packagist.org/packages/senseexception/intl-format-bundle)
[](https://github.com/SenseException/IntlFormatBundle/actions/workflows/tests.yml)
[](https://github.com/SenseException/IntlFormatBundle/actions/workflows/static-analysis.yml)
[](https://packagist.org/packages/senseexception/intl-format-bundle)## Installation
You can install it with [Composer](https://getcomposer.org/).
```
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:``` php
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Budgegeria\Bundle\IntlFormatBundle\BudgegeriaIntlFormatBundle::class => ['all' => true],
// ...
];
```## Configuration
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:``` yaml
budgegeria_intl_format:
locale: 'de_DE'
currency: 'EUR'
```## Usage
IntlFormatBundle implements the functionality of [Intl-Format](http://senseexception.github.io/intl-format) and provides
Twig extensions for using the documented type specifiers of the library.### Filters
Internationalization text formatting:
``` twig
{{ "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 #}
```### Functions
Internationalization text formatting:
``` twig
{{ 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:
``` twig
{{ currency_symbol() }}
{# € #}
```