cancel
Showing results for 
Search instead for 
Did you mean: 

Change label language

Former Member
0 Kudos

Hi,

i have a bsp application. In it, i use OTR to make it multi language. But i use the htmlb object Upload. My question is : how can i change label of the browse button ? Because, i am French and it's write "Parcourir ..." but i have choose English as language of my application (OTR are well translated)

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

rainer_liebisch
Contributor
0 Kudos

Hi Cedric,

have you tried it with the following:

set the attribute of htmlb:fileUpload

upload-text = "<%= otr(alias) %>" where alias is the alias of the name in the OTR.

You can make entries or look at entries via

se80 -> Goto -> OTR Browser

There you can set an alias for your object and translate it in every language. Maybe there is already an entry for 'Upload'.

Hoping this helps.

Regards,

Rainer

Former Member
0 Kudos

Ok, here's my code :

<htmlb:fileUpload id = "myUpload"

onUpload = "HandleUpload"

upload_text = "+"

size = "40" />

It generate a input field, a button whith "Parcourir...' (Browse..) and a button which label is +

I want to change "Parcourir..." i think it like my browser language and i have to make the three fields invisible and simulate click on them with other object.

Thanks all

Former Member
0 Kudos

> I want to change "Parcourir..." i think it like my

> browser language and i have to make the three fields

> invisible and simulate click on them with other

> object.

So it is the button label you mean. This is connected to your OS and to your browser.

Check out this link from <a href="http://www.w3.org/TR/REC-html40/interact/forms.html">W3C.org</a> for more details on the input type and the labels.

Unfortunately there are not a whole lot of <i>browser friendly</i> options for this input control and I would assume (I know bad thing to do sometimes) that SAP is using the standard HTML input type of file for this button.

I <b>do not recommend</b> this method but it does work.

We have added a JavaScript function to apps that we link to a standard button.


function selectFolder(id) {
  var myText = "Browse for file";
  var objShell = new ActiveXObject("Shell.Application");
  var ssfWINDOWS = 0;
  var objFolder;
  objFolder = objShell.BrowseForFolder(0, myText, 0, ssfWINDOWS);
  if (objFolder != null) {
     alert(objFolder.Items().Item().Path);
  }
} // selectFolder

That bit of code gives you a folder select dialog box.

From there you iterate with JavaScript through the files in the folder and add those to a listbox or other control. Then the user selects that. It's a lot more work with the potential for a lot more problems but it does give you 100% control over the layout, files listed, and labels.

Perhaps one of the SAP guys, BRIAN!!!!!, might have a better idea using something other than all the JavaScript.

Message was edited by: Craig Cmehil

Former Member
0 Kudos

Here is the complete code on a single page for a custom file browser. Again not a recommended solution from me but if you are in a tight spot and need it, it does work.

It uses an ActiveX component to list the files in the directory, and it does only list a single directory it does not allow for sub directories. That can be done but it's a bit more complicated with the JavaScript.


<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">
  <htmlb:page title = "Test File List ">
    <htmlb:form id="myform" method="GET">

    <htmlb:inputField id="myFile"
                visible="true" 
                width="300px" /><br>

    <htmlb:listBox id="filelist" 
                width="300px" />

    
    <script>
    function selectFolder(){
      var myText = "Browse for file";
      var objShell = new ActiveXObject("Shell.Application");
      var ssfWINDOWS = 0;
      var objFolder;
      objFolder = objShell.BrowseForFolder(0, myText, 0, ssfWINDOWS);
      if (objFolder != null) {
         document.forms.myform.myFile.value=objFolder.Items().Item().Path;
         getFileList(objFolder.Items().Item().Path);
      }
    }
    
    function getFileList(id) {
      var FSO = new ActiveXObject("Scripting.FileSystemObject");
      var myStartingFolder = id;
      if ( myStartingFolder != null || myStartingFolder != "" ) {
        var myFolder = FSO.GetFolder( myStartingFolder );
        var myFileList = new Enumerator(myFolder.files);
	 // First clear all entries
        document.forms.myform.filelist.options.length = 0;

	 for (; !myFileList.atEnd(); myFileList.moveNext()) {
document.forms.myform.filelist.options[document.forms.myform.filelist.options.length] = 
new Option(myFileList.item().name,FSO.GetFileName(myFileList.item()));
	 }
	} // start folder found
			
    } // getFileList
    
    </script>

    <htmlb:button id="myButton"
            onClientClick="selectFolder()"
            text="Browse" />

    </htmlb:form>
  </htmlb:page>
</htmlb:content>

Message was edited by: Craig Cmehil

former_member181879
Active Contributor
0 Kudos

<u>To Craig:</u> No, no, no! We can no ship stuff that starts using activeX.

<u>To Cedric:</u> I have not within the last three days explained why this will not work. I don't mind investing (some) personal time here. However, my expectations are very high in what you must bring to the table. At a minimum, read each and every append here.

This problem of the langauge in the fileupload button has now been beaten to death. Please read the which you started!

Former Member
0 Kudos

Just to completely beat the horse dead...

<a href="http://www.cs.tut.fi/~jkorpela/forms/file.html">File Input Field</a>

Particulary interesting in this site is the <a href="http://groups.google.com/groups?oi=djq&as_umsgid=%3C38119FEE.DFF60EBA%40sector27.de%3E">link</a> that points to this message


With <a href="http://developer.netscape.com/docs/manuals/communicator/jsguide/scripts.htm">signed script</a> in NN
 
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserWrite');
  document.formName.inputName.value = 'whatever'

And with that it begs the question, where is the hole in IE that allows that as well?

Some have chosen the ActiveX approach which causes not only problems but also concerns.

Others have chosen something like this:


<form>
 <input type="file" name="myfile" style="display:none" onchange="fileName=this.value"> 
 <input type="button" value="open file" onclick="myfile.click()"></p>
 <input type="button" value="show value" onclick="alert(fileName)"> </p>
</form>

As you can see the button activates the file upload since the file upload is actually hidden on the page.

With that (considering most is just re-stating previous messages) I would say that perhaps one of the moderators might lock this message?

Former Member
0 Kudos

About 5 messages ago they talked about this topic.

Reading through the message I notice that the solution they give should work for you as well. You'll have to try it though.


<%  
   SET LOCALE LANGUAGE 'S'.          
%>
<OTR>Test</OTR><br>

You can also check out this great weblog: <a href="/people/thomas.jung3/blog/2004/07/13/bsp-150-a-developer146s-journal-part-vii--dealing-with-multiple-languages-english-german-spanish-thai-and-polish – a Developer’s Journal: Part VII - Dealing with multiple languages (English, German, Spanish, Thai, and Polish)</a>

Message was edited by: Craig Cmehil

Former Member
0 Kudos

No, it doesn't work. My question is not to change SY-LANGU for OTR (taht's work already) but with the object Upload, whatever the value of SY-LANGU, it remains in my browser language.

Former Member
0 Kudos

You mena your browser language itself or just the language of the "file" button?

Have you looked at this topic? , opps of course you have you participated in the discussion.

The browser language itself comes from the PC so if your Operating system is English typically your browser buttons such <input type="file"> shows the button in English but if your OS is German then typically it shows it in German.

OK if I am off base here you'll need to be a bit more specific please.