Set user language by code
Hi Experts ,
I want to run an application that get the current portal user language ....
Ask if it X set to Y , else do nothing .
My questions :
1. Is it right to do so ....
2. Code ???
3. Where/When is the best way to run it ?
I don't want to use the personalize option ..
Thanks ..
Hi,
Refer tis links,
Setting/Getting Available Languages in the portal using code
Set a language on the portal application
Regards,
Kanagaraj.
Similar Messages
-
Set user Language in URL IView
Hello,
I am trying to put the Language of the user in the parameters of the URL.
For example :
http://sopraganesh.cr.infra.lab/redirect.asp?page=ECD&lang=en
How can I parameter the URL IView to automatically retrieves the language of the connected user?
Thanks for your help,
ANHi
Once you have defined the iViews URL to the targeted Web page, you may need to configure parameters that are passed to the information source as part of the URL. In the URL iView Editor, you can do the following to URL parameters:
· Add, remove, and modify URL parameters
· Determine whether or not portal end user can view and personalize URL parameters at runtime
· Assign intuitive display names to URL parameters that are viewed or personalizable by portal end users
· Specify the URL request method (GET or POST)
If you navigated to the targeted Web page and defined the iView URL using the portal built-in browser, the URL parameters and request method may already been defined in the URL iView Editor.
Procedure
1. Open the iView in the URL iView Editor.
The editor does not display URL-specific parameters in the URL address within the URL box. URL parameters that were part of the URL referencing the selected Web page (the information source) are automatically removed from the source URL and displayed in the URL parameter list in the editor. At runtime, the portal automatically appends the URL and the listed parameters to the targeted URL request.
2. In the Request Method option, choose either GET or POST to specify the request method. The request method indicates how the browser sends information to the information source:
Request Method
Description
GET
This request method appends parameters to the URL when the data request is sent to the information source. The server receives the data in one long query string, which typically limits the length of parameters that can be passed.
For example, a URL using the GET request method would be: http://www.google.com/search.asp?&querystring=SAP where querystring indicates the parameter identifier and SAP is the parameter value.
POST
This request method sends parameters for the URL in the header of the data request stream; parameters are not appended to the URL. This allows for long parameters to be passed to a script and parsed one element at a time.
For example, a URL using the POST request method would be: http://www.google.com/search.asp.
POST is only supported when the Fetch Method property defined in the iView is set to Server-side. For more information, see URL iView Properties.
For iViews that have a mixture of parameters sent by GET and POST together, you must:
§ Choose POST as the request method.
§ Set the Fetch Mode property to Server-side
§ Append the GET_EXPLICIT_ prefix to the parameter identifier of each parameter that is sent by GET. For example, a parameter defined as searchstring should be defined as GET_EXPLICIT_searchstring. When the iView sends a data request, the prefix is removed from the parameter identifier at runtime. Parameters sent by POST do not require a special prefix.
3. To add a parameter, click Add below the table. A new entry is added to the parameter list.
To remove a parameter, select the checkbox of the relevant parameter in the list and click Remove. Before doing so make sure the parameter is not required by the information source.
4. Define the attributes of existing or new parameters, as follows:
Attribute
Description
URL Parameter
Specifies the parameter identifier as recognized by the information source. For example, in the URL http://www.google.com/search.asp?&querystring=SAP, the parameter identifier is querystring.
As stated above, parameters that need to be sent by GET when the request method is defined as POST, must have the GET_EXPLICIT_ prefix. For example: GET_EXPLICIT_searchstring.
Enter special characters that are present in the parameter identifier as is. Do not convert them to ASCII code. For example, enter first name, and not first%20name. At runtime, the portal will encode special characters to ASCII when fetching the iView data.
Value
Specifies the value of the parameter. This is not mandatory.
If you set the parameter as a variable that can be personalizable by end users (see following attribute), then this value will be the parameters default value. However, if you set the parameter as not personalizable, then this value is the fixed value of the parameter.
Enter special characters present in the parameter value as is. Do not convert them to ASCII code.
Type
Specifies the data type of the parameter.
Choose one of the following options:
· String: Apply this option for all data types whose property is not a mapped user name or password; for example, an integer or string.
· Mapped User: Apply this option when the URL parameter designates a user name that is required to authenticate the user with the information source at runtime.
· Mapped Password: Apply this option when the URL parameter designates a password that is required to authenticate the user with the information source at runtime.
§ When Mapped User and Mapped Password are selected, the Value and Personalize attributes cannot be edited.
§ If you want to enable user mapping for the user name and password parameters, in the System drop down-down list, choose an appropriate system already defined in the portal, which contains the necessary settings. See Selecting a System.
Personalize
Specifies whether or not portal end users can view the parameter and its assigned value if they personalize the iView at runtime. This attribute also allows you to determine whether or not end users can personalize the parameter value.
Choose one of the following options:
· Hidden: The end user does not see the parameter and its value. This is the default setting.
· Read / Write: The end user sees the parameter and is able to modify its value.
· Read Only: The end user sees the parameter and the fixed value assigned to it. The end user cannot modify the parameter value.
Name
Specifies an intuitive display name for the parameter identifier. If you set the parameter to be viewable by end users at runtime, this name is displayed instead of the parameter identifier, which is often abbreviated and unintuitive.
This attribute is available only if Read / Write or Read Only is selected in the Personalize attribute. If you do not specify a name, the Personalize attribute will be reverted to Hidden.
with regards
subrato kundu -
Setting user language explictly?
Hi everybody,
We want to use e-mail notifications for KM and our portal is connected to an Active Directory 2003 server. The problem is that there is no language defined for the ADS users, so notifications are sent in English even if I change the default portal locale in prtdefault.properties and prtcentral.properties.
If I explicitly set a different language in the user properties page the notifications are sent in the correct language for that user, but there must be a way to change this setting automatically for everyone? I tried messing around a bit with the datasource config xml files, but I couldn't find a way to set a specific value for a field. This is on EP6 SP2 Patch 30.
Thanks in advance!I see. I think I found the service responsible in the <i>com.sap.netweaver.bc.rf.service.par</i> file, by decompressing <i>bc.rf.global.service.notificator_api.jar</i> and decompiling the AbstractNotification.class file. I will also try finding a more standard solution.
Thanks
UPDATE: We received a working solution from OSS, here it is if anyone else needs it.
In the J2EE server startup parameters, we added the following lines :
-Duser.language=<language code>
and
-Duser.region=<region code>
Now notification emails are sent in the correct language. Strange, because this setting according to the help document is at lower priority than the request.mandatorylanguage settings, but it works!
Message was edited by: Olivier Tremblay-Ross -
Change the user portal language by code
Hi,
I want to change the portal user language by code .
Untill the user sets the portal language the default is the browser/or application .....
I want to write code that if the user didnt set the portal language ..then the language is set to X.
Any ideas ?
Thanks.Hi,
Try this....
IWDClientUser user=WDClientUser.getCurrentUser();
IUser myuser=null;
myuser=user.getSAPUser();
String userID=
try {
IUser myuser=userFact.getUserByLogonID( myuser.getUniqueName() );
IUserMaint usermaint=userFact.getMutableUser(myuser.getUniqueID());
usermaint.setEmail(wdContext.currentContextElement().getVa_Email());
Locale lc=new Locale("en");
usermaint.setLocale(lc);
usermaint.commit();
} catch (UMException e) {
wdComponentAPI.getMessageManager().reportException(e.getMessage(), false );
e.printStackTrace();
Regards,
Srinivas -
Setting user.timezone in jnlp
I have no success in setting the user.timezone property through the jnlp-file. I have seen a similar experience reported a couple of years ago:
http://forum.java.sun.com/thread.jspa?forumID=38&threadID=431709
Is it doable?
I can't set it in the code, because we are suffering from a timezone/thread-related bug reported (for instance) here:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6352812
Right now we are using aspects for the sole purpose of fixing this problem, but apparently that has it problems as well from time to time at the customer site.
Thanks!
/ClaesI think the "user.timezone" is consided as "unsafe" and cannot be set by JNLP; similar complain can be found when setting user.language see: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4683242
In fast there are only six properties considered to be �safe�:
sun.java2d.noddraw
javaws.cfg.jauthenticator
swing.useSystemFontSettings
swing.metalTheme
http.agent
http.keepAlive
See http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/syntax.html -
How to set selected Language from Portal dropdown in Logon to User profile
Hi Gurus,
I select a language in Portal Language dropdown in the Logon Page.
After login in the content is getting displayed in the browser language.
I want the portal content to be displayed in the selected language in the portal LogonPage.
I checked the thread Logon page change to add a dropdown for language
The is the requirement for me too .
Kindly suggest me on how to set the language in the Portal user Profile so that the portal contents gets displayed in the selected languages from the dropdown .
Thanks in AdvanceHi Prasanna,
The language that the portal is displayed in depends on the following
heirarchy, with the languages at the top of the list taking precedence
over those at the bottom:
1. Component (iview) language (defined in the portalapp.xml)
2. Portal Mandatory language (defined in the prtDefault.properties)
3. User language (defined in the user#s profile).
4. Request language (defined by the browser).
5. Portal Default language (defined in the prtDefault.properties)
6. System Default language (default locale defined by the OS).
So for example, if you have your portal user language (as in point 3)
set to Russian, but the language of the iView that is the logon page
(as in point 1) set to English, that logon page will be displayed in
English.
Keeping the above in mind, please make the necessary changes to the
configurations and check if it helps.
Regards,
Sowmya
Edited by: Sowmya K on Jun 2, 2011 11:32 AM -
Is there any way to set global language as english for users in portal
Hi,
Is there any way to set global language as english for all the users in portal (for all the screens,applications etc) irrespective of browser settings,language in jco,user settings in backend .
the reason why i am asking is we are implementing global implementation project and for some users in switzerland because of their browser is not english they are getting language other than english.we dont want to ask each user to change their browser language.we just want to force the portal to display content only in english
Thanks
Bala DuvvuriHi ,
You can add property 'request.mandatorylanguage=<your_language>'
and property 'request.mandatorycountry'
on file 'prtDefault.properties' located in :
..server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\system\properties\prtDefault.properties
Then restart the server.
See :
http://help.sap.com/saphelp_nw70/helpdata/EN/42/938297a5061d69e10000000a1553f6/frameset.htm
Regards,
Gilad -
How to set the language of a mail template from NotificationUtil?
Hi experts!
I've been having some issues with the Message Template Language when using the NotificationUtil to send an Email.
How do I set the language of the template?
Do i set this by the sender? Or do I need to reference the recipient?
If so, how could I get the Account Object Interface from the user given that I got him as a collaborator?
I wish you could help me out whit this language problem.
Here's an example of the code I'm using:
Properties params = new Properties();
params.put(new String("PHASE_NAME"), faseName);
params.put(new String("DOCUMENT_TYPE"), docType);
params.put(new String("DOCUMENT_NAME"), contractName);
params.put(new String("OWNER_FIRST_LAST_NAME"), owner.toString());
params.put(new String("START_DATE"), fecha);
params.put(new String("INSTRUCTION"), "");
params.put(new String("DOCUMENT_HEADER_URL"), vinculo);
String[] recipients = {mail};
sender = session.getAccount();
mailTypeEnum = new MailTypeEnumType(MailTypeEnumType.ODP_WORKFLOW_APPROVAL_REQUEST_MSG);
NotificationUtil.sendNotification(recipients,sender, mailTypeEnum,params,null,null);
Thanks in Advance!Hi vikram!
Sorry for the still inconvenience, but I'm getting this error:
Error in method invocation: Static method sendNotification( com.sap.odp.usermgmt.masterdata.UserAccountBo, com.sap.odp.usermgmt.masterdata.UserAccountBo, com.sap.odp.api.comp.messaging.MailTypeEnumType, java.util.Properties, null, null ) not found in class'com.sap.odp.api.util.NotificationUtil'
Im making the code the following way:
Properties params = new Properties();
params.put(new String("PHASE_NAME"), faseName);
params.put(new String("DOCUMENT_TYPE"), docType);
params.put(new String("DOCUMENT_NAME"), contractName);
params.put(new String("RECIPIENT_FIRST_NAME"), nombre);
params.put(new String("OWNER_FIRST_LAST_NAME"), owner.toString());
params.put(new String("START_DATE"), fecha);
params.put(new String("ORG_UNIT"), orgUnit);
params.put(new String("INSTRUCTION"), "");
params.put(new String("DOCUMENT_HEADER_URL"), vinculo);
recipients = IapiAccountLocator.lookup(session, collaborator.getPrincipal()); // This Changed.
( I also tried like this:
IapiAccountIfc recipients = IapiAccountLocator.lookup(session, collaborator.getPrincipal());)
sender = session.getAccount();
mailTypeEnum = new MailTypeEnumType(MailTypeEnumType.ODP_WORKFLOW_APPROVAL_REQUEST_MSG);
NotificationUtil.sendNotification(recipients,sender, mailTypeEnum,params,null,null);
Thanks again! -
Mapping User Language vom LDAP to Portal Users
Hi,
Anyone knows how to map the user language available in an attribut from LDAP to the portal user language?
(Working on NW04)
Regards,
MartinHI,
For 2004s SP10,
althought the manual tells you to use the preferredlanguage attribute in the datasource. Use the attribute 'locale' to map to your LDAP specific language attribute.
example <attribute name="locale">
<physicalAttribute name="preferredLanguage"/>
</attribute>
Use the 2-characters ISO language code set. For example en for English, nl for Dutch and de for German.
Works fine for us.
good luck,
Joachim van Essen -
EP 6.0 - Setting preferred language before login
Hello,
We are currently looking at ways of allowing user to set their user language before logging in. On the logon page we want to provide a select box where user can select their default language. The user would enter the username, password, language and click logon button. Upon
logon the Portal content will be displayed in the language selected. I looked in the logon component 'com.sap.portal.runtime.logon.par' on the logon page and there a portion of the code that checks if UME
property 'ume.logon.locale' is set to TRUE and if that is the case it displays the language select. I've modified the UME property file '\usr\sap\J2EE\j2ee\j2ee_00\ume\sapum.properties' and everything displays correctly however upon logon the content language does not get set to the specified language. Can you tell me what I am doing wrong? Am I missing anything and is this possible?
<%
if( UMFactory.getProperties().getBoolean("ume.logon.locale",
false) ) {
%>
<tr>
<td width="200" height="20">
<label class="urLblStd" for="preferredlanguage">
<nobr><%=logonLocale.get("LANGUAGE")%></nobr>
</label>
</td>
<td >
<select id="ume.logon.locale"
name="ume.logon.locale"
class="urDdlWhl" size=1>
<option value="en">English</option>
<option value="fr"><%=EncodeHtmlTag.encode
("Fran\u00E7ais")%></option>
</select>
</td>
</tr>
<%
%>
Thanks in advance,
RabihHi Rabih,
I'm having the same problem... Did you find a way to get this parameter working ?
Thanks & regards -
Render page as per User language after login
Hello,
I am using Jdev 11.1.1.6 with ADFBC and Faces.
In our application, user can set default language. It is expected that after login, all contents should be displayed as per user language locale (assuming locale is supported and locale specific resource bundle exists).
So there is SignInPage and HomePage. I need to access the DB (using methodAction binding for a AM method, that reads the user preference and returns the language) before forwarding to HomePage.
Code to forward to HomePage is something like this:
FacesContext ctx = FacesContext.getCurrentInstance();
RequestDispatcher dispatcher =
request.getRequestDispatcher(forwardUrl);
dispatcher.forward(request, response);
ctx.responseComplete();
End User locale handling is done by defining ViewHandler class in faces-config file. Implementation is explained here
Problems faced:
1) I tried to execute the operation binding but got null pointer...in FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
2) I tried to redirect using external.encodeActionURL(actionURL) but got illegalStateException...Response is already committed
It works fine if user after login either just press F5 to refresh the page OR reset the language again using the preference screen.
How do I get it to work at login? Where can I tap-in the methodAction call between SignInPage and HomePage, so that HomePage is rendered according to language?
Any help/pointer is highly appreciated.
Thanks,
JaiHi,
1) I tried to execute the operation binding but got null pointer...in FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
If you mean ADF operation binding then this only is available if a request is routed through the binding filter. Note that the PageDef file for a page needs to be parsed before the content becomes available as an object at runtime.
2) I tried to redirect using external.encodeActionURL(actionURL) but got illegalStateException...Response is already committed
Why don't you use facesContext --> externalContext --> redirect(...) to perform the redirect, The dispatcher.forward() surely doesn't do this
3) How do I get it to work at login? Where can I tap-in the methodAction call between SignInPage and HomePage, so that HomePage is rendered according to language?
Programmatic authentication as explained in the Fusion Developer Guide (chapter 30 if I recall correctly) would give you a chance to set the language. However, the language is not set on the ViewObject but should be set on JSF by changing the default language, e.g.
FacesContext.getCurrentInstance().getViewRoot().setLocale(Locale.ENGLISH);
Frank -
Hi all,
i am trying to work on internationalization concept.
My requirement is at the time of user creation if no language is set then browser language need to work.
With the help of Iuser i can access user property, but i didn't got any function for language, for Locale is there i.r user.getLocale() may be.
Is this locale will give the Language set at the time of user creation.
How to deal with the Server Locale/Language, User Language and Browser language setting.
In what order in the code level i need to manage these three and how.
Regards,
DeepakFor Internationalization of Dynpro Applications, you need to maintain .xlf files as in the [tutorial|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c6cfad90-0201-0010-a5b8-8f9486346059].
Browser settings needed to display application in particular language.
refer thread: [Portal Internationalizationa|Portal Internationalization..urgent]
nikhil -
Set a language on the portal application
Dear All,
How I can write code to set a language on the portal application?
thanks in advance,
Marcelo OsakoHi Marcelo,
I assume you mean how to change language for a single iView only. For changing overall language, the user can just go to the portal personalize page.
For an iView, you can do a lookup of the iView and change the language, like so:
InitialContext iCtx = null;
String personalHello = "portal_content/DanielContent/DanRole/danWS/hello";
try {
iCtx = new InitialContext(env);
IiView myIView = (IiView)iCtx.lookup(personalHello);
myIView.putAttribute("ForcedRequestLanguage","de");
myIView.save();
You would have to do a personalized JNDI lookup, so the language is only changed for the user. However, this would permanently change the page for this user.
Hope this helps.
Daniel -
Clearing Payment to a G/L account set up in Reason Code
I am having a problem posting an overpayment/underpayment to a G/L account using a reason code. What I am attempting to do is, using F-28, have the remainder of an underpayment post to a G/L account attached to the reason codes. What I need to have work is that in F-28 I do not want to have to enter any data on what the residual amount is, it should just take whatever is not paid and apply it to the G/L account tied to the reason code. I have set 3 new reason codes in OBBE to test different possibilities with the checkboxes in that transaction, and have attached each of the reason codes to accounts using OBXL. What is happening now is that when I enter a short pay amount for an invoice and I enter a reason code in the RCd field in the residual tab - I hit save and it seems to try to attach the remaining amount to an account that is currently tied to a blank reason code in our setup in OBXL. I would think that since I am placing a code in the RCD field, that it would use the account tied to that. I have also tried to use the reason code field below, but encounter the same results or, with one of my codes that has the "charge off difference via separate account" checkbox checked, it will not allow that code in that field below.
There must be a way to take the shortpay amoun,t and without entering the residual amount anywhere, use the G/L account tied to the reason code to post the remainder to. Can anybody help on what I may need to do to get this to work?
Thanks -
PS. This is not a tolerance issue as I have set the tolerances for both the customer and the user high enough to allow under/overpayments.No... this is SAP standard.... if you are treating them as residual payment and the GL is seperate than the small diff GL we have to enter the amount there..... as system cannot understand whats the differnece when we dont put the amount there......
we can always see the field NOT ASSIGNED in the bootom.. it is just the matter of copy paste for the user.... it has to come thro user discipline.... i dont see a standard sap way of doing it,.... -
Currency setting in multiple company code.
Dear all,
we are having 3 company codes in one client.
and we have to set the Currency setting for multiple company codes.
Tcodes
S_BCE_68000174 - Enter Translation Rates
S_ALR_87003642 - Open and Close Posting Periods
it is not allowing us to set the values at a same time for different company codes by different users
it says " DATA LOCKED BY OTHER USER, ONLY DISPLAY MODE."
Pls assist
ThanksAsk for access to delete lock entries. If access is provided, use T code sm12 to delete the lock entries.
@ Irfan you cannot do that. Only one user can use a table at a time.
It is like using an ATM. Only one person can withdraw money at a time.
Edited by: Dummy_Variable on Jul 27, 2011 9:34 AM
Maybe you are looking for
-
Frozen up screen with an icon of a battery with a red slash thru it??
I've never seen this one before. Out of the blue, my screen goes kinda dim and pic of a battery with red line stoking through it (kind of like a no smoking sign). It's frozen....no buttons do anything. I've taken the batter out and re-inserted it, pl
-
Satellite L350-159 - Can I install a graphics card?
Hello everyone, I got a friend to check what graphics card I had the other day, as I play games and noticed that the graphics weren't fantastic. He checked it out and then told me I actually haven't got a proper graphics card! I'd love to remedy this
-
MY ITUNES WONT OPEN?, can anyone help???
when i double click on my itunes icon to open it wont open, i have reinstalled it about four times and still nothing, anyone got any idea"s?
-
I have a LG optimus mobile. Can I find a download for firefox mobile
My phone cannot find the searched for item when I choose download for android on fire fox for mobile page.
-
About parameter with defaultConnectionName
Hello Sir, I need to know pameter defaultConnectionName in use:ISAStateless,ISAStateFul example : defaultConnectionName="ISAStateless" <config isa:extends="../config[@id='crmdefault']"> <businessObject type="Z_CustomBO_Search" name="Z_CustomBO_Searc