juanber84 / simplei18nbundle
This Bundle provides a simple solution for translations in Symfony2.
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/juanber84/simplei18nbundle
Requires
- php: >=5.3.2
- symfony/framework-bundle: >=2.0.0
This package is not auto-updated.
Last update: 2026-02-24 14:10:55 UTC
README
###Install with composer
{
"require": {
"juanber84/simplei18nbundle": "dev-master"
}
}
Compatible with http://symfony.com/doc/current/cookbook/session/locale_sticky_session.html
Add in your app/AppKernel.php
<?php
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Juanber84\Bundle\Simplei18nBundle\Juanber84Simplei18nBundle(),
// ...
);
}
Add in your app/routing.yml
juanber84_simplei18n:
resource: "@Juanber84Simplei18nBundle/Resources/config/routing.yml"
prefix: /
###Use it
Put the next twig code in the header of your layout:
{{ language('es') }} // If you used this it will convert to the language which you've inserted
{{ language() }} // If you used this it will convert to the language which _locale var session
Use the widget where you would show it:
{{ simplei18n(['es', 'en', 'pt', 'it'] )|raw }}
Make your custom widget using the path:
{{ path('juanber84_simplei18n_changelocale', {'locale': 'es'}) }}