Closed (fixed)
Project:
Drigg
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
18 Apr 2008 at 04:52 UTC
Updated:
17 Aug 2008 at 11:10 UTC
Jump to comment: Most recent file
Hi,
See subject.
Javascript strings are not translated, which is not nice. ALSO, variables are set the "ugly" way at the moment, rather than through teh Drupal.* namespace.
Bye,
Merc.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | drigg-js.patch | 6.15 KB | cedricfontaine |
Comments
Comment #1
mercmobily commentedH,
Translations can't happen till D6. So, cancelling the issue (since it will be part of the port).
However, the variables should still be passed nicely to Javascript.
Merc.
Comment #2
mercmobily commentedHi,
Wooops fixed the title.
Merc.
Comment #3
sikjoy commentedHi mercmobily:
Just to be clear: do you mean using
drupal_add_js(array())to pass in the variables? How is it currently being done?--sicjoy
Comment #4
mercmobily commentedHi,
Yeah, that's what I want to do. Feel free to send a patch... Right now, the module does a rather ugly thing: spits out javascript assigns which is not the best...
Bye!
Merc.
Comment #5
sikjoy commentedComment #6
mercmobily commentedHi,
One note: just look at the DRULPAL-5 version of extra_voting_forms -- I've just received a patch that, amongst other things, does that too!
Merc.
Comment #7
sikjoy commentedHi Merc:
I see that in extra_voting_forms you passed in the variables in the hook_init function.
Is there any reason the drupal_add_js call shouldn't be in the hook_menu function under !may_cache?
--sicjoy
Comment #8
mercmobily commentedHi,
I prefer to use hook_menu myself. init() may be dangerous, because in aggressive caching it's not called.
If you test it, and notice that it works fine in hook_menu, please change extra_voting_forms as well!
Merc,
Comment #9
mercmobily commentedComment #10
mercmobily commentedHi,
To clarify what should be done about this issue...
Right now, in drigg.module we have:
Javascript variables are defined this way:
Then, in drigg.js:
This is immensely ugly.
On the other hand, extra_voting_forms does this right:
And then for example to get the only_one_vote variable, in extra_voting_forms.js:
MUCH neater!
This is a VERY simple patch. However, the catch is in the _careful_ testing it requires.
Does this make sense?
Merc.
Comment #11
cedricfontaine commentedI'm working on it. Just a problem : We do initialize var drigg_do_validation = 1; but I can't find anywhere in code where it's been used.
Any help would be appreciated.
Also, could we pass the 6 non translated strings also ? It would help to translate...
Comment #12
mercmobily commentedHi,
About drigg_do_validation: I think it was used i n the past, and got zapped later.
I think you're right: it's not used and can (should) go.
About the string translation: I want to be careful about it. I read something about a translation architecture for Javascript strings for Drupal 6. I don't think they were backporting it. So, I think i would much rather do it "the drupal way" when the D6 port happens, rather than doing it now. It's sort of a separate issue -- let's keep it separate.
I might be wrong. There might be a neat, proper way to translate things right now. But again, it's a separate issue...!
Merc.
Comment #13
cedricfontaine commentedHere is a patch tested and running
Comment #14
mercmobily commentedHi,
Another long term task fixed -- THANK YOU cedric!
Merc.
Comment #15
mercmobily commented