How can I read the translation labels from profile documents in XPages? -


i xpages enabling old notes application using profile documents store translated labels. translated lables in notes form read profile document using @getprofilefield depending on language user have selected in profile.

i have read profile documents not recommended use xpages need better solution xpages users. important users using notes client still use "old" profile document solution.

how can provide these translation lables xpages users?

thanks thomas

you can use profile documents use case content gets changed new versions of project probably. so, can live profile document's caching.

you label translation profile document with

var doc = database.getprofiledocument("labelsenglish", ""); var label = doc.getitemvaluestring("label1"); doc.recycle(); return label;  

you read labels in application scope variable map , own caching. way profile documents read once.

if (!applicationscope.labels) {     var map = new java.util.hashmap();     var doc = database.getprofiledocument("labelsenglish", "");     var allitems = doc.getitems();     (var = 0; < allitems.size(); i++) {         var item = allitems.elementat(i);         item.getname();         map.put(item.getname(), item.getvaluestring());         item.recycle();     }     doc.recycle();     applicationscope.labels = map; } 

execute ssjs code above in custom control included in every xpage (e.g. application layout custom control) in before page load event can sure application scope variable "labels" initialized when want use it. can access labels el

 applicationscope.labels.label1 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -