lunetics/LocaleBundle — pull request #103 by goetas (2014-03-20 11:06:54+00:00)
Title: Locale best match

When the browser has `en_US` as configured locale and config.yml is:
```yaml
lunetics_locale:
strict_mode: false
allowed_locales:
- en
- de
```
The matched locale will be: `en_US`. Sometimes this may cause some problems, especially if using `{_locale}` inside urls.

An alternative way can be set `strict_mode` to `true`, but in this case i will loose the possibility to match partial locales... For example, when the browser has `en_US` as configured locale and config.yml is:
```yaml
lunetics_locale:
strict_mode: true
allowed_locales:
- en
```
In strict mode, no locale will be matched (fall-back to symfony default locale)...

To solve this have added a configuration called `strict_match` (default to `false`) to allow partial matching of a locale. For example:
```yaml
lunetics_locale:
strict_mode: false
strict_match: true
allowed_locales:
- en
- en_GB
```
- When the browser has `en_US` ( or just `en`), the matched locale will be: `en`
- When the browser has `en_GB`, the matched locale will be: `en_GB`.