JMSI18nRoutingBundle icon indicating copy to clipboard operation
JMSI18nRoutingBundle copied to clipboard

Translations are always in framework default Locale

Open fnash opened this issue 11 years ago • 3 comments

I have installed fos user bundle, i18n routing bundle and translation bundle, and enabled them in the app kernel.

For my config I have:

# parameters.yml

parameters:
    locale: en

Here is my config:

# config.yml

framework:
    translator:
        enabled: true
    default_locale:  %locale%

jms_i18n_routing: 
    default_locale: %locale%
    locales: [%locale%, fr, es]
    strategy: prefix_except_default

And security config with all paths beginning with ^/[a-z][a-z]/

# security.yml

    access_control: 
        - { path: ^/[a-z][a-z]/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/[a-z][a-z]/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/[a-z][a-z]/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }

        - { path: ^/[a-z][a-z]/profile/, role: ROLE_USER }

I have also set routes not paths in fos_user config...

Everything is OK with the routes and URLs in the browser. But the only problem is that views are not translated. They always come with english, the default locale when I have /fr/my-path

locale route attribute is fr. _locale is fr. request::locale is fr. hl cookie is fr.

I have set a break point in Symfony\Component\Translation::trans() and it seems that the getLocale() always return "en".

Did I have misconfigured something? Or is it may be a bug?

fnash avatar Apr 25 '13 17:04 fnash

@tirengarfio Any idea?

fnash avatar Apr 26 '13 22:04 fnash

Have you resolve this ?

CharlyPoppins avatar Jan 12 '15 11:01 CharlyPoppins

I have forgot that -____- old project... please keep searching on the internet and keep trying, debugging.

fnash avatar Apr 21 '15 13:04 fnash