Well,
I have two languages in my website (English -en- and arabic -ar-).
I create exposed form in block to do search for some contents.
when i'm in arabic website/pages , the submit redirect me to english website where the page should show the results. which mean , exposed form in block submit redirect to default languages pages.

I saw the form tag in pages source, the action of form still have "ar/..." but when i click submit it redirect me to default language. this stop me to do any form_alter since the action for form is correct. Any idea how to solve this.

Thanx.

Note:
1) Language Configure (admin/settings/language/configure) => Path prefix with language fallback. ( i try also "Path prefix only" but not working)
2) I'm using i18n.

Comments

lovegame’s picture

Category: support » bug

Ok i think i find the answer and how to fix this,
File : includes/form.inc
Function: _drupal_build_form($form_id, &$form_state)

Add this code before return :

global $language;
$default_language=language_default();
if($default_language->prefix!=$language->prefix)
$form["q"]["#value"]=$language->prefix."/".$form["q"]["#value"];
merlinofchaos’s picture

Status: Active » Closed (won't fix)

Uh, no, that putting the language in the path is an i18n thing. It's not Views' responsibility to put it there on form action.

lamp04ka’s picture

I have this problem too. What to do??? It's a seriously bag!!! Anonym user can't use the esposed form in his language!

lamp04ka’s picture

lovegame, i tryied this solution and it works!!! Thank you a lot!

but it works then you write

global $language;

$form["q"]["#value"]=$language->prefix."/".$form["q"]["#value"];

marthinal’s picture

@lovegame THANKS!

torvall’s picture

Since this is the only place I can find where this issue is documented, I leave here the solution I found for D7. This should work for all exposed forms in a web site. (It does on my development site.)
As I use the session language detection method, using hook_form_alter, I simply added a hidden item with the name and value matching locale parameters:

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'views_exposed_form') {
    global $language;
    $form['language'] = array('#type' => 'hidden', '#value' => $language->language);
  }
}
pmkanse’s picture

@lovegame THANKS!

works for D7 too.

Cheers!!!