Child pages
  • Customization via I18N
Skip to end of metadata
Go to start of metadata

Using databaseManager.addTableFilterParam to filter I18N keys

It is also possible to have multiple values for one key, and create a extra column in the database to use in a filter.
For example when working with a SaaS solution and there should be some custom labels for one of the clients. Add a extra column to the i18n table for example called "message_owner" like:


In the onOpen method this code can be added to filter on the message_owner column:

function onOpen()
{ 
	databaseManager.addTableFilterParam('i18n_db', "i18n_table", "message_owner", "IN", ['servoy', null]);
}

This means that only keys with 'message_owner' = 'servoy' or null, and if there are more entries for the same key for different 'message_owner', then,
the order of the values in the filter defines what is used (ex: you have 'lbl.3'  with 'message_owner' = 'servoy', but also, 'lbl.3' with 'message_owner' = null, then the first one will be used) 

So the usage of lbl.1 to lbl.3 keys would on labels would result in:


If you want your users to be able to make their own labels for i18n keys, this is easily possible by making a form on the I18N table. It might be preferred to have the user work in a on a  duplicate of the record they want to edit and then enter the message_owner column with the logged in owner. This way the key will turn up for this owner but not for the others.

  • No labels