How to add a new i18n key on running Application Server

When creating a new record in the i18n table of a running Servoy Application Server,
is it necessary to restart the complete Server to make that new i18n-key accessible to clients?

Background is we have table-driven value lists that have i18n functionality.
A user may want to change a value list, adding a value item with its translations to English and German, for example.
When he did so, we would create the needed i18n-records in the i18n-table.

Now the question is, if we have to ask all users to logout and to restart the complete Server,
to get them this one new i18n-key for that new value item.

There is the function setI18nMessage(), but what we want is to get the new i18n key into effect
for every user that logs in new automatically based on the i18n table.

currently there is no build in support for flushing all the clients i18n messages.

Because its kind of static stuff… its not really meant for constant change.

Flushing it for new clients is not so hard to do (so a complete server restart isn’t needed)
but really pushing it directly to all active clients and updating all the i18n keys that are used in a solution is quite a bit of a task.

You can create a case for this. But if you really want the i18n to fully update also existing clients without a restart of a client that will not be done very soon

Johan,

thanks for your information. Pushing to active users is not needed.

But when a new user logs in tomorrow, will she see the new i18n-key automatically?
Or do we have to do something additionally?

setI18nMessage() seems not the right command in this case, as that affects the current client scope, the documentation says.

Years ago Johan wrote this plugin for me, I use it to add new i18n keys directly to the server i18n table. After you add a new key, or change an existing one, you use the plugin to flush the i18n system, all connected clients will need to logout/login (or reopen) to be able to see and use the new key. It’s not perfect but it’s a good compromise to let your customers handle all the translatios. See screenshot.

flushi18n.jar (10.8 KB)

Thanks, that’s all we need.
We just tested it and it works as expected (copy that flushi18n.jar plugin to servoy-folder/application_server/plugins, refresh plugins on Solution Explorer, call its function and the i18n-mappings of the running Application Server get updated).

It may be a good idea to supply this with the Servoy standard configuration.
Here is an example case which I think a lot of developers face all the time:

i18n-payment-terms
Users need to create their own payment terms for their system, and it makes sense that this is done for the complete group of companies once, and not in each country. Therefore it should be i18n-based.
Example:
i18n-key-value = 45net
English i18n translation = 45 days net
German i18n translation= 45 Tage netto

So when on a running system with several hundred users a new payment term gets added, with this plugin you do not need to restart the complete Application Server to just distribute the new payment term to all users.

Another common case would be i18n-based-valuelists like project status valuelists, where it is also common that your customers want an additional status.

What we did was to create a table form for the table i18n_messages, in which Servoy keeps the i18n-records.
The button calls
plugins.i18nFlush.flushI18N();
and that’s it.
For testing purposes we placed a label with i18n:bob.zzz on the form. After adding a record with key bob.zzz to the table, calling the button and a new login that shows the translation.

With that solution, it is possible to add i18n-keys on the fly on a running AppServer, without creating a new build. That’s also handy when you see that an i18n-key is accidently missing.