4

I am using qTranslate for bilingual Wordpress. One problem I have is with Contact Form 7 contact pages. I need the Arabic texts as options in the Contact 7 form, only when the user is seeing the site in Arabic.

Lets say I have the following:

[radio paymethod "VISA" "MASTERCARD" "AMEX"]  

I need to show these values in Arabic when its Arabic mode. Also need to get the error/success messages in the other languages (ie: when the language is switched).

I tried changing settings.php of the plugin. It was

    return (string) $wpcf7_request_uri;```
and now is
```php
    $lang = "&lang=" . qtrans_getLanguage();
    return ((string) $wpcf7_request_uri) . $lang;

It changes my url to: http://example.com/contact-us/&lang=ar#wpcf7-f289-t1-o1 and that results in a 404.

qTranslate has three configs for language.

  1. query string
  2. pre-Path Mode (puts /en/ in front)
  3. en.yoursite.com. I am using 2.
Lenin
  • 570
  • 16
  • 36
  • 2
    I think the only way is to create new contact form for each language you use. As mention here http://wordpress.org/support/topic/plugin-contact-form-7-contactform-7-qtranslate – Rikesh Jan 23 '13 at 07:47
  • @Rikesh thanks the support thread really helped. But the tip about getting the error/success messages gives 404. As I am using the /en/ style. It will add the language at end of the URI. – Lenin Jan 23 '13 at 21:08
  • What do you mean by "getting the error/success messages"? Ain't they displayed via Ajax? AFAIK, @Rikesh comment is [the answer](http://wordpress.stackexchange.com/a/70827/12615). – brasofilo Jan 23 '13 at 22:59
  • creating separate forms especially when the special tags like Radio, Checkbox, combobox etc somes in, is the best solution. – Lenin Jan 25 '13 at 05:43
  • @brasofilo Look at the link @rickesh gave in his comment. There is a voluntery trick one user posted there. To alter the Ajax request url for language switching. But it passes query string and not working while I am using the URL or form `/en/` or `/ar/`. – Lenin Jan 25 '13 at 05:46
  • 1
    For the sake of clarity, I'd suggest that you add the trick to the Q, what doesn't work and your exact config for qTrans & CF7. – brasofilo Jan 25 '13 at 05:53

1 Answers1

1

I have found the solution.

The contact forms can be created using a locale at the beginning. I contacted the Plugin Author and he directed to this page

I also made changes to the settings.php of the Contact form 7 as the following:

    function wpcf7_get_request_uri() {
       global $wpcf7_request_uri;
       if (($GLOBALS['q_config']['hide_default_language'] == 1) AND ($GLOBALS['q_config']['default_language'] != $GLOBALS['q_config']['language']))
        return ((string) '/' . $GLOBALS['q_config']['language'] . $wpcf7_request_uri);
    }
Lenin
  • 570
  • 16
  • 36
  • Without the above code the error/success message will come in the desired language but the RTL/LTR switching for the language wont happen. – Lenin Feb 01 '13 at 19:11