|
List of available languages: http://code.google.com/apis/ajaxlanguage/documentation/reference.html#LangNameArray If you don't specify a source language it will be automatically detected. But in many cases it's better to set that too. You can use the long name of the language or just the language code ('en' or 'english') and it isn't case-sensitive either. $(function(){ //on document ready
//to german from any language:
$('body').translate('de');
//from english to german:
$('body').translate('en', 'de');
//with options:
$('body').translate('de', { toggle: true } );
$('body').translate('en', 'de', { fromOriginal: true } );
//you can set the languges in the options too (setting as a separate parameter like above overrides it):
$('body').translate( { from: 'en', to: 'de', fromOriginal: true} );
//as of v1.4 you can also pass a complete callback as the third argument:
$('body').translate('en','de', function(){ alert("complete"); });
})OptionsOverride defaults with $.fn.translate.defaults: $.fn.translate.defaults = { returnAll:true };
//or
$.fn.translate.defaults.returnAll = true;These are the default values after each option: - fromOriginal: false / default changed to true in v1.4 /
- use only if you have specified a source language
- if you have translated elements to a language and want to translate them again this will force the plugin to use the original text (from the language you specified to translate from) as the source text
- toggle and data will be true automatically
- toggle: false
- true: all translation will be cached (stored with $.data) and used if it's found, or translated to otherwise
- if the text on the page doesn't change you can set it to true: this will return the translation immediately if it was stored before
- async: false
- this prevents the browser from freezing on larger sites by executing each filtering iteration with a delay (it doesn't affect the request sent to Google)
- you can set the length of the delay in ms, setting it true means 2 ms
- the returnAll option won't work, it will return the jQuery object immediately
- data: true
- store source and translated text with $.data
- $(el).data("translation")[langCode][type] where type is either "html" or the name of an attribute:
- $("p").data("translation")["en"]["html"] or $(":input").data("translation")["en"]["value"]
- changed in 1.4.0: "$val" and "$html" is used instead of "value" and "html" ("attribute" can be used more safely)
- walk: true
- true: finds elements having textnodes and translates only their content; on very large and complex pages this might take some time (see the async option)
- false: translates the given elements' .html(), generates more requests
- this requires the jQuery.fn.nodesContainingText plugin (included along with other modules)
- returnAll: false
- true: returns all elements, which have textnodes (see the walk option)
- using .end() after this returns the caller object
- false: returns the caller jQuery object
- not: ""
- selector - elements to leave out (script, noscript, style, object and iframe elements will be omitted either this is set or not)
- doesn't work for elements having textnode siblings, as the whole content of their parent node will be translated (see the walk option)
- replace: true
- replace original text on the page with the translation
- rebind: true
- rebind event handlers for elements translated as html (see the walk option)
- subject: true
- if some text is given, only that html attribute will be translated
- altAndVal: true
- translate alt and :button,:text,:reset's value attribute too when translating text/html
- these don't have any textnodes, so they can be processed along with other nodes if the subject option is true
- setLangAttr: false
- store destination language code in the html lang attribute for each element
- true: set the 'lang' attribute
- false: don't set any attribute
- string: set that html attribute
- comments: false
- removed in v1.4
- true: translates comments too when an element's .html() is tranlated,
- false: removes the comments, when an element's .html() is tranlated
- comments might be only translated if they have textnode siblings (see the walk option)
options added in v1.4- stripWhitespace: true
- stripScripts: true
- stripComments: true
- limit: 1750
- here you can specify how long the url-encoded text should be that is sent to the Language API
- the whole url must be less than 2000 characters long including the domain name and other parameters
- you can increase this value slightly, but if it gets too large some requests will fail
- separators: /\.\?\!;:/
- a regex that specifies the end of a sentence
Callback functionsThese are passed to the options too. You can use the internal methods after this inside these, and the object's properties are also available: - this.i //the index of the current element
- this.elements (array) // filtered elements, this.elements.end() returns the caller object (unfiltered)
- this.translation (array)
- this.source (array)
- this.options
- this.from //langCode
- this.to //langCode
$('body').translate('en', 'de', {
each: function(i){
console.log( this.translation[i] ) // i==this.i
}
})- start: function(){}
- arguments: elements (jQuery object), from, to, options
- these are the filtered elements if the walk option was true (use .end() to return the original set)
- v1.4.0: arguments: filtered elements, source, from, to, options
- error: function(){}
- google's results.error object will be passed (an error stops the script completely)
- if you stop the translation with the internal stop() method it returns {message:'stopped'}
- each: function(){}
- executes after each element was translated
- arguments: i, DOMelement, translation[i], source[i], from, to, options
- complete: function(){}
- arguments: original elements, filtered elements, translation (array), source (array), from, to, options
- v1.4.0: the original elements object was removed, use elements.end() instead
- the from argument is the sourceLangCode from the last part of the translation (if it was detected then that one)
- onTimeout: function(){}
- the requests won't be aborted automatically (use this.stop() inside it if you want to stop it)
- arguments: filtered elements, from, to, options
- v1.4.0: arguments: filtered elements, source, from, to, options
- use elements.end() to get the original set of elements
- timeout: 0
- time after the onTimeout will fire (in ms)
In the comment below you may notice the copyEvents plugin: this is no longer needed, a bit different function is included in the plugin.
|
Just a simple example
<html> <head> <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(){ $('#textToTranslate').translate( 'es', 'en', { not: 'select', start: function(){ $('#throbber').show() }, complete: function(){ $('#throbber').hide() }, error: function(){ $('#throbber').hide() } }) } </script> </head> <body> <p id="textToTranslate">Gracias jQuery Translate Plugin</p> <input type="button" onclick="startTranslation();" value="Translate "/><span id="throbber" style="display: none;"> Translating...</span> </body> </html>Hi,
Many thanks for your response on the official Jquery Issue.
I'm sorry, but I've some trouble with the 'replace' option. I'm a beginner in JS (it's not a shame or an excuse ;) ) and I would like to learn the "how-to".
There is a sample code :
<html> <head> <script type="text/javascript" src="js/jquery/jquery-1.2.6.min.js"></script> <script type="text/javascript" src="js/jquery/plugin.translate.js"></script> <script type="text/javascript"> $(document).ready(function(){ // translate to english all ID col* $('#translationEN').click(function(){ $('[@id*=col]').translate('en', { start: function(){$('#translationProgress').show()}, complete: function(){$('#translationProgress').hide()} }); }); // I would like to comeback to the original text, but... i don't understand how to proceed :/ $('#translationFR').click(function(){ $('[@id*=col]').translate('', { replace: false // Uh :| I suppose it's not the good way... }); }); }); </script> </head> <body> <div id="translate"> <a href="#" id="translationFR">FRANCAIS</a> | <a href="#" id="translationEN">ENGLISH</a> <span id="translationProgress" style="display:none">Translation in progress, please wait...</span> </div> <div id="col-1">Ce plugin est vraiment pratique et simple d'utilisation.</div> <div id="col-2">Je félicite son auteur !</div> </body> </html>Thanks in advance for your explanation. Best regards.
function toggleTransl(el, to){ var $el=$(el), a=$el.data('translation.'+to+'.html'), b=$el.data('translation.'+to+'.value'); if(a) $el.html(a); if(b) $el.val(b); }If you set data:true (stores the original text and translation) then you can use this function to toggle to a language that was translated before. So this goes inside your click event:
$('[@id*=col]').find('*').andSelf().each(function(){ toggleTransl(this, 'fr') });I hope this will work! (Such functionality will be definitely included in a future release.)
Hi,
Your function work very well with data:true. It's very powerful :] This Jquery plugin is a great job, I'm impressed, really.
A $().untranslate(sourceLang,? destLang,option?) function in the future ? ;) I hope too ;)
Many thanks !
Thanks! I'm glad you like it! I've just implemented a toggle option that will automatically do this, but it will be only available in the next release. It has been pretty much refactored and needs a bit more testing, but hopefully I can post it in about a week.
Great. I've put the toggleTrans() in your lib until your futur release. I keep an eye on it ;)
In v1.2.x you just have to set the toggle option, and you can restore any translation that was stored before (i.e. only if the data or toggle option was true when it was translated).
$(selector).translate( destLang, {toggle:true} );Another important change is that $.translate.ready=function(){ ... } won't work, use $.translate().ready( function(){ ... } ) instead! But in most cases it's not necessary, so it's enough to put the code in $(document).ready().
If you are using a method of $.translate() put it in $.translate().ready() too. Some examples:
$(document).ready(function(){ $('body').translate('english'); //this will work //returns a jQuery object and translates the text when the Language API is loaded $.translate( 'some text', { complete:function(){} } ); //this will work too //returns an internal object and translates the text when the Language API is loaded $.translate().getLanguages(); //this won't (always) work! //the Language API may not be loaded, the return value cannot be determined $.translate().ready(function(){ $.translate().getLanguages() //this will work }) })Been using this for click and translate and it's amazing! I have been having a problem getting it to work on load though without clicking (Would be perfect if I could get it to just do a simple translate of a large paragraph after the page loads). Here's what I've been trying with (the click works, but the on page load doesn't):
<html> <head>
</script>
</head> <body>
<input type="button" onclick="google_translation('en','es');" value="Translate "/>
<div id="test"> LOTS OF CONTENT HERE </div>
</body> </html>
In v1.2 you don't need the ready function for such thing (which was changed too). Just read the comment above :)
Played around with the different examples on your post above, and finally got it to work like a charm. Amazing work, kudos!
I use a drop down menu to choose the language:
and in the head I put
$('#langsel').change(function(){ $('div#container').translate( 'en', $(this).val(), { not: 'select', async: true, toggle: true }) })to translate the contents of the div with id="container".
When I choose a language for the first time e.g. french the result is correct but if I want to translate the text again to a different language e.g. greek the result is a combination of words in both languages greek and french. What am I doing wrong?
I presume you are using the latest version (1.2.x), the toggle option isn't available in 1.1.x. But it's a good question, as it translates from the current language unless the desired translation is in cache. I used to reload the page with history.reload() to get back to the original text, but now you can do that with "translating" back to the original language before the actual translation:
$('#langsel').change(function(){ $('div#container').translate( 'en', { //revert to english first not: 'select', async: false, toggle: true, returnAll: true }) .translate( 'en', $(this).val(), { not: 'select', async: true, toggle: true, walk: false }); })Note, that the async option is set to false when reverting the translation, it might work with async:100 but browsers can't delay execution precisely (Firefox 3 might be doing it well, but in other browser it's not guaranteed to work). So if async isn't set to false the languges in each element can be mixed up.
And another trick: these above are chained: you can do that due to the options added to each one (the first one returns all textnodes: returnAll:true so the second one doesn't have to parse the DOM again, and it's forced not to do that by walk:false ). But it's not necessary, just a bit speedup.
Also, there could be another option to use a language in the cache to translate from, so that you don't have to restore the translation manually -- I think that goes to the next release.
Translation has been working GREAT for most of the languages/pages I've been doing for big text in the thousands of characters. I did run into a problem that the translation works for chinese (zh) but not for chinese simplified (zh-CN) or traditional (zh-TW). Is it possible to use traditional? Really need it for a certain website.
In the function that converts to language code I expected all language codes to be lowercase, which they're apparently not. It only affets 1.2.x because it accepts whole language names as well, not just language codes like: $(...).translate('chinese'). Now fixed in v1.2.3.
This looks very promising for my needs, but I'm finding that it conflicts with the Prototype library. It works fine if I don't include Prototype, but when I do, I get an 'object is undefined' error on line 725 of the 1.2.3 build. Any ideas?
Interesting, the full 1.2.3 is "only" 703 lines long. I also tried it with Prototype and it seems to be working fine. Maybe a link to the site?
Thanks for the quick reply. It turns out that it was a conflict with scriptaculous, not prototype. I can probably work around that easier, so that's okay. I do have a different problem now. The translation seems to stop midway through the page that I'm trying to translate. You can see it here: http://boostani.dev.wiserearth.org/user/Honore login: soldemo password: demo
If you select Spanish from the Other Languages menu in the top right, then it should translate everything under the gray header, but it stops toward the end of the left navigation bar. Is this a Google limitation, or is the javascript running into problems?
I looked into it and it seems that Adblock Plus (a Firefox plugin) causes the API to fail silently if you have some specific words in the text: in this case it is "responsible" in $('div#view_relation') on your site (this is where the translation actually stops for me). Sounds weird doesn't it? Here's a small script I tested in other browsers and Firefox 3 with Adblock disabled and this way it's working, but not with Adblock:
google.language.translate("responsible",'en','es',function(r){console.log(r.translation)})I experienced this with Firefox 2 too, but it disappeared when Firefox 3 came out, now it's here.
But it's not everything: if you want to translate $('div#view_relation').html() you get a bad request error:
var t=$('#view_relation').html().substr(0,2000); //without the word "responsible" //.substr(0,2500) with Adblock -> nothing happens, no error, no request google.language.translate(t,'en','es',function(r){console.log(r.translation)})But on your site it's working if you diasble Adblock: at least it sends all the requests, but there seems to be a problem when the plugins tries to replace the text. But by manually replacing the content we can get the whole page translated:
var t, j=jQuery('#page').translate('en','es',{returnAll:true, limit:1000, each:function(){ t=this; }, complete:function(){ var tr=jQuery(t.rawTranslation) j.each(function(i){ jQuery.translate().replace(jQuery(this), tr[i], {replace:true, rebind:false}) }) jQuery('#indicator').hide() }, start: function(){ jQuery('#indicator').show() }, error: function(){ alert('error') } })So this is a bug in the plugin, but now I don't really now what on earth causes it to fail on this text. The jQuery.translate().replace() in the script above is an internal function that replaces the content but somehow it doesn't seem to work automatically, and without the rebind:false option it fails too. But if you call it manually on complete it works.
Oh, and one more weirdness: google silently raised the character limit to 5000: http://code.google.com/apis/ajaxlanguage/terms.html but I never managed to get it working above about 1000: it returns two new types of errors: sometimes a response with 200 OK header containing an error message, and sometimes "XML tag name mismatch (expected meta) </head>\n". So be careful when raising the limit above 1000!
Hello! The plugin is great! Thanks! I have a problem, I need to set a cookie to mantain the language through different pages, can you help me with this..?
Here's my code:
<script type="text/javascript"> jQuery(function($){
}) </script>
and the html:
<form>
</form>Thanks in advance!
Hello, here's an example showing how to do that: http://jsbin.com/ofema/edit I've just put this to the Links section on the main page.
The way you do it in your example isn't necessary any more, it's handled by the fromOriginal option, as you can see that in the example.
Thank you!
Hello, I need a help on how to use "$.data".
I'm trying to get this script to work. But, I get nothing in "#translated". Do you have any idea about what' wrong with this ? If I use this.translation0?, then it works, but I want to get html tags as well.
$(document).ready(function(){ $("#translate").click(function(){ $('#original').translate('en', 'ja', { data: true, replace: false, complete: function() { $('#translated').html($(this).data('translation.ja.html'));} }); }); }); </script> </head> <body> <div><a href="#" id="translate">Translate</a></div> <div id="original"><ul><li>Hello</li></ul></div> <div id="translated"></div>The this inside the callback functions refers to the current object, not to an element. You can get the original element by the first argument, but that doesn't contain any data only if you set walk:false because by default the data is attached to each element containing text not the root element. So you could do this:
walk:false, complete: function($elems) { $elems.html( $elems.data('translation.ja.html') ); }Thanks, balazs. It worked!
Now, there is another problem. not: doesn't work anymore. I guess it's because of walk:false. There are parts in the text I don't want to translate. What would be the best way to handle this?
Sure!
$("#translate").click(function(){
});Thanks for the quick answer, balazs.
I tried the code above but it seems to behave like replace:true, that is, the translation goes to the same location as the original text. I want to place the translation to a different location.
So, I tried the code below with and without walk:false, but it didn't filter tags specified with not:.
$elemsAll.each(function(i){ $("#translated").html( $(this).data('translation.ja.html') ); });Ah, ok, that makes more sense :)
The not option won't work in cases like when you want to exclude all anchor tags from some text in a paragraph because then the whole paragraph will be translated. The code below translates the innerHTML of #original and puts the translation to #translated but nothing could be removed:
$("#translate").click(function(){ $('#original').translate('en', 'ja', { walk: false, replace: false, complete: function() { $('#translated').html( this.translation[0] ); } }); });What you can do is to clone $('#original'), remove the elements you don't need and translate it afterwards:
$('#original') .clone() .find('*') .each(function(){ if(this.tagName==='A') //could be $(this).is("a") but that can be much slower on many elements this.parentNode.removeChild(this); }) .end() .translate('en', 'ja', { walk: false, replace: false, complete: function() { $('#translated').html( this.translation[0] ); } });Hope that works!
Thanks, balazs! I will try what you suggested.
Hi, it's 'translation.ru.html'!
I'd like to take a page in spanish, and produce a new page with each spanish paragraph being followed by the same paragraph in english. If I use the replace:true option, I just get the english only. Has anyone done this? I can translate the spanish one <p> </p> at a time, but how do I put the translated english paragraph below the spanish paragraph?
Try it with these options:
replace: false, each: function(i, el, tr){ $(el).clone().html(tr).insertAfter(el); }wow thanks, that worked just fine!
Hi:
How i can hide original text and show when is translated?
@javier.tia: I'm not sure if you meant something else but the examples at the top of this page do just that!
that is right, i look after comment and i found it the answer. Thank you.
Hi,
Text to be translated:
<INPUTANSWER PARTID='1'> <IMG SRC='its://Workshop/ADSK Cert Exams (External)/2010/Sample Translations/INV10.P.07.01c.gif' SIZE='0' SRC_CETEMP="../item_shared/getresource.aspx?cmd=media&urid=r5796927/ENU"><BR><BR><P>Open the file <I>DP-LCD-17.iam</I>. Follow these steps.</P> <P STYLE="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in">1.<SPAN STYLE="FONT: 7pt 'Times New Roman'"> </SPAN>Place a <STRONG>90 degree</STRONG> explicit angle constraint to the inside faces of <STRONG>DP-1007:1 </STRONG>and<STRONG>DP-1006:1</STRONG> as shown.</P> <P STYLE="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in">2.<SPAN STYLE="FONT: 7pt 'Times New Roman'"> </SPAN>Drive this angle constraint between <STRONG>90 and 100 degrees</STRONG> with an <STRONG>increment</STRONG> <STRONG>of 0.125 degrees.</STRONG></P> <P> </P> <P>At what angle is there first interference? <ANSWER ID='1' SIZE='6' TYPE='2'></P><P> </P></INPUTANSWER>
Thank you for your help in advance, -Nimesh
@nimesh1983: What happens exactly?
Sometimes inline tags can be messed up during the translation because it's not always possible to determine where they should be in the text in an other language. That's what happens if you try the ui extension example: http://code.google.com/p/jquery-translate/wiki/Extensions further explained in the comments there.
But in your case the problem might be only that you don't close the br tags properly, they should look like this: <br/>!
Ihave
$('#TexttobeTranslated?').data('translation.'+targetLanguageCode+'.html'); }
When I try 2 translate text above, i don't get anything back. Thanks!
Also I get no translation back if I have something like
Text to be translated:
@nimesh1983: The replace option is set to false, which means it doesn't modify the page at all, and in the callback you do nothing with it either.
I'll look into the other thing today, there seems to be some problem with parsing the translation.
@nimesh1983: Try the new (1.3.3) release, the issue with translating that small div should be fixed now.
Thank you balazs for your quick response. I got 1.3.3 and it looks like it fixed it. Actually I am setting $('#TexttobeTranslated??').html($('#TexttobeTranslated??').data('translation.'+targetLanguageCode+'.html')); in the callback. I forgot to copy that. Thank you for your help, -Nimesh
You helped me figure out how to put each paragraph of the translated text after the original text. Can you tell me how to make either the original or the translated paragraphs appear bold? In other words, how can I wrap it in <b></b> tags?
this is the example you gave me:
replace: false, each: function(i, el, tr){
}@roncking: .css("font-weight","bold")
I'm sorry, but I don't understand how to use this. I want either the original text OR the translated text to be bold so that it's easy to see the transitions between the two. So where do I insert the .css("font-weight","bold")?
Impressive work. I can now translate it into almost all languages mentioned on http://code.google.com/apis/ajaxlanguage/documentation/reference.html#LangNameArray. But when i try it for Urdu 'ur'. It does not work. Do you have any idea what is the reason? Arabic 'ar' is working fine which is almost same as Urdu language.
It's just not yet translatable:
google.language.isTranslatable("ur") -> false
or
$.translate.isTranslatable("ur") -> false
Hey Balaz,
Example: <P jQuery1244131196711="10">
Thank you, -Nimesh
@nimesh1983: Those attributes are always present if you have any data or events associated with that element. You would have to go through all the attributes of the element and remove the one that starts with "jQuery". But before the translation they can't be removed this way because it would destroy possible data or events on the element. What I can think of is removing them with a regex from the string, which will be translated:
$("").translate("en", { start: function(){ this.rawSource = this.rawSource.replace(/ jQuery\d+\="\d+"/, ''); } });Actually it seems to be rather harmless, maybe I'll put in the next version.
So Do I call this piece of code after the translation is returned from API? Thank you, -Nimesh
No, if you look at it closely, it's called in the start callback, it's just an extra option. It will remove the attributes before the translation but not from the DOM elements but from the text that will be translated.
Thank you very much for your prompt response Balazs... -Nimesh
@jasonatthediamondstore: You can translate whatever you feel like. Naturally, this plugin doesn't depend on what selector you use or how many elements you want to translate. Maybe you might want to use the walk:false option, so that the divs' innerHTML will be translated and the each callback fires for these divs - by default (walk:true) it gathers the deepest nodes containing text.
Just use an event handler.
http://code.google.com/p/jquery-translate/wiki/Extensions and there's another example on the main page under the links section
1. Check the examples on the Extensions page, those are made with selects!
2. You mean when the translation is executed? Without a live example I can't say much about that.
I don't really understand this, but I guess you can have a look at the jQuery docs regarding DOM manipulation: http://docs.jquery.com/Manipulation
It'd be nice if you could send a link to that page (to my email in case it's not public). I'm very interested in any bug reports as most of the problems come up only with some specific content. I'd have a look at it by tomorrow at latest.
For example:
In this case if you translate the div and exclude the select with not:"select" then it will be translated too, because the plugin finds the deepest elements containing textnodes, which here is the div, then translates it's innerHTML, which contains the select too. You have to either wrap the textnodes in a span or div, or move the select outside this div.
In this case you can exclude the select when translating the div:
(but only if the walk option is true - it is by default)
balazs.endresz@gmail.com I'll have a look at it tomorrow, thanks!
I've removed the calendar part mentioned above for now until I can figure out what's wrong but I've also noticed that some pages just won't translate and I can't see a good reason that they won't. All the pages have similar headers and footers.. and on some pages it won't even translate the header part. Any idea why this happens (maybe the page is too long??)
I also sometimes get messages from IE asking if I want to stop the script as it is it slowing down the browser. It doesn't seem to be slowing down, though, but sometimes the messages keep popping up.
@albino.manso: I've deleted your previous comment, please don't post large chunks of html here, use pastebin or jsbin instead. Sometimes Google can mess up the html structure that leads to parsing issues in the plugin, but without a live page I can't really say much about these kind of problems, if your site is not public please send me an email and I'll have a look at it!
I'm trying to use the translator to translate text in a form for upload to a website but the text fails to translate. I'm using FCKEditor, but that isn't causing the problem as it also fails when using simple textboxes. Can you please help me see where I'm going wrong please. Here is my code:
function startTranslation(){ $('#text_en').translate('es','en'); } function copyTranslate() { var e = FCKeditorAPI.GetInstance('text_es'); e.UpdateLinkedField(); document.getElementById("text_en").value = document.getElementById("text_es").value startTranslation(); var f = FCKeditorAPI.GetInstance('text_en'); f.SetHTML(document.getElementById("text_en").value); }Any help would be gratefully appreciated
Hi,
It's OK, I managed to figure out a way using your examples on the TranslateFunction page. Here is the fixed code:
function startTranslation(fromlang, tolang, fromId, toId){ var e = FCKeditorAPI.GetInstance('text_es'); e.UpdateLinkedField(); var sourceText = $('#'+fromId).val(); var f = FCKeditorAPI.GetInstance('text_en'); $.translate(sourceText, fromlang, tolang, { start: function() { $('#throbber').show(); }, complete: function(translation) { $('#'+toId).val(translation); $('#throbber').hide(), f.SetHTML(document.getElementById("text_en").value) }, error: function() { $('#throbber').hide() } }); }Hi,
There is a problem when we use the option 'not:' and we have a text in html with no tag. Can anyone help me solve this problem?
$('body').translate('english', destLang, { not: '.jq-translate-ui, .notT', fromOriginal:true }); <body> <p>Hello!</p> Hello <div id="sel"></div> </body>Hi, I'm just coding the download builder for the newer version, which will optionally handle this case too, until then you can use this script with a filter function: TextnodeTranslatorIntegration. Though, you can't use all the option with it yet.