Open GoogleCodeExporter opened 9 years ago
Dear / Sir Madam,
This works for a chuck of text on my page, but when doing the following it just
pulls the last letter.
$.getScript('../jquery.translate.js', function(){
$.translate.load('301C79ACA55C1ECCD790B3131DE91DFA1205895A');
$.translate( 'some text', 'en', 'de', {
complete: function(translation){ alert(translation); }
});
});
So 'some text' returns alert with just 't' in it.
Regards
Bykenhulle
Original comment by Ross.N.B...@gmail.com
on 6 Dec 2011 at 10:24
[deleted comment]
Hello,
thank you for all, but can you tell me how I can use your jquery.translate.js ?
On my web site it don't work !
I am using old code for Google Translate (without Bing).
This is the code :
<script type="text/javascript" src="catalog/view/javascript/jquery.js"></script>
<script type="text/javascript"
src="catalog/view/javascript/jquery.translate.js"></script>
<script type="text/javascript"
src="catalog/view/javascript/jquery.cookie.pack.js"></script>
<script type="text/javascript">
jQuery(function($){ //when DOM is ready
$.translate(function(){ //when the Google Language API is loaded
function translateTo( destLang ){
var tlc = $.translate().toLanguageCode // create a shorthand
if( tlc( destLang ) == "it" && tlc($.cookie("destLang")) == "it") // hide loading icon when surfing in English
return;
$.translate.load('my appid from Bing');
$('body').translate( 'italian', destLang, { //translate from english to the selected language
not: '.translate_dropdown', //by default the generated element has this id
fromOriginal:true, //always translate from english (even after the page has been translated)
start: function(){ $('#throbber').show() }, // show loading icon
complete: function(){ $('#throbber').hide() }, // hide loading icon
error: function(){ $('#throbber').hide() } // hide loading icon
});
}
$.translate().ui('select','option')
.val('Italian')
.appendTo('#translate_dropdown') //insert the element to the page
.change(function(){ //when selecting another language
translateTo( $(this).val() );
$.cookie('destLang', $(this).val() );
// set a cookie to remember the selected language
return false; //prevent default browser action
})
$('#flags a') // added to include the flag thing
.val('Italian')
.click(function(){
var lang = $(this).attr('id');
translateTo( lang );
$.cookie('destLang', lang );
return false;
})
var destLang = $.cookie('destLang'); //get previously translated language
if( destLang ) //if it was set then
translateTo( destLang );
}); //end of Google Language API loaded
}) //end of DOM ready
</script>
With this code on Mozzilla Firefox I receive this error :
Key is undefined on line 729 of jquery.translate.js
Can you help me ?
Thank You
Original comment by virtuala...@gmail.com
on 20 Dec 2011 at 2:18
Original issue reported on code.google.com by
akb...@gmail.com
on 6 Dec 2011 at 8:14Attachments: