Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2011
    Thanked 0 Times in 0 Posts

    problem with jQuery translate plugin

    I want to translate text or word from one language(eg, malay) to other languages (eg, english). But this code below cannot function. Anyone can help me??

    <script type="text/javascript" src="jquery-1.2.6.min.js"></script>
    <script type="text/javascript" src="jquery.translate-1.1.6.js"></script>
    <script type="text/javascript">

    function startTranslation(fromlang, tolang, fromId, toId){

    var sourceText = $('#'+fromId).val();

    $.translate(sourceText, fromlang, tolang, {

    start: function() { $('#throbber').show() },

    complete: function(translation) { $('#'+toId).val(translation); $('#throbber').hide(); },

    error: function() { $('#throbber').hide() }


    <p>Original text<p>
    <textarea rows="10" cols="60" id="text1" ></textarea>
    <span id="throbber" style="display:none;">Translating...</span>
    <p>Translated text</P>
    <textarea rows="10" cols="60" id="text2"></textarea>
    <input type="button" onclick="javascript:TranslateTextArea2('en', 'ml', 'text1', 'text2');" value="Translate English to Malay" />
    <input type="button" onclick="javascript:TranslateTextArea2('ml', 'en', 'text1', 'text2');" value="Translate Malay to English" />

  2. #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    London, England
    Thanked 2,699 Times in 2,675 Posts
    Do please read the posting guidelines regarding silly thread titles. The thread title is supposed to help people who have a similar problem in future. Yours is useless for this purpose. You can (and should) edit it to make it more meaningful.

    You would do better to post this thread in the jQuery section of this forum. Ask a mod to move you over.

    Even I can see that there is a missing bracket in

    $.translate(sourceText, fromlang, tolang, {

    Will your program translate "Kakak ku kata, kuku kaki ku kotor. Ku kikis kuku kotor kaki ku"?

    It is your responsibility to die() if necessary….. - PHP Manual
    Last edited by Philip M; 10-30-2011 at 12:16 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts