I have a database column (varchar) named name containing i18n keys and a text field on a form where the i18n key related text should be displayed. The i18n keys in the database column name look like:
i18n:hades.sta.lbl.teachers
I can’t find a way to directly display the text belonging to the key.
I am able to display the content of an i18n key when I create a calc and use the calc as dataProvider - then it works. But I think if it is possible with a calc, it surely should be possible to display a content of an i18n key directly, i. e. without a calc!?
The calc looks like this:
function _name() {
var nodeName = i18n.getI18NMessage(name);
return nodeName;
}
Thanks for your answer. I didn’t seem to be clear enough. My shown code works, but I am looking for a solution WITHOUT needing a calculation. It works WITH a calc (your code of course also works
Regards, Robert
tgs:
Hi Robert,
try:
function _name() {
var nodeName = i18n.getI18NMessage(i18n:hades.sta.lbl.teachers);
return nodeName;
}
The question remains the same - how? More exactly, how to bind a database column containing i18n keys to a (text) field on a form by NOT using a calculation? That’s my question.
Best regards, Robert
tgs:
Robert,
why don’t you fill the column with the i18n content by the Events onShow/onLoad/onElementFocusGaind and so on?
What’s the use of storing i18n keys in a table and displaying the value from that table.
Don’t get me wrong: I can think of some reasons, but this is key information to think of the best solution for you…
Our application has right of the menu tree (on the very left with triangles to open close a domain with the associated menues) the so called selection pane. Usually, the selection pane is filled with values from a tables columns, i. e. showing these values directly, like name, first name etc. for a person. So for all these selection lists i18n is of course not relevant, as the value in the column is shown.
But now I have a selection list to display groups of statistics, like for Schülerinnen/Schüler (first selection list entry, or for Lehrpersonen (teachers). An these entries are inserted by us, the developer of the software, because they are static, i. e. for each addition of a new selection list row a number of statistics are to be offered. And, I want to have this rows in the selection list to be i18n (As you know we have 4 official languages in Switzerland
By the way, the menu tree on the left is also doen as i18n (also with calcs). That’s another example of the use of i18n in an app.
Hope this gives you an idea why we would like to display i18n keys without using calcs.
See attached screenshot.
Best regards, Robert
mboegem:
Hi Robert,
What’s the use of storing i18n keys in a table and displaying the value from that table.
Don’t get me wrong: I can think of some reasons, but this is key information to think of the best solution for you…
Robert Huber:
May be you did find a way to apply this method to a DBTreeView bean as well?
it’s not that I ‘found’ the way in terms of creation. It was already there…
The DBTreeView doesn’t have an option ‘displayTags’ so that’s why it doesn’t work.
I even doubt if it will be faster than using a calculation, and… don’t forget: the calculation gives you much more control over your text.
If you’re in need of this function anyway, I’d suggest you create a case in the support system of Servoy.
It is surely dependent whether the better solution is with calcs or with storing the i18n key in the database. I can see good use for both implementations.
Thanks, Robert
mboegem:
Robert Huber:
May be you did find a way to apply this method to a DBTreeView bean as well?
it’s not that I ‘found’ the way in terms of creation. It was already there…
The DBTreeView doesn’t have an option ‘displayTags’ so that’s why it doesn’t work.
I even doubt if it will be faster than using a calculation, and… don’t forget: the calculation gives you much more control over your text.
If you’re in need of this function anyway, I’d suggest you create a case in the support system of Servoy.