Needs work
Project:
Internationalization contributions
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 May 2011 at 14:06 UTC
Updated:
21 Jan 2016 at 02:56 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jose reyero commentedYes, I guess we'd need something to translate poll choices. Maybe for next version.
Comment #2
jose reyero commentedNo time, it seems no one else interested.
(Feel free to reopen if you are posting a patch).
Comment #3
caktux commentedHere's a mostly direct and hackish port of i18npoll.module from D6. It works but choices' order has to be the same.
Comment #4
kanast commentedthanks caktux
When anonymous users are allowed to vote on polls, drupal crashes and this error appears when they try to access the site:
PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens: SELECT v.chid FROM {poll_vote} v INNER JOIN {node} n ON n.nid = v.nid WHERE n.tnid = :tnid AND v.hostname = ':hostname'; Array ( [tnid] => 1 [hostname] => 127.0.0.1 ) in i18n_poll_get_vote() (line 187 of /var/www/drupal/modules/poll/i18n_poll.module).The website encountered an unexpected error. Please try again later.
I'm using ubuntu 12.04 - drupal 7.16, i18n-7.x-1.7
is there any other solution vote counts to be synchronised with anonymous users allowed to vote?
Comment #5
s_leu commentedThe patch had another bug besides the one kanast mentioned above. It's now fixed in the attached patch. Please commit this.
Comment #6
s_leu commentedComment #7
berdirLooks ok to me.
Comment #8
jose reyero commentedI have a few issues with this patch:
- It's not a full D7 upgrade, we do this stuff with different field formatters now.
- The hook_node_view() has some important comment that seems to be missed:
"We don't add all language results on loading to avoid the data being trashed
when editing and saving nodes again."
- I think the D7 strategy, to be consistent with the rest of the package, should be to make poll choices translatable as strings, and then let Entity Translation figure out the rest.
And overall: you want me to add a new module (without tests) to the package when we should start thinking about porting it to D8 instead of growing it more and more?
Really, the solution is way easier, either:
- Create a new module (project) for it.
- Or add it to this one, if you want to commit it right away, https://drupal.org/project/i18n_contrib
However, @Berdir, you have full commit access to this project so if you think this really needs to be here for some reason, and you intend to be maintaining this piece for the future, feel free..
Comment #9
berdirThanks for the quick feedback and sorry for the too quick RTBC :) We tested and fixed the existing patch, so I thought it to be most useful if others can use it too.
Some feedback:
- It's not a field, so we can't do something like field formatters.
- Poll.module is a lot of custom code and forms and it's not any better in D8 (nor will it be removed)
- The proper way forward might be entity translation and pollfield.module (but I haven't checked it) or entity_translation and poll.module with label translation, as you suggested. I'm not sure.
We are already using poll.module in our project and can't easily switch, so we continued with the patch here. Others might be in the same situation.
i18n_contrib doesn't really make sense, as it's a core module :) Making it a separate project with only a dev release that allows users to easily test it and also expose it is probably the best option at this point.
Comment #10
jose reyero commented@Berdir,
Ok, let's say then it's a core module that doesn't meet the standards for i18n package. Really, i18n_contrib is the place for this, so you can make it available for others, track issues, etc..
The project's description is: "Internationalization contributions is a set of modules that are add ons for Internationalization module to provide compatibility with other contributed modules or some other features."
Also that module is not meant to have stable releases, though there may be some point releases (alpha versions) for better issue tracking.
So you can add the module as a stand alone or here, as you prefer.
Comment #11
drplI added this to get nid by using the current langauge
Comment #12
Boymix81 commentedHi,
for me this patch with many of 2 languages not works.
I fixed the function
i18n_poll_view_results(&$node, $view_mode, $block)
adding relative index of option and now for me it works.
Comment #13
donapis commentedThanks Boymix81 for the patch.