Closed (duplicate)
Project:
Drupal core
Version:
6.x-dev
Component:
locale.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Sep 2008 at 23:10 UTC
Updated:
20 Aug 2010 at 11:14 UTC
Jump to comment: Most recent file
Comments
Comment #1
quicksketchI suspect this is the same problem as #297507: validation error causes vertical tabs to disappear, where Vertical Tabs was using #after_build to add the JavaScript to the page. Since #after_build functions are not called when validation fails or when rebuilding a cached form, I suspect this was the problem. Vertical Tabs now used #theme, which consistently rendered.
Comment #2
quicksketchMoving to fixed, as I believe this problem was fixed in #297507: validation error causes vertical tabs to disappear, please reopen if it still has the problem.
Comment #4
bealdav commentedThis bug is yet present in 6.x-1.0-beta3 version. Upload file corrupts tabs display and fields values ("author" to anomymous, etc... node gets unpublished).
Comment #5
aleagi commented+1, the bug is still present on last version (beta 3).
Comment #6
heine commentedThis is likely due to a bug in the JS translation parser.
As you can see, the source for plurals is thrown away, instead an array "singular" => "singular", "plural1", ... is formed.
This means we get the following example array in Drupal.locale.strings:
Now:
Drupal.t then fetches the array:
And tries to replace @count:
As str is an array, this fails and all JS dies :(
For a plural, there won't be a string in Drupal.locale.strings (via
return Drupal.t(plural, args);)The bug is rare due to another bug: #532512: Plural string storage is broken, editing UI is missing; it only occurs for imported translations.
Comment #7
damien tournoud commentedPromoted.
Comment #8
tahiticlic commentedHi there,
will this be solved for D6?
The solution I've used (not very elegant...) was to replace :
str = str.replace(key, args[key]);by
in misc/drupal.js
I think too that plural/singular distinction must be handled before a string can be manipulated.
Regards,
cfab
Comment #9
heine commentedI'm not sure this is the right approach. Another approach would be to duplicate a part of t in Drupal.Plural so it doesn't call Drupal.t anymore.
Comment #11
catchSince we don't have upload module in core, there doesn't seem to be any reproducable breakage here. Patch looks lovely if it works.
Comment #12
ibis commented#9: do306715-locale-js-parser-6.diff queued for re-testing.
Comment #14
ibis commentedI tested the patch above in #9 on Drupal 6.15 clean install with image_fupload js files and plural translations and works fine.
Comment #15
heine commentedThe patch is against 6 and cannot be tested. Also, I don't think this results in proper handling of multiple plural forms.
Comment #16
miro_dietikerHeine at least our issue was solved after applying #9 for D6
We're using ckeditor, wysiwyg api, triggered by attachment upload (1 single).
We'll hear from users if it broke something different.
This issue makes user experience pretty unusable. Broken core JS should be critical. Singular / Plural js should be a stable a core feature.
Heine, what do you think is needed to consider to make this fixed in D7/D6?
Comment #17
jazzitup commented#9: do306715-locale-js-parser-6.diff queued for re-testing.
Comment #19
heine commentedThe patch is against Drupal 6, so it cannot be tested atm.
Also, while the patch might "work" for certain languages, I'm not so sure it is the right approach for languages with another plural formula.
The best thing to do IMO would be to 1) store plural forms as now and 2) have Drupal.formatplural do the argument replacement itself, instead of calling Drupal.t (maybe refactor that out in a utility function).
Comment #21
klonossubscribing...
This issue was originally reported as a vertical tabs issue. In #6 it was switched to Drupal core locale.module. So I need to ask if it still stands for latest 6.x dev of vertical tabs or not. I am not seeing any similar behavior as described in #0, but I hate this kind of surprises ;)
My guess is that it actually is a core bug but a workaround was hacked so it could fix the issue in vertical tabs (that was a side-effect of the actual core bug in the first place). Now, we simply need to wait to get this resolved in core and then the work-around code in vertical tabs can be removed. Am I right?
Comment #22
heine commentedYes, this is a core issue. It has not yet been fixed in Drupal 6, or 7.
Comment #23
Peter Arius commentedI'm using Drupal 6.16 with Vertical Tabs 6.x-1.0-rc1, and this bug is still breaking Vertical Tabs, see #751940: Authoring information and publication options disappear and are saved as empty when editing nodes with vertical tabs enabled.
I'd appreciate to see this fixed in D6.
Best regards,
Peter
Comment #24
kiphaas7 commentedSub.
While this is non-critical for 7 since it's not in core, it sure is critical for 6. :/
Comment #25
tuffnatty commentedsubscribing.
Comment #26
Jakob Stoeck commentedI tested #9 and it works flawlessly. Should be in 6 core.
Comment #27
Jakob Stoeck commented#9: do306715-locale-js-parser-6.diff queued for re-testing.
Comment #28
heine commented"The patch is against Drupal 6, so it cannot be tested atm."
Also, see #19.
Comment #29
Jakob Stoeck commentedThat's why I changed to 6.x-dev. Is there another reason we can't test patches against 6 of which I'm not aware?
Comment #30
heine commentedI've never seen the testbot actually do anything with a patch against Drupal 6.x-dev. But we'll see.
Comment #31
bramface commentedSubscribing
Comment #32
damien tournoud commentedNow a duplicate of #504506: Drupal.formatPlural incorrectly handle complex plural rules.
Comment #33
bartezz commentedPatch attached to http://drupal.org/node/504506#comment-3045006 solved the issue for me...