2

I'm using the Rate module for voting. When an anonymous user clicks on the voting widget, the user is redirected to a url "user/login-to-rate". I'm also using i18n for localization. The issue with both of these together is that when I'm on a page with the URL "en/my-url" and I click on the voting widget, I'm redirected to "de/user/login-to-rate" where "de" is my default language. Ideally the user should be going to "en/user/login-to-rate" i.e. user selected language should be respected.

Going into details, I find that the rate module calls url() using the following code:

print url('user/login-to-rate', array('query' => $query, 'absolute' => TRUE));

There is no language paramater that is passed, which means the default site language gets selected.

Am I missing something here in the configuration? Has anyone faced a similar problem and can help?

3

url() uses the current language by default, you only need to pass the language to it if you want another language, e.g. when sending mails to a user with a different language.

If you're on en/something and the global language is not en, then something else might be problem, for example incorrectly configured language recognication.

1

Try passing it the language object then. Without looking at the module, something like:

global $language;
print url('user/login-to-rate', array('query' => $query, 'absolute' => TRUE, 'language'=>$language));

If this works, make sure you submit it as a patch to the module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.