[keycloak-user] Initialize keycloak with locale in i18n
Stan Silvert
ssilvert at redhat.com
Wed Feb 13 08:17:44 EST 2019
If I remember correctly, the redirection loop is due to the fact that
Keycloak wants to be initialized first.
You could set the KEYCLOAK_LOCALE cookie. If there is no kc_locale
query parameter then the DefaultLocaleSelectorProvider will use the
cookie to set the locale for login.
On 2/13/2019 4:00 AM, Al Mahdi Chihaoui wrote:
> Hi Stan,
> Thanks for your reply,
> We are using Express js to serve our React application, so we
> initialize i18next before initializing Keycloak or React.
> For the locale selectors, i didn't find how to set kc_local, it worked
> with the login method but as i mentioned before, that method caused a
> redirection loop.
> Regards.
>
> On Tue, Feb 12, 2019 at 9:03 PM Stan Silvert <ssilvert at redhat.com
> <mailto:ssilvert at redhat.com>> wrote:
>
> This might help:
> https://www.keycloak.org/docs/4.8/server_development/#_locale_selector
>
> But one problem is that you should be initializing Keycloak before
> you
> initialize React. That means you won't have a chance for i18next to
> detect the locale before the login screen is shown.
>
> If the default LocaleSelectionProvider is not what you want then I
> suggest that you find out the algorithm i18next is using and build
> that
> into your own LocaleSelectionProvider.
>
> Stan
>
> On 2/12/2019 12:42 PM, Al_Mahdi wrote:
> > In our application (React application) we have a business
> requirement to show
> > the login page with the default language detected by i18next, I
> didn't find
> > how to set the locale in keycloak init method, however, i used
> login method
> > where the locale can be set. but, using the login method, i had
> redirection
> > loop issue.
> > - Is there any difference between logging in using init or login
> methods?
> > - Are there clear or clean ways where i can send the locale to
> keycloak in
> > order to show the page in the appropriate language?
> >
> > Thanks.
> >
> >
> >
> > --
> > Sent from: http://keycloak-user.88327.x6.nabble.com/
> > _______________________________________________
> > keycloak-user mailing list
> > keycloak-user at lists.jboss.org <mailto:keycloak-user at lists.jboss.org>
> > https://lists.jboss.org/mailman/listinfo/keycloak-user
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org <mailto:keycloak-user at lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
>
>
> --
> *Al Mahdi Chihaoui*
> *Software Engineer*
> *LinkedIn <https://www.linkedin.com/in/al-mahdi-chihaoui/>| Github
> <https://github.com/almahdi-chihaoui>*
>
> */
> /*
> *
> *
More information about the keycloak-user
mailing list