For some reason the l10n_client is not posting the "source" variable for me. When l10n_client_save_string() executes it has "target", "textgroup", and "form_token" variables but never gets the "source" variable. So I end up with WSOD on mydomain.com/de/i18nstrings/save. Just did a clean install of the dev version. I'm using i18n with 6 languages. Everything works except the client translation.

I also noticed I have three POSTS being sent. Is this normal?

First posts "source=Street" with "Street" being the variable I am translating.

// URL=http://mydomain.com/de/icl_content/icl_string_status
Host=mydomain.com
User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.10) Gecko/20100504 Firefox/3.5.10 (.NET CLR 3.5.30729)
Accept=*/*
Accept-Language=en-us,en;q=0.5
Accept-Encoding=gzip,deflate
Accept-Charset=ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive=300
Connection=keep-alive
Content-Type=application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With=XMLHttpRequest
Content-Length=53
Cookie=SESS73ed5c96d0d7f839706145f64d91a738=e51dd5cadc7d4a39eb490c12ec8b1ff1; __utma=120964508.524358018.1277363088.1277363088.1277365847.2; __utmz=120964508.1277363088.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none); __utmv=120964508.authenticated%20user%2Cadmin%20super; Drupal_l10n_client=1; has_js=1; __utmc=120964508
Pragma=no-cache
Cache-Control=no-cache
POSTDATA=icl_ajx_action=icl_single_string_status&source=Street

Second does this

// URL=http://mydomain.com/de/icl_content/icl_string_status
Host=mydomain.com
User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.10) Gecko/20100504 Firefox/3.5.10 (.NET CLR 3.5.30729)
Accept=*/*
Accept-Language=en-us,en;q=0.5
Accept-Encoding=gzip,deflate
Accept-Charset=ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive=300
Connection=keep-alive
Content-Type=application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With=XMLHttpRequest
Content-Length=37
Cookie=SESS73ed5c96d0d7f839706145f64d91a738=e51dd5cadc7d4a39eb490c12ec8b1ff1; __utma=120964508.524358018.1277363088.1277363088.1277365847.2; __utmz=120964508.1277363088.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none); __utmv=120964508.authenticated%20user%2Cadmin%20super; Drupal_l10n_client=1; has_js=1; __utmc=120964508
Pragma=no-cache
Cache-Control=no-cache
POSTDATA=icl_ajx_action=icl_any_queued_strings

Third posts the rest of the variables. I guess this is what l10n_client_save_string() ends up with.

// URL=http://mydomain.com/de/i18nstrings/save
Host=mydomain.com
User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.10) Gecko/20100504 Firefox/3.5.10 (.NET CLR 3.5.30729)
Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language=en-us,en;q=0.5
Accept-Encoding=gzip,deflate
Accept-Charset=ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive=300
Connection=keep-alive
Referer=http://mydomain.com/de/admin/by-module
Cookie=SESS73ed5c96d0d7f839706145f64d91a738=e51dd5cadc7d4a39eb490c12ec8b1ff1; __utma=120964508.524358018.1277363088.1277363088.1277365847.2; __utmz=120964508.1277363088.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none); __utmv=120964508.authenticated%20user%2Cadmin%20super; Drupal_l10n_client=1; has_js=1; __utmc=120964508
Content-Type=application/x-www-form-urlencoded
Content-Length=187
POSTDATA=target=Stra%C3%9Fe&op=%C3%9Cbersetzung+speichern&textgroup=default&form_build_id=form-97af362bc7f6c4bc1f2b57396ca61839&form_token=d2e04e591683fdea833fabb8169032b5&form_id=l10n_client_form

Any ideas as to why it's doing this?

CommentFileSizeAuthor
#3 l10n_client_2010-06-25.patch3.39 KBtinker

Comments

tinker’s picture

OK, I have figured out why the client is not working. It turns out that the AJAX form submit is never triggered because the form ID does not match.

In l10n_client.js there is a submit() on form ID "l10n-client-form" but for some reason on my site this form ID is "l10n-client-form-1". I don't know why the "-1" is appended to the form id but if I modify the form names in l10n_client.js everything works.

Here is the form that is generated: (I have overridden to use )

<form action="/de/i18nstrings/save" accept-charset="UTF-8" method="post" id="l10n-client-form-1">
  <div>
    <div class="form-item" id="edit-target-1-wrapper">
      <textarea cols="60" rows="6" name="target" id="edit-target-1" class="form-textarea translation-target"></textarea>
    </div>
    <button type="submit" name="op" id="edit-save-1" value="Übersetzung speichern" class="form-submit">Übersetzung</button>
    <input type="hidden" name="textgroup" id="edit-textgroup-1" value="default">
    <button type="submit" name="op" id="l10n-client-edit-copy" value="Copy source" class="form-submit form-submit edit-copy">Copy source</button>
    <button type="submit" name="op" id="l10n-client-edit-clear" value="Leeren" class="form-submit form-submit edit-clear">Leeren</button>
    <input type="hidden" name="form_build_id" id="form-704ab81f3082a56027098c9462a71612" value="form-704ab81f3082a56027098c9462a71612">
    <input type="hidden" name="form_token" id="edit-l10n-client-form-form-token-1" value="65dadf4c3e7a87f32284ad5dda6e90a4">
    <input type="hidden" name="form_id" id="edit-l10n-client-form-1" value="l10n_client_form">
  </div>
</form>
tinker’s picture

Version: 6.x-1.6 » 6.x-1.x-dev

Sorry marked the wrong version

tinker’s picture

Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new3.39 KB

Read up on JQuery and rolled a patch to fix this issue. Reading though other issues on drupal.org it was recommended not to use #ids with AJAX and to use .classes instead. So basically all I have done in this patch is to introduced a class for the l10n-client-form and use that as a context for selecting all the objects within it.

I would really appreciate if I could get some help testing this and having it committed. Please let me know if there is anything I can do to speed up the process.

gábor hojtsy’s picture

Status: Needs review » Needs work

Why would there be two copies of the same form on the page? That's why Drupal would name the second one like that. Can you figure out why it's included twice? That's the base issue. If you have two copies of the form, you have other problems, so let's not masquerade it this way.

tinker’s picture

I do not have two copies of the form. That's what weird. I do however have multiple other forms on pretty much every page (add to cart, newsletter signup etc). I search for "l10n-client-form" in the rendered xhtml source code and only return one hit which is always "l10n-client-form-1".

tinker’s picture

Status: Needs work » Closed (fixed)

Through a strange turn of events I discovered it was the Cufon module causing this problem.

Cufon module disables $closure in preprocess_page function
http://drupal.org/node/734630

It forced preprocess_page run twice, and made the form ids have "-1" appended to them, which caused the JavaScripts to fail.

danny_joris’s picture

Just want to confirm #6. I had the same issue with Cufon. Now fixed thanks to #734630: Cufon module disables $closure in preprocess_page function