Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This is my setup:

  • Wordpress: 3.4.2
  • qTranslate: 2.5.32
  • Advanced Custom Field: 3.5.1
  • i've also installed qTranslate extension: 1.1.1 but I don't know how/if it works...

How can I have a multilanguage WYSIWYG custom field edit area with tabs for each language as the main text editor?

Thanks! Stefano

share|improve this question
    
qTranslate extension? Can you provide the link? For what I know of qT and ACF, I'd say doing what you want would be a huge task... –  brasofilo Nov 7 '12 at 18:28
    
qTranslate extension is this one wordpress.org/extend/plugins/qtranslate-extended –  Stefano Nov 7 '12 at 18:49
add comment

1 Answer

Tip 1: do not use qtranslate. I've used for years and now I can say that never been money better spent than those for WPML, specially if compared to the work needed to solve problems qT brings. Also consider that WPML is compatible with a huge number of plugins and themes, in years I used qTranslate never found a theme or a plugin compatible with it.

Tip 2: Regardless of which plugin you use, qT or WPML, to do what you want, require to write an entire and complex plugin.

A workaroud is to use different fields for different languages.

E.g. have the field 'size' for english and field 'taglia' for italian, and so on. Than in template file retrieve current language and print right field using a switch statement.

Following code is just an example

function get_localized_size($postid) {
    if ( ! intval($postid) ) {
      global $post;
      if ( empty($post) || ! is_object($post) || ! isset($post->ID) ) return;
      $postid = $post->ID;
    }
    $currlang = qtrans_getLanguage() ? : 'en'; // <-- qtranslate
    // $currlang = defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : 'en'; // <-- WPML
    switch ( strtolower($currlang) ) {
      case 'es' :
        $field = 'tamano';
        break;
      case 'it' :
        $field = 'taglia';
        break;
      case 'fr' :
        $field = 'taille';
        break;
      case 'en' :
      default :
        $field = 'size';
        break;
    }
    $size = get_post_meta($postid,  $field, true);
    return sprintf( __('The size is: %s', YOURTEXTDOMAIN ), $size );
}

Than in the loop:

...
the_post();
...
echo get_localized_size(); // pass post ID as argument when out of the loop
...
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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