balazs-endresz / jquery-translate

Automatically exported from code.google.com/p/jquery-translate
5 stars 5 forks source link

class selector doesn't seem to work #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When trying to use jquery-translate with a classname based selector nothing 
happens. 

$('a').translate('ar'); // works.
$('.post-tag').translate('ar'); // does not work.

Using: Version: 1.4.1

Thanks!

Original issue reported on code.google.com by 93ehfk09...@gmail.com on 5 Jan 2010 at 4:28

GoogleCodeExporter commented 9 years ago
Since this plugin doesn't discriminate elements based on a specific CSS query 
there must be 
something else causing this issue, which I'd happily help solving but I'd need 
some relevant 
information to do that, for example the actual website or at least some part of 
the markup. 
If it's not public please feel free to contact me in email: 
balazs.endresz@gmail.com

Original comment by balazs.endresz on 5 Jan 2010 at 5:21

GoogleCodeExporter commented 9 years ago
Thanks Balazs - you can have a look at http://se.korneel.com. There are 
elements with 
a .post-tag class that I want to translate. The jQuery is below.

$(document).ready(function(){

  // other stuff

  //$('a').translate('ar'); // works
  $('.post-tag').css('color','#4253ea'); // for reference to check that selector is 
working
  $('.post-tag').translate('ar'); // does not work

});

Thanks!

Original comment by 93ehfk09...@gmail.com on 6 Jan 2010 at 3:36

GoogleCodeExporter commented 9 years ago
Update: The above seems to only hold true for the homepage - on all other pages 
the 
translation does work. I have no idea why...

Original comment by 93ehfk09...@gmail.com on 6 Jan 2010 at 10:46

GoogleCodeExporter commented 9 years ago
If you use the `error` callback, it says that it "could not reliably detect 
source 
language":

$('.post-tag').translate('ar',{ error:function(e){ console.log(e.message) } });

Specifying a source language should fix this:

`$('.post-tag').translate('en', 'ar')`

Original comment by balazs.endresz on 7 Jan 2010 at 10:11

GoogleCodeExporter commented 9 years ago
Great - thanks! That did the trick.

Original comment by 93ehfk09...@gmail.com on 7 Jan 2010 at 2:07

GoogleCodeExporter commented 9 years ago

Original comment by balazs.endresz on 7 Jan 2010 at 2:15