Skip to content

Commit

Permalink
Merge pull request #163 from lunetics/doc
Browse files Browse the repository at this point in the history
docs improvements
  • Loading branch information
dbu committed Jun 1, 2015
2 parents 93adc4f + e4e56af commit 4f35139
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Resources/doc/index.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

## Add the package to your dependencies

``` yaml
"require": {
"lunetics/locale-bundle": "2.2.*",
....
},
```bash
php composer.phar require lunetics/locale-bundle
```

## Register the bundle in your kernel
Expand Down
21 changes: 21 additions & 0 deletions Resources/doc/switcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,24 @@ It is also possible to override the default template used in the switcher by pas
``` html
{{ locale_switcher(null, null, 'AcmeDemoBundle:Foo:bar.html.twig') }}
```

The template receives as variable a collection of locales available to switch on. These locales contains some
informations you can use in the template :

```html
<ul>
{% for locale in locales %}
<li>{{ locale.locale_current_language }}</li>
<li>{{ locale.locale_target_language }}</li>
<li>{{ locale.link }}</li>
<li>{{ locale.locale }}</li>
{% endfor %}
</ul>
```

* `locale_current_language` will display the locale name in the current language
* `locale_target_language` will display the locale in the language it is targetted to, for e.g. if your current locale is
`en` and the target language is `fr` then it will display `Français`
* `link` is the url to perform the switch to this language
* `locale` the locale corresponding to the language

0 comments on commit 4f35139

Please sign in to comment.