Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Language Switching Problem(internalization)

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="/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

Tags:
Not what you were looking for? View more on this topic or Ask a question