balazs-endresz / jquery-translate

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

Doesn't work in IE at all? #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a simple test page
2. Include jquery and jquery-translate
3. Run in IE

What is the expected output? What do you see instead?
Some kind of translation

What version of the product are you using? On what operating system?
Have tried 1.3.9 and 1.4.5. jQuery 1.3.2. Windows XP. IE 8/7

Please provide any additional information below.

Experienced a problem in a web application where translation didn't seem to
work anymore, however occationally it would work once, but not again. Made
a local test page to verify the problem, but there's no translation going
on at all. Did Google change their API or something?

Test page:

<html>
<head>
  <script type="text/javascript" src="jquery-latest-min.js"></script>
  <script type="text/javascript" src="jquery-translate-1.4.5.js"></script>
  <script type="text/javascript">

    $(function(){
      $(".abc").translate("no","en",{});
    });
  </script>

</head>
<body>

  <div class="abc">Siste nytt</div>

</body>
</html>

Original issue reported on code.google.com by are...@gmail.com on 23 Mar 2010 at 10:51

GoogleCodeExporter commented 9 years ago
Seems like clearing the browser cache makes it translate again (once), but 
fails at
any page refresh

Original comment by are...@gmail.com on 24 Mar 2010 at 2:08

GoogleCodeExporter commented 9 years ago
I have been experiencing the same issue.

Works fine for the initial translation. Any subsequent return visits to the 
same 
page, it requires clearing the browser cache for the tranlate to work again. 
Only in 
IE with inPrivate mode enabled(8.0 and compatability mode).

Interestingly, I went back to the same locally hosted pages in IE without 
inPrivate 
mode enabled, and they seemed to work fine - without needing to clear the cache.

Hope this helps.

Original comment by intech.w...@gmail.com on 26 Mar 2010 at 1:06

GoogleCodeExporter commented 9 years ago
I have had this problem too, been trying all kinds of different, cache-related 
things.

I was able to produce a solution thanks to the following topic:
http://groups.google.com/group/Google-AJAX-Search-API/msg/1d2c4cff9de4b9b3?pli=1

Under the script tags of jquery and jquery.translate, you should add the 
following:
<!--[if IE]>
<script src="http://www.google.com/jsapi?callback=$.translate.load"
type="text/javascript"></script>
<![endif]-->

I Used jQuery 1.4.2 and jQuery Translate 1.4.5 at last.

Original comment by flamefin...@gmail.com on 26 Mar 2010 at 1:25

GoogleCodeExporter commented 9 years ago
Sorry for the delay, I'm just looking into it. Strangely my test pages don't 
work 
either, which I used a couple of weeks ago.

Original comment by balazs.endresz on 26 Mar 2010 at 1:29

GoogleCodeExporter commented 9 years ago
If that still does not work, you could also try the $.translate( function() {} 
); like:

<script type="text/javascript">
$(function() { // On DOM ready
    $.translate(function() { // On Google API Ready
        $(".abc").translate("no","en",{});
    });
});
</script>

Original comment by flamefin...@gmail.com on 26 Mar 2010 at 1:40

GoogleCodeExporter commented 9 years ago
This is where the problem is:

google.load("language", "1", {"callback" : loaded});

here `loaded` is a function that should be fired when the Language API loads 
but apparently 
it isn't. Calling $.translate.load() afterwards calls the above line again, but 
then the 
`loaded` function fires properly. That's why flamefingers' solution above 
works, though a 
simple timeout would be enough as well.

So, it pretty much looks like it's a bug in the Language API.

Original comment by balazs.endresz on 26 Mar 2010 at 2:10

GoogleCodeExporter commented 9 years ago
@flamefingers: I've read that discussion but quite frankly I can't really 
follow it, so 
I'm not sure it's related. It was quite a long time ago, and since then there 
wasn't 
any issues with loading the scripts. Also there were some other issues with the 
Language API that has been fixed in the following months. 

Original comment by balazs.endresz on 26 Mar 2010 at 2:19

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
http://code.google.com/p/google-ajax-apis/issues/detail?id=410

Original comment by balazs.endresz on 26 Mar 2010 at 6:08

GoogleCodeExporter commented 9 years ago
Thanks for all the responses!
The $.translate workaround does indeed seem to work.

Original comment by are...@gmail.com on 6 Apr 2010 at 7:31

GoogleCodeExporter commented 9 years ago
Now it seems to work fine for me, please reopen this ticket if you still see 
this issue!

Original comment by balazs.endresz on 29 Jun 2010 at 12:34