[keycloak-dev] Internationalization support for angular notifications and default values.

Stan Silvert ssilvert at redhat.com
Fri Feb 10 11:50:20 EST 2017


On 2/10/2017 9:18 AM, Gustavo Alvarez wrote:
> Hello Stan.
>
> Can you help me with an example of i18n implementation in keycloak?
Sure.  We are using angular-translate on the javascript side:
https://angular-translate.github.io/docs/#/guide

The localized messages live in *.properties files on the server. These 
are translated to json as they are fetched through the REST API.

So for instance, the first form you see in keycloak admin is realm-detail:
https://github.com/keycloak/keycloak/blob/master/themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html

You'll notice markup like this:
<label class="col-md-2 control-label" for="name">{{:: 'displayName' | 
translate}}</label>

Here, displayName is a key in a properties file that is localized. (For 
performance reasons make sure you do use the double-colon '::')
This key lives in 
https://github.com/keycloak/keycloak/blob/master/themes/src/main/resources/theme/base/admin/messages/admin-messages_en.properties

There is some i18n needed on the server side for error messages that are 
currently hard-coded.  For that you would use standard java message 
bundle API's.  I don't think we have any examples for that.

Also, I'm attaching a powerpoint that I prepared for the Keycloak team a 
long time ago.  It's mostly accurate with what we still do today, so you 
might find it helpful.

Stan

>
> Thanks.
>
> Gaalvarez.
>
>
>
> On Fri, Feb 10, 2017 at 8:29 AM Stan Silvert <ssilvert at redhat.com 
> <mailto:ssilvert at redhat.com>> wrote:
>
>     This is a known issue that we will need to revisit when we have
>     the time
>     and resources:
>     https://issues.jboss.org/browse/KEYCLOAK-2393
>     https://issues.jboss.org/browse/KEYCLOAK-2394
>
>     There are several places here and there in the console and the
>     REST API
>     that still need i18n support.  If you would like to help we'd love to
>     get a contribution and we can help get you started with the
>     implementation.
>
>     Stan
>
>     On 2/9/2017 5:28 PM, Gustavo Alvarez wrote:
>     > HI all.
>     >
>     > I need to change all language of keycloak, almost all the
>     information in
>     > pages of console is in properties files except two things:
>     >
>     > 1. Notifications from angular: there is code as the next:
>     >                   Notifications.success ("Role mappings updated.");
>     >
>     > 2. Default values in java services, for example the service that
>     creates
>     > client uses default values in DefaultAuthenticationFlows.java:
>     >
>     > public static final String REGISTRATION_FLOW = "registration";
>     > public static final String REGISTRATION_FORM_FLOW =
>     "registration form";
>     > public static final String BROWSER_FLOW = "browser";
>     > public static final String DIRECT_GRANT_FLOW = "direct grant";
>     > public static final String RESET_CREDENTIALS_FLOW = "reset
>     credentials";
>     > public static final String LOGIN_FORMS_FLOW = "forms";
>     > public static final String SAML_ECP_FLOW = "saml ecp";
>     >
>     > Someone is working on this now or or can you help me find a
>     solution for
>     > this situation?
>     >
>     > Thanks for you help.
>     >
>     > gaalvarez.
>     > _______________________________________________
>     > keycloak-dev mailing list
>     > keycloak-dev at lists.jboss.org <mailto:keycloak-dev at lists.jboss.org>
>     > https://lists.jboss.org/mailman/listinfo/keycloak-dev
>
>     _______________________________________________
>     keycloak-dev mailing list
>     keycloak-dev at lists.jboss.org <mailto:keycloak-dev at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/keycloak-dev
>



More information about the keycloak-dev mailing list