Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the secret "sticky locale" functionality #229

Open
gitcerizead opened this issue Nov 30, 2018 · 1 comment
Open

Document the secret "sticky locale" functionality #229

gitcerizead opened this issue Nov 30, 2018 · 1 comment

Comments

@gitcerizead
Copy link

Documentation request

This bundle implements a "sticky locale" functionality that is more sophisticated than the example approach given in the Symfony documentation at https://symfony.com/doc/3.4/session/locale_sticky_session.html in that it uses not only a session param called _locale, but also a query string param or cookie called 'hl', and browser lang prefs (via the Accept-Language header).

In my own code, I've commented about this as follows:

    /* NOTE: JMSI18NRoutingBundle has a sophisticated sticky locale
     * implementation for routes for which i18n is disabled, based looking
     * for a query string param or cookie called 'hl', a session param
     * called _locale, and browser lang prefs; so we don't need to manually
     * implement the standard approach described at
     * https://symfony.com/doc/3.4/session/locale_sticky_session.html
     */

Since the sticky locale is only applied on routes for which i18n is disabled (although of course if the user visits an i18n-enabled route the explicit locale from that URL is the value that's made sticky), the appropriate place in the documentation would be http://jmsyst.com/bundles/JMSI18nRoutingBundle/master/usage#leaving-routes-untranslated I think.

@gitcerizead
Copy link
Author

It's worth noting, however, that the "stickiness" is achieved solely through the use of a cookie called 'hl', which may be being set in error (i.e. the stickiness feature may be a bug rather than a feature!). See #210 .

But even it's decided to remove the stickiness feature, it would still be good to document how the default locale is determined for a route for which "translation" (i18n) is disabled, as per the description in this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant