Hi,
I want to translate text from one language(eg, malay) to other languages(eg, english) in java/jsp . How to do this. Help me please. urgent!
Thanks

Are you talking about localization where you can change the labels of your page to the language of your choice, or you want the user to enter a word and the page will translate it?

yes, I want the user to enter a word or text and the page will translate it? Interface done but function not yet...can u help me??

yes, I want the user to enter a word or text and the page will translate it? Interface done but function not yet...can u help me??

I don't know or don't believe that java core has such methods or classes. You may want to search the net for some other libraries

Embedded Google translator should solve it. What you think javaAddict?

so sad! how can i do this...

so sad! how can i do this...

You already got some recommendations. It is up to you to use it, we are not here to write it all for you.

Embedded Google translator should solve it. What you think javaAddict?

It looks interesting. Maybe not like how the OP would have imagined, but if it does the trick, it's up to the poster's choice.

Yes i got some that recommendations. thanks for your both. But i still cannot use. No suitable lorh..i'm using eclipse for run this code.

Yes i got some that recommendations. thanks for your both. But i still cannot use. No suitable lorh..i'm using eclipse for run this code.

You see, me and javaAddict are looking at it the way as "is it something that someone already created and I can re-use it" where you look at it as "I have to create it, what will I do???". My point, I will not try to re-invent wheel if I'm happy with someone else resources, which in this case Google Translator script would do perfectly for me...

sowy2 i still blur. Peter Budo can u help me..? This is my code. So where i need put code u give just now from google translator. I already done but still no functionality.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Translation</title>
</head>
<body>
<p><b>Enter Text</b></p>
<p>
  <label>
  <textarea name="Enter Text" cols="45" rows="5"></textarea>
  </label>
</p>
<p>
  <label>
  <select name="select language">
  		<option value="1">English - Malay</option>
    	<option value="2">Malay - English</option>
  </select>
  </label>
  <label>
  <input type="submit" name="submit" id="submit" value="Translate"/>
  </label>
  <label>
  <input type="reset" name="reset" id="reset" value="Clear Text" />
  </label>
</p>
<p>&nbsp;</p>
<p><b>Translation Result</b></p>
<p>
  <label>
  <textarea name="Translation Result" cols="45" rows="5"></textarea>
  </label>
</p>
</body>
</html>

Now I see what you mean. The link that I provided wouldn't help you as you are looking for user entry to translate instead of straight forward translation of stuff like static pages. In your case then I would try to investigate Google Translate API v2

hehe..yep i also see the link n try practice but still cannot function. Now i try this coding below. Can la but i cannot display in textarea but display in msgbox. Can anyone help???? adjust or add something in this coding..

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <script type="text/javascript" src="http://www.google.com/jsapi"></script>
      <style type="text/css">
               .marginL5{margin-left:5px;}
               .marginB10{margin-bottom:10px;}
      </style>
      <script src='__UP_resourceDir__js/logging.js'></script>
      <script src='__UP_resourceDir__js/els-footer.js'></script>
      <link href='__UP_resourceDir__css/gadget-standard.css' rel='stylesheet' type='text/css'/>
      <title>Translation</title>
</head>

<body>
 <script>
        google.load("language", "1");

        function translate() {
          var text = t1.value;

         google.language.detect(text, function(result) {
            if (!result.error && result.language) {

             google.language.translate(text, result.language, "en",
                                        function(result) {
                var translated = document.getElementById("translation");
                if (result.translation) {

                  var searchTerm=result.translation;
                   //translated.innerHTML = result.translation;
                   var search_Inputs=result.translation;

  doIt=confirm('Your entry is translated as ' + searchTerm + '. Do you wish to proceed with Hub search using this search term(s)?');
  if(doIt){
               gadgets.hub.executeSearch(search_Inputs);
               }

                }
              });
            }
          });
        }
  </script>

<p><b>Enter Text</b></p>
<p>
  <label>
  <textarea style="text" id="t1" name="t1" cols="45" rows="5"/></textarea>
  </label>
