2

Im currently trying to make my backend work with multiple languages. Im using qTranslate as my translation plugin.

So far I have accomplished a custom option page with multi-language support. When you click on a different language (in qTranslate on the sidebar) you will get a new options page with prepared option-variables

show(option_textarea) -> 'english backend' -> show(option_textarea_en)
(saving under the same variable possible)

So, if I use one of the options in my template im just accessing the option with the current active language

give(option_logo) -> 'german page viewing' -> return option_logo_de

This also works on the widget-page-side. EXCEPT, when I'm switching my current language in the backend each widget gets the status 'unused' and I have to manually put in the widgets again. They don't exist for the current active language and are not faved. So in general I can only set widgets for one language at a time. The widgets from the other language i have set are dropped then. How can I deactivate this behaviour?

What I need is a fixed widget-editing system that works the same way as my options. Maybe there is a workaround for this problem?

Thanks in advance.

  • ehm... everyone sleeping or is it the awesome weekend? ;) – Tom Siwik Aug 28 '11 at 15:19
1

I don't know how qTraslate works, but you can pass filters to Widget Logic , you basically duplicate each widget, one for each language. I have used this technique with WPML to show widgets in separate languages that can sometimes be difficult ( such as when they make direct DB queries).

| improve this answer | |
  • i'll accept this as it seems to be the only way to do it. – Tom Siwik Aug 23 '12 at 13:00
  • I want to add I have had some problems with Widget Logic recently and found another great plugin called wordpress.org/extend/plugins/display-widgets that works well. – Wyck Aug 23 '12 at 17:22
2

As Wyck points out, that's the easiest way.

I have the following function in my functions.php and use it to filter a bunch of duplicated widgets, one for each language, e.g.: is_lingo('en'), is_lingo('pt'), etc...

function is_lingo( $what ) 
{
    if ( !function_exists('qtrans_getLanguage') )
        return false;

    $lingo = qtrans_getLanguage(); 

    if( $what == $lingo ) 
        return true;

    return false;
}
| improve this answer | |

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.