-
Notifications
You must be signed in to change notification settings - Fork 0
Symfony Bundle
Nikolai Plath edited this page Jul 17, 2018
·
1 revision
The G11n bundle integrates the G11n language library into Synfony projects.
composer require elkuku/g11n-bundle
If you are not using Flex add
# /config.bundles.php
...
ElKuKu\G11nBundle\ElKuKuG11nBundle::class => ['all' => true],
...
See the G11n Wiki for general information.
A shorthand function _()
is provided for usage in twig templates
{{ _('Translate this string') }}
- 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
Create or update the language template files.
Create or update the language files.
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()) }}
Te enable debugging set the debug
flag in the config file to 1
.
[screenshot]