</p>
<p>
  <label>
   <select onchange="updateTransLang()" id="dst" name="dst">
                                                           <option value="en">English</option>
                                                          
                                                           <option value="ms">Malay</option>
                                                           
</select>
  </label>
  <label>
  <input type=submit id="translate" value="Translate" onclick="translate()"/>
  </label>
  <label>
  <input type="reset" name="reset" id="reset" value="Clear Text" />
  </label>
</p>
<p>&nbsp;</p>
<p><b>Translation Result</b></p>
<p>
  <label>
  <textarea style="search_Inputs" id="result" name="result" cols="45" rows="5"/></textarea>
  </label>
</p>
</body>
</html>

Latest..i got new coding can display in textarea but button not function lorh..anyone can help???

<html> 
<head> 
        <title>Translation example</title> 
        <script type="text/javascript" src="js/jquery-1.2.6.min.js"></script> 
        <script type="text/javascript" src="js/jquery.copyEvents.min.js"></script> 
        <script type="text/javascript" src="js/jquery.translate-1.1.1.js"></script> 
        <script type="text/javascript"> 
                function startTranslation(){ 
                         var sourceText = $('#original').val(); 
                        $.translate(sourceText,'es','en', { 
                                start:          function(){   $('#throbber').show() }, 
                                complete:       function(translation){ 
                                                                $('#translated').val(translation); 
                                                                $('#throbber').hide(); 
                                                        }, 
                                error:          function(){   $('#throbber').hide()   } 
                        }); 
                } 
        </script> 
</head> 
<body> 
        <p>Original<p> 
        <textarea rows="10" cols="60" id="original" ></textarea> 
        <br/> 
        <input type="button" onclick="startTranslation();" value="Translate"/> 
        <span id="throbber" style="display:none;">Translating...</span> 
        <p>Translated</P> 
        <textarea rows="10" cols="60" id="translated"></textarea> 
</body> 
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="google-translate-customization" content="e6d13f48b4352bb5-f08d3373b31c17a6-g7407ad622769509b-12"></meta>

<script type="text/javascript">
    function googleTranslateElementInit() {
    new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');

    }
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" type="text/javascript"></script>
 <script src="js/jquery.selectBox.js" type="text/javascript"></script>
 <style type="text/css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

/* to hide the toolbar and tooltip - START */

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="google-translate-customization" content="e6d13f48b4352bb5-f08d3373b31c17a6-g7407ad622769509b-12"></meta>

    <script type="text/javascript">
        function googleTranslateElementInit() {
        new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');

        }
    </script>
    <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" type="text/javascript"></script>
     <script src="js/jquery.selectBox.js" type="text/javascript"></script>
     <style type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

/* to hide the toolbar and tooltip - START */
.goog-tooltip {
    display: none !important;
}

.goog-tooltip:hover {
    display: none !important;
}

.goog-text-highlight {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.goog-te-banner-frame {
    padding:0;
    display: none !important;

}

body {
    top: 0 !important;
}

.skiptranslate {
    height: 30px;
    overflow: hidden;
}
/* to hide the toolbar and tooltip - END */
</style>
</head>
<body>
<div id="google_translate_element"></div>
<script type="text/javascript">
    function changeGoogleTranslate() { 
        if ($('.goog-te-combo option:first-child').text() == "Select Language") {
            $('.goog-te-combo').selectBox().change(function () {
                var gObj = $('.goog-te-combo');
                var db = gObj.get(0);
                gObj.val($(this).val());
                fireEvent(db, 'change');
            });
        } else {
            setTimeout(changeGoogleTranslate, 50);
        }
    }
    changeGoogleTranslate();
    function fireEvent(el,e){
        if (document.createEventObject){
            //for IE
            var evt = document.createEventObject();
            return el.fireEvent('on'+e,evt)
        }
        else{
            // For other browsers
            var evt = document.createEvent("HTMLEvents");
            evt.initEvent(e, true, true ); 
            return !el.dispatchEvent(evt);
        }
    }
    </script>
   <p> <textarea rows="10" cols="10"> enter the correct language text
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.