Control language/localization in ExtLib controls?

限于喜欢 提交于 2020-01-05 06:28:00

问题


I am currently creating a web layout for an old database based on XPages. The users are Danish - and I want to ensure that they see a correct layout of dates and Danish labels on the pagers etc.

For the standard pager I am using the "custom" type and translate the "Previous" and "Next" labels (put it on a custom control and reuse that on all the pages). I did try to set the language on the pager, however, that does not change anything...?

Well, now I am also using the "pagerExpand" control from the Update Pack (official Extension Library). It shows correct labels based on the language in the browser. Since I cannot be sure that the language in the browser has been set correctly, I want to control that. How can I control these labels?

In the bigger perspective, I want to be able to control language in an application as a whole... (for other future applications)

/John


回答1:


I have created a XSnippet for controlling the language of a XPage application: http://openntf.org/XSnippets.nsf/snippet.xsp?id=xpages-localization-setter

To change the language in a XPage manually, you can do this in SSJS with this function:

view.setLocale( )

Hope this helps

Sven

EDIT:
To set the correct language, you have to use java.util.Locale. To set the language f.e. to danish, add this to beforeRenderResponse:

var locale = new java.util.Locale( "da" );
view.setLocale( locale );


来源:https://stackoverflow.com/questions/10460426/control-language-localization-in-extlib-controls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!