XPages - presenting an application in multiple languages - xpages

I have an XPages application which is available in 4 languages. I would like that each user can choose the language in which the application is presented to him. What is the best way of doing this? It seems to me that I need to set a user specific parameter but am not sure how to go about this. At the moment I use a scope variable to determine which language the application is displayed in. This scope variable is server specific so all users see the application in the same language. Now I would like the application to be presented in the langauge chosen by each user (although all users are accessing the application on the same server). In Notes this was possible by writing a value to the user .ini file. Is there an XPages equivalent of this?

The XPages Toolkit project has an Language bean that gives the options to set a specific language to an application or let the user decide.
http://www.openntf.org/main.nsf/project.xsp?r=project/XPages%20Toolkit
If you can't use the extension OSGI plugin checkout the java source on github
https://github.com/OpenNTF/XPagesToolkit
An implement what you need

Related

Azure AD B2C Custom policy language translation

I have declared a set of supported langauges in my custom policy.
But what happens is, Microsoft implicitly convert some text and messages to other languages eventhough when i haven't decalred that langugae to be supportred.
(Eg) I haven't supported croatian language in my app, so when i pass croatian langauge in my query param, it should point to default language referred in the custom policy, Because croatian is in my unsupported langugaes list. what in reality some of the messages gets converted to croatian and shown in UI.
It is true. And Custom Policies out of the box supported language customization but support is limited to few fields/inputs/labels/messages. If your application support multi language then you can add your own customization.
(Eg) I haven't supported croatian language in my app, so when i pass croatian langauge in my query param, it should point to default language referred in the custom policy, Because croatian is in my unsupported langugaes list. what in reality some of the messages gets converted to croatian and shown in UI.
Update: Currently this is not possible and you need to limit supported languages from your application it self.
Typical Multi Language Scenario for a web/ native application (may be a workaround):
Web application show up the list of supported languages either in drop down or any user friendly way
Application will capture the locale from the customer selected language and append to the request URL.
If that locale is valid at B2C side it will start displaying Ux in that language
There is only 1% changes where customers can actually edit the Authorize URL to modify the locale. Your concern is still valid but based on above scenario itwill become less impact on your application.
If you would like to force the locale you can use the query string when requesting the B2C application.
?ui_locales={en}
Where you would replace {en} with the locale you support for more info see the offical docs

Lotus Notes XPage to display within Frameset

[Disclaimer: I am new to Notes, and am picking up a project that was started by someone else, so I'm not sure if this is the best approach, and with that out of the way ....]
We have a Notes 9.0 frameset, which is being driven by a couple of databases. There are 4 parts to the frame set, with the primary one being the selection of a client. This populates the second frame with their information, and the third frame with any related clients - such as business partners, associates, etc. The fourth frame would be any and all correspondence listed with the related clients (either one or many) which has been placed into an XPage. We cannot, though, load the XPage inside the frame, having tried multiple instances of .urlopen(XPage location) and trying to open the notes:// source, http:// source, and setting the target frame in both the inline URL and as a .SetTargetFrame("frame") fashion.
Is it possible to open an XPage from with a Frameset, or is there a better approach to this?
Thanks
Integrating or embedding XPages into a traditional Domino web application is a common approach and straightforward because it's the same protocol with the same authentication. Integrating XPages into a standard Notes Client design element is challenging for a variety of reasons, not just the URL required but also because authentication to the client is via Notes ID stored on the PC, authentication to the XPage is via HTTP protocol.
If you're wishing to display a list of the correspondence in a standard Notes frameset in the Notes Client, the approach I'd take is just to point to a View or embedded view set to a single category based on the client selected. If it's a server within a decent connectivity range, view performance will be better. If it's just a list, the data should be available for a view. If it's to navigate into the documents and you want to open the correspondence in an XPage, that's achievable from a view by setting the property on the Form to open in a specific XPage.
I'm not certain, but it sounds like your choice to use the XPage was because someone had already developed an XPage of that information for web access, possibly for the external clients themselves. While re-using the previous code may seem a good approach, the challenges of integrating one technology into another (as you see) counter the benefits.
This isn't about XPages itself, it's about embedding technologies that are not really designed for that level of integration. Similarly if the correspondence was an Angular front end using REST services to pull the information from Domino, you would have similar issues integrating it into the Notes Client application (authentication, running code on the client to run code on the server to get data for the client to process - when Notes is already designed for good nrpc communication).
There may be benefits in time of migrating all of the frameset to an XPages application or a specific set of use cases that won't require users switching between browser client and Notes Client. But if that's not the approach for now, integrating the XPage into the frameset is likely to be a challenge, no least in terms of look and feel, that may not result in a good user experience.
You can integrate an XPage into a Notes client, but it will require to learn about a number of moving parts. Instead of a Frameset you would use a composite application (same idea, more possibilities) and show various composites: Views, Forms, Pages, XPages, Navigators etc.
However you might consider reversing the process. When the XPages application in the browser works well, you could use the XPiNC feature (XPages in Notes Client) to show the same UI in the Notes client (presuming you have a current Notes version).
You will find some articles here: https://www-10.lotus.com/ldd/ddwiki.nsf/xpSearch.xsp?searchValue=%20XPages%20in%20the%20Notes%20client
My thought: what possibly makes you problems opening XPage in frameset (either with http:// or notes:// protocols) is incompatible browser (that one in client).
You can workaround this problem if you do not need all the bells & whistles of standard XPage - Dojo, events, themes...
So, what about making that XPage as simple as possible: make it stateless, disable Dojo, do not use any events (buttons, actions), in other words just plain HTML/CSS with no JS. That should work inside frameset. All the backend stuff - SSJS, datasources and so on is OK, of course.
Edit: another hint to make it work inside frame/internal browser. Sometimes XPage fails in XPiNC mode because of wrong datasource definition. When viewed from http of Domino server, all local databases are the server ones. But in XPiNC all local databases are treated as local replicas (usually nonexistent) and therefore fail to open. Possible solution:
run XPages from server (https://superuser.com/a/586602/17277)
redefine datasource: include server name in database property (hint: remember server!!database.nsf convention)
That's just a hint, I am not sure it will work for you.

How to test load a web application?

I am working on a web app which uses JSF. I would like to know that What are best practices and available tools for performing a load test on it.
Application is hosted on glassfish server 3.1.2.2
Depends somewhat on the site you want to test. At work we have a complex RIA, and to test it we have to reproduce user interaction. We use jMeter for this.
It's kind of messy to set up (look at the guides they have) but once this is done it's very flexible and allows you to configure and tweak many things. I particularly like its "proxy" feature where you can proxy your app through jMeter and it records everything so you can play it back later on. Note that for JSF you have to do some tricks with the ViewStateId, so google a "jmeter JSF" guide for how to set this up.
In a previous project I have used RadView WebLOAD to test a JSF site, it enable recording the user scenario and handles correlating the dynamic values.

Any Open source Internationalization/localization framework for web application e.g. JSF, Struts, Spring MVC

I have created a JSF application where in to implement localization, I need to create separate property files for each locale. Is there any way that these can be generated dynamically or any means of reducing the effort to minimum. Google translator is not a option for me.
Update:
User A have stored Data-A in Hindi language in database, Some User B comes in from french, now i want my application to show Data-A to user B in language French.
Check this blog - http://www.mkyong.com/jsf2/jsf-2-internationalization-example/
MK Yong tries to explain what you might be looking for, with examples.
I don't know if this is what you were looking for, but hope it helps. Supporting muti locales are never easy. You end up having multiple views that support each locale.

What are jftfdi jffi doing to my query string?

We are using JavaServer Faces 2.2 (Mojarra 2.2.1) in our project. I noticed something odd. On a page called reporting.xhtml where I use f:metadata with the new f:viewAction my browser, Safari in this case, shows the following query string:
reporting.jsf?jftfdi=&jffi=reporting%3Ffaces-redirect%3Dtrue
What wizardry is this? What are the parameters jftfdi and jiffi doing? What is their purpose?
It's part of the new JSF 2.2 feature as described by spec issue 949. Basically, it enables JSF to identify the client window. It's basically the same as cid in CDI's #ConversationScoped and windowId in CODI's #ViewScoped/#ViewAccessScoped. This client window ID is in turn used by among others the new JSF 2.2 #FlowScoped scope as described by spec issue 730.
The "What's new in JSF 2.2?" article of my fellow Arjan Tijms explains the need pretty clearly:
LifeCycle
Identify client windows via a Window Id
Arguably one of the biggest problems that has been plaguing web application development since its inception is the inability to distinguish requests originating from different windows of a single browser. Not only has an actual solution been long overdue, it has taken a long time to realize this even was a problem.
The root of the problem, as always, is that the HTTP protocol is inherently stateless while applications in general are not. There is the concept of a cookie though, which is overwhelmingly the mechanism used to distinguish requests from different users and to implement things like a session scope where on its turn the bulk of login mechanisms are based on.
While a cookie does work for this, it’s global per browser and domain. If a user opens multiple tabs or windows for the same domain then requests from those will all send the same cookie to the server. Logging in as a different user in a different window for the same website is thus not normally possible, and having workflows (involving post-backs, navigation) in different windows can also be troublesome because of this.
In JSF there are various solutions that are somehow related to this. The view scope effectively implements a session per window as long as the user stays on the same page and does only post-backs. The Flash is used for transferring data between different pages (presumably within the same window) when navigation is done via Redirect/GET. There’s a wide variety of scopes implemented by third parties that do something similar.
All of these have some implicit notion or assumption of the concept of a ‘client window’, but there is no explicit API for this.
JSF 2.2 will introduce support for two different aspects of this:
Identification of an individual window: the Client Window Id
API and life-cyle awareness of the window concept
Apparently you've configured your application as such.
See also:
What's new in JSF 2.2? - Lifecycle - Identify client windows via window Id
What's new in JSF 2.2? - Navigation - Faces Flow

Resources