balazs-endresz / jquery-translate

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

Able to use translation once then stops working #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I translate a section called #middleColumn like so:
$("#middleColumn").translate("sv","en"); And I get what I'm expecting
2. I then change the content inside middleColumn
3. I then do step 1 again. Yet this time translation isn't done.

What is the expected output? What do you see instead?
I want it to be retranslated again. But it's not.

What version of the product are you using? On what operating system?
I tried 1.3.9, latest 1.4.4 and some older one before that (don't remember
which). I'm on Windows XP, I'm using Firefox with firebug. Firebug reports
that no request is sent to google the second time. Is there some switch I
don't know about which prevents me from retranslating the same area?

Please provide any additional information below.
You can try out the problem here:
http://orebro2010.se.labs.webbhotell.tv/content/calendarium.aspx?lang=en-GB

An initial translation is done to #translatableContent

The stuff in the right list of the page is supposed to load something new
in the middle which it does, however it's not translated after the second
time. It never works beyond first translation. (#middleContent)

Same with the stuff on the left. When you choose something in the
dropdowns, they are repopulated. Then I request from google to the whole
div (which has same id) to become retranslated. But sometimes nothing
happens. (#leftContent)

However one thing I've noticed is that #rightContent gets retranslated.
This part is retranslated whenever you click a number. to get a new list of
articles.

The locations where ReTranslate is called can be seen in /js/common.js

The ReTranslate-function is defined in the calendarium.aspx-file because I
need to get sessionvariable to see which language user has selected.

Well that's about it. I hope you can help me!

Original issue reported on code.google.com by elri...@gmail.com on 13 Feb 2010 at 12:29

GoogleCodeExporter commented 9 years ago
I'm not sure I can follow this, but if you change the content after a 
translation then 
you have to set some options to false (`fromOriginal`, `toggle` or `data` too) 
for that 
region because the translation is stored with $.data and by default it won't 
translate 
that region again, just get the translation from $.data.

Original comment by balazs.endresz on 13 Feb 2010 at 9:35

GoogleCodeExporter commented 9 years ago
$(i_section).translate("sv", "en", {
                returnAll: true,
                walk: false,
                not: "a",
                fromOriginal: false,
                toggle: false,
                data: false,
                subject: false,
                start: function() { $("#langCtrl").prepend("<span
style=\"color:#f00;\">Translating... Please wait!</span>"); },
                complete: function() { 
                    alert("translated");
                    $( $("#langCtrl").children()[0] ).remove();
                }
            });

it translates once, then never more with those options.

Original comment by elri...@gmail.com on 26 May 2010 at 3:04

GoogleCodeExporter commented 9 years ago
$(i_section).translate("sv", "en", {
                alwaysReplace: true
                returnAll: true,
                walk: false,
                not: "a",
                fromOriginal: false,
                toggle: false,
                data: false,
                subject: false,
                start: function() { $("#langCtrl").prepend("<span
style=\"color:#f00;\">Translating... Please wait!</span>"); },
                complete: function() { 
                    alert("translated");
                    $( $("#langCtrl").children()[0] ).remove();
                }
            });

set alwaysReplace to true

Original comment by rydan...@gmail.com on 14 Feb 2012 at 9:21