on 10-14-2015 2:25 PM
Dear Experts,
We are facing the one the major issue in portal 7.4 for internalization.
below are details :
1)We created one custom application for switching languages like English/Hindi
2)By default we gave the English portal then user click on Hindi its going to Hindi portal again user click on English its not redirecting to English portal
3) we implemented the code like below:
.JSP code:
<%
// Get the request
IPortalComponentRequest currentRequest = (IPortalComponentRequest)
pageContext.getAttribute
(javax.servlet.jsp.PageContext.REQUEST);
// Get the Parameter
String language = currentRequest.getParameter("language");
String cURL = currentRequest.getParameter("cURL");
// Invalidate the old session
currentRequest.getServletRequest().getSession(true).invalidate();
// Here we prepare the 2 URL's for English and Hindi
// So that the user can be retained on the same page
// And not directed to the home page
%>
<form action="#" method="post" name="hid">
<input type = "hidden" name="urlhid" value=<%=cURL%>>
<%
// Check the parameter and accordingly re direct
if (language.equalsIgnoreCase("English"))
{
%>
<script language = "JavaScript">
var currentURL=document.hid.urlhid.value;
var targetURLEnglish;
if(currentURL.match("NavigationTarget") == null)
{
if(currentURL.match("guest_user") == null)
{
targetURLEnglish=currentURL+"?guest_user=english"
targetURLEnglish = targetURLEnglish.replace(/_hi/,"_en");
}
else
{
targetURLEnglish=currentURL
targetURLEnglish = targetURLEnglish.replace(/Hindi/,"english");
targetURLEnglish = targetURLEnglish.replace(/_hi/,"_en");
}
}
else
{
targetURLEnglish=currentURL+"&guest_user=english";
}
window.top.location.href=targetURLEnglish;
window.title="My portal"
</script>
<%
}
if (language.equalsIgnoreCase("Hindi"))
{
%>
<script language = "JavaScript">
var currentURL=document.hid.urlhid.value;
var targetURLHindi;
if(currentURL.match("NavigationTarget") == null)
{
if(currentURL.match("guest_user") == null)
{
targetURLHindi=currentURL+"?guest_user=Hindi"
targetURLHindi = targetURLHindi.replace(/_en/,"_hi");
}
else
{
targetURLHindi=currentURL
targetURLHindi = targetURLHindi.replace(/english/,"Hindi");
targetURLHindi = targetURLHindi.replace(/_en/,"_hi");
}
}
else
{
targetURLHindi=currentURL+"&guest_user=Hindi"
}
window.top.location.href=targetURLHindi;
window.title="My portal"
</script>
<%
}
%>
4) we are accessing language from below URL in portal :
//language
function Go(cLang)
{
var currentURL = window.top.location.href;
window.top.location.href="https://answers.sap.com/irj/servlet/prt/portal/prtroot/com.portal.AnonymousLanguageSwitch.ChangeLanguage?language="+cLang+"&cURL="+currentURL;
}
I did the lots of R&D i didn't get any result,Please kindly help me to solve this issue.
Regards
Apps
Thanks for your inputs,
I tried another way for language switching ,using standard masthead component (com.sap.portal.navigation.masthead) from portal.I modified that component for language drop down ,in that drop down whatever the locales added in server all the languages are displaying,but here my targeting language Hindi is not getting but i checked locales in server level Hindi locale added in source and target languages.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Apps,
On a first view, I cannot see any real difference in the switch from Hindi to English (not working) compared with the switch from English to Hindu (working).
So I would suggest to debug the implementation; first find details about "again user click on English its not redirecting to English portal". What does this mean in detail? Is a request sent at all? If yes, what URL target is coming compared to the expected? You might also debug the JS code (and inspect before if the JS code in the HTML page is the one expected).
If you would implement the ChangeLanguage component not as JSP but as AbstractPortalComponent (rendering the JS part from within there), you could also debug the Java code so far on server side.
It's a bit hard to analyze this statically with the code given (maybe I overlooked something), but with some debugging it should be very easy at least to analyze WHAT happens...
Regards
Detlev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Detlev,
This is a external facing portal, we are giving the Language switching (Hindi/English) option for users.
When user selecting the hindi or english portal at that time urls are:
For Hindi:
1)http://myportal:50100/irj/portal/anonymous?guest_user=Hindi
For English:
2)http://myportal:50100/irj/portal/anonymous?guest_user=english
when page load for the first time and user click on Hindi on first attempt then portal contents changes to Hindi, but again user click on English then portal contents not changing to English.
At that time when we clearing cookies and sessions in browser then its working fine. Here Sessions are not working properly.
Any another way to achieve this. Kindly help me.
Regards,
Apps
User | Count |
---|---|
86 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.