elkuku / g11n-bundle
Symfony G11n Bundle
Installs: 75
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.1.3
- elkuku/g11n: ^5.0
- elkuku/g11n-util: ^1.1
- symfony/config: ^4.1
- symfony/dependency-injection: ^4.1
- symfony/http-kernel: ^4.1
Requires (Dev)
- symfony/phpunit-bridge: ^4.1
- symfony/twig-bundle: ^4.1
README
The G11n bundle integrates the G11n language library into Synfony projects.
Installation
composer require elkuku/g11n-bundle
If you are not using Flex add
# /config.bundles.php ... ElKuKu\G11nBundle\ElKuKuG11nBundle::class => ['all' => true], ...
Usage
See the G11n Wiki for general information.
Twig
A shorthand function _()
is provided for usage in twig templates
{{ _('Translate this string') }}
Configuration
Default values
- Default language:
en-GB
- Debug:
off
To change those values create the file
# /config/packages/elkuku_g11n.yaml elkuku_g11n: defaultLang: en-GB debug: false
Commands
g11n:templates
Create or update the language template files.
g11n:langfiles
Create or update the language files.
Templates
Language switcher
There is a simple language switcher template that you might take as a ... template ;)
{% import "@ElKuKuG11n/_macro/g11n.html.twig" as g11n %} ... {{ g11n.switcher(getLangs(), getCurrentLang()) }}
Debugging
Te enable debugging set the debug
flag in the config file to 1
.
[screenshot]