I have made new block for dropdown language switcher. Some people will need it.
The block name is 'dropdown language switcher'. The js file is just put on i18n module root directory.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | i18n_dropdown_js_inline.patch | 3.04 KB | yaoweizhen |
| #1 | dropdown.patch | 3.5 KB | yaoweizhen |
| i18n_dropdown_selection.js_.txt | 284 bytes | yaoweizhen | |
| i18n_dropdown_selection_block.patch | 2.91 KB | yaoweizhen |
Comments
Comment #1
yaoweizhen commentedThis patch is same as above. Just intergrated in js file into one patch file.
Comment #2
jredding commentedThe code is pretty straight forward and looks fine to me, however before its committed I think the following should be addressed
1) JQuery inclusion. The patch includes a new js file but the jQuery code is only a few lines.
Why not use 'inline' instead of a separate URL request for the client?
In D6 we have javascript aggregation but D5 does not.
2) The jump menu is being handled with jQuery. In the past I've seen the following used with Forms API.
jQuery might be more secure, I don't know.
Anyone know if there is a preferred Drupal method?
3) hook_menu vs hook_block. The use of hook_menu here would cause the javascript to be included even if this particular block isn't in use. Shouldn't the drupal_add_js be called in hook_block when this particular block is being returned? (i.e. $delta == 1)
Comment #3
yaoweizhen commentedthanks jredding, i have created another patch for inline js.
I don't want this way to use js, move js from html, it's 'Unobtrusive JavaScript' that is one of web standards.
http://en.wikipedia.org/wiki/Unobtrusive_JavaScript
Comment #4
jredding commentedproperly schooled, your method is better than what I posted.
What about the hook_menu vs. hook_block stuff? Don't want to include javascript that isn't going to be used.
Comment #5
hass commented"onChange" is invalid XHTML, use "onchange" and t('select') should be t('Select'), please.
Comment #6
jredding commentedthe onChange/onchange method isn't being used, rather the jQuery in the patched attached above.
Comment #7
hass commentedI've not found any time to review - however I'd also like a dropdown if many languages are supported on a site. One thing that shouldn't be forgotten is a way to add the flag's in front of the language. I saw this sometimes on the net. The flag was build into the selecbox followed by the language name. Looks very nice. I will try to find an example...
Comment #8
jose reyero commentedI think we have enough blocks, and very little interest in new features for 5.x. Come on, people, go Drupal 6, is waaay better :-)
But if you can handle to stick it all (css, js included) into some php code, this would make a really nice code snippet (to copy and paste in a block) or some theming code.
Comment #9
hass commentedUps, I missed this is a D5 only case... same applies to D6 :-)
Comment #10
jose reyero commentedOnly critical bug fixes for 5.x.
About 6.x, you can make it an stand alone module, as it shouldn't depend on i18n anymore
Comment #11
doublejosh commentedIs there a drop down select input language block solution for i18n out there or does this need to updated to D6 still?
Comment #12
doublejosh commentedWhop. Found this snippet post: http://drupal.org/node/313814