Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wandiparis/i18nbundle
Wandi i18n Bundle
https://github.com/wandiparis/i18nbundle
i18n symfony symfony-bundle symfony3 symfony4
Last synced: 7 days ago
JSON representation
Wandi i18n Bundle
- Host: GitHub
- URL: https://github.com/wandiparis/i18nbundle
- Owner: WandiParis
- License: mit
- Created: 2017-11-16T14:01:23.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-12-21T17:22:21.000Z (about 4 years ago)
- Last Synced: 2025-01-29T09:14:29.328Z (7 days ago)
- Topics: i18n, symfony, symfony-bundle, symfony3, symfony4
- Language: PHP
- Size: 7.81 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# I18nBundle
Wandi/I18nBundle is a Symfony bundle used to assist internationalization of projects.## Setup
### Install via composer
```
$ composer require wandi/i18n-bundle
```### Registering the bundle
```php
$bundles = [
// ...
new \Wandi\I18nBundle\WandiI18nBundle(),
];
```## How to use
### Entity
* Add **TranslatableEntity** trait in your Entity.
* Create many fields as needed foreach languages used.```php
class Foo
{
use TranslatableEntity;
// ...
/**
* @var string
*
* @ORM\Column(name="bar_fr", type="string", length=255)
*/
private $barFr;
/**
* @var string
*
* @ORM\Column(name="bar_en", type="string", length=255)
*/
private $barEn;
}
```### View and Controller
* The trait will automatically use the correct getter depending to the current language used.
#### View
```twig
{{ Foo.bar }}
```#### Controller
```php
$foo->getBar();
```