Dynamic translation feature

81 views
Skip to first unread message

Baltabayev Artur (IOC/PAU-PM)

unread,
May 28, 2020, 9:49:18 AM5/28/20
to keyclo...@googlegroups.com

Hello Stian,

we would like to implement the dynamic translation feature mentioned by Sebastian Schuster a while ago.

As a quick reminder: The feature would include saving i18n texts in the database and using them

instead of the already available translation text bundles. The bundles would still act as a default fallback mechanism.

 

In a first step we'd like to discuss how the details of such a feature would look like.

We thought of saving the i18n texts individually for every realm and language via its own REST resource.

They would then be queried at the same places, where the bundles are also loaded and simply override

the existing keys in the resulting Properties object.

We would then also implement a mechanism in the UI where a admin user can upload a whole file instead of

saving individual texts.

 

Some immediate questions that came to mind are:

            - Which format should be used for the file that the user will be able to upload ?

            - How should the REST resource be named and where should it be located ?

            - Are i18n texts for every realm even desired (instead of being just one per instance) ?

            - Are there already plans for such a feature that we can maybe use as a guideline ?

 

What are your thoughts on the matter ?

 

Mit freundlichen Grüßen / Best regards

Artur Baltabayev


Bosch IoT Permissions - Product Area User Management (IOC/PAU-PM)
Bosch.IO GmbH | Ziegelei 7 | 88090 Immenstaad | GERMANY | www.bosch.io
Tel. +49 7545 202-497 | Fax +49 7545 202-301 | Artur.Ba...@bosch.io


Registered Office: Berlin, Registration Court: Amtsgericht Charlottenburg; HRB 148411 B
Chairman of the Supervisory Board: Dr.-Ing.
Thorsten Lücke; Managing Directors: Dr. Stefan Ferber, Dr. Aleksandar Mitrovic, Yvonne Reckling

Stian Thorgersen

unread,
May 29, 2020, 6:52:28 AM5/29/20
to Baltabayev Artur (IOC/PAU-PM), keyclo...@googlegroups.com
Thinking about messages we can break this into:

1. Keycloak defaults
2. Server-wide messages (custom and overrides)
3. Realm-wide messages (custom and overrides)
4. Entity-specific (for example display name for a specific client)

1. For sure belongs in the messages including in Keycloak

2. As these are used by multiple realms, etc. they don't belong in the DB in my opinion. These should be fairly static and well defined, which means they should be in custom themes, with the option to also have message bundles loaded into custom themes, which is already supported through theme resources.

3. Realm-wide messages - this is especially important when a realm admin is not the same person as a server admin. These should just be attached to the realm model I think, and there should be an UI in the realm to add/override messages. There shouldn't be tons and tons of these probably so could potentially just have a get/update/delete message bundle for a realm endpoint. I'd say the format should be JSON, perhaps with one "bundle" per language?

4. Entity-specific - there can actually be quite a lot of these (client names for instance if you have 10K clients), so having these as realm-wide would probably not be a good idea, and they would very rarely if ever be shared. Ideal here is probably to store them "alongside" the entity itself. Perhaps we are only talking about clients, and potentially client scopes, that need this ability? In the UI the nicest behaviour here would probably be the ability to add different translations of the display name directly rather than having to go to a separate place to define it.

From a performance perspective I think the distinction between 3 and 4 is important. 3 should contain few enough messages that it can be cached/fetched together with the realm settings, while 4 should be cached alongside the entity. This also means that there's less messages to go through when looking up a "client name".


--
You received this message because you are subscribed to the Google Groups "Keycloak Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keycloak-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-dev/ace7fa0611d24d4eae9acc736a623899%40bosch.io.

Baltabayev Artur (IOC/PAU-PM)

unread,
Jun 5, 2020, 3:40:01 AM6/5/20
to st...@redhat.com, keyclo...@googlegroups.com

By attaching messages to the realm model, do you mean they should be saved in a separate table that is linked to the realm table ?

I found that there is no logic in the UI yet that would load translated texts (messages) from a realm model. I hope my observation was correct at this point.

 

What  would be examples for a “realm-wide” message ? Because from my understanding there are no texts in the UI that can be specific for a certain realm.

Anything is either related  to a custom implemented theme or shared between realms.

 

My other question goes towards entities. I was talking about translations, so I don’t quite understand how user made entity names can (or should even) be translated.

 

Mit freundlichen Grüßen / Best regards

Artur Baltabayev


Bosch IoT Permissions - Product Area User Management (IOC/PAU-PM)
Bosch.IO GmbH | Ziegelei 7 | 88090 Immenstaad | GERMANY |
www.bosch.io
Tel.
+49 7545 202-497 | Fax +49 7545 202-301 | Artur.Ba...@bosch.io

Registered Office: Berlin, Registration Court: Amtsgericht Charlottenburg; HRB 148411 B
Chairman of the Supervisory Board: Dr.-Ing.
Thorsten Lücke; Managing Directors: Dr. Stefan Ferber, Dr. Aleksandar Mitrovic, Yvonne Reckling

Stian Thorgersen

unread,
Jun 5, 2020, 4:16:33 AM6/5/20
to Baltabayev Artur (IOC/PAU-PM), keyclo...@googlegroups.com
On Fri, 5 Jun 2020 at 09:40, Baltabayev Artur (IOC/PAU-PM) <Artur.Ba...@bosch.io> wrote:

By attaching messages to the realm model, do you mean they should be saved in a separate table that is linked to the realm table ?

I found that there is no logic in the UI yet that would load translated texts (messages) from a realm model. I hope my observation was correct at this point.

 

What  would be examples for a “realm-wide” message ? Because from my understanding there are no texts in the UI that can be specific for a certain realm.

Anything is either related  to a custom implemented theme or shared between realms.


This would be a new capability for a realm admin to override messages at the realm level, and yes there's nothing that stores/loads these today.
 

 

My other question goes towards entities. I was talking about translations, so I don’t quite understand how user made entity names can (or should even) be translated.


The use-case here is if you have an installation of Keycloak that supports multiple languages, when you then add a client you would want to add the translation of the name and description of the client for multiple languages. This would be something that should be attached to the client, not something you have to manage at the server (like today) or realm level really. See for example https://openid.net/specs/openid-connect-registration-1_0.html#LanguagesAndScripts which allows dynamic client registration to include multiple languages.
Reply all
Reply to author
Forward
0 new messages