WordPress.org

Ready to get started?Download WordPress

Forums

qTranslate
qtranslate, I do not succeed in translating the categories (3 posts)

  1. Mariie
    Member
    Posted 1 year ago #

    Hi,

    I use qtranslate but I do not succeed in translating the categories of articles, portfolio, and menu of the theme "white-rock-restaurant"

    Can you help me?
    Thanks

    http://wordpress.org/extend/plugins/qtranslate/

  2. lindacis
    Member
    Posted 11 months ago #

    I have the same problem that content only is translated , but categories or menues or rvrn if titles NOT
    Please , could you help me ?
    thanks alot

  3. miseva
    Member
    Posted 11 months ago #

    you can translate menus like this:

    <!--:ge-->TiTle-GEO<!--:--><!--:en-->TiTle-ENG<!--:-->
    or
    [:en]TiTle-ENG[:ge]TiTle-GEO

    and if you want to change custom links for each language you should try this:
    1. header.php

    // You place this instead of your previous wp_nav_menu() call in your theme. Just remember to change the "theme_location" parameter
    wp_nav_menu(array('theme_location' => 'your_theme_location', 'container' => '', 'fallback_cb' => '', 'walker' => new CustomLinkModifierWalker()));

    2. my theme / functions.php

    // You put this piece of code in your functions.php file
    class CustomLinkModifierWalker extends Walker_Nav_Menu {
       function __( $text ) {
          if ( preg_match_all('~(.*?)\|(\w{2,})\|~', $text, $matches) ) {
             $text = '';
             foreach ($matches[1] as $i => $match) {
                $text .= "[:{$matches[2][$i]}]$match";
             }
             $text = __( $text );
          }
          return $text;
       }
       function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
          global $wp_query;
          $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
    
          $class_names = $value = '';
    
          $classes = empty( $item->classes ) ? array() : (array) $item->classes;
          $classes[] = 'menu-item-' . $item->ID;
    
          $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
          $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
    
          $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
          $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
    
          $output .= $indent . '<li' . $id . $value . $class_names .'>';
    
          $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
          $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
          $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
          $attributes .= ! empty( $item->url )    ? ' href="' . esc_attr( $this->__( $item->url )  ) .'"' : '';
    
          $item_output = $args->before;
          $item_output .= '<a'. $attributes .'>';
          $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
          $item_output .= '';
          $item_output .= $args->after;
    
          $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
       }
    }

    and after that try this code to change manu custom links for each language http://www.dhg.ge/about-us/?lang=en|en|http://www.dhg.ge/about-us/?lang=ge|ge|

    and if you want to translate Custom Taxonomies in WordPress Add this into your Template functions.php at the end of the file, and QTranslate will work properly.

    function qtranslate_edit_taxonomies(){
    $args=array(
    'public' => true ,
    '_builtin' => false
    );
    $output = 'object'; // or objects
    $operator = 'and'; // 'and' or 'or'
    
    $taxonomies = get_taxonomies($args,$output,$operator);
    
    if ($taxonomies) {
    foreach ($taxonomies as $taxonomy ) {
    add_action( $taxonomy->name.'_add_form', 'qtrans_modifyTermFormFor');
    add_action( $taxonomy->name.'_edit_form', 'qtrans_modifyTermFormFor');
    }
    }
    }
    add_action('admin_init', 'qtranslate_edit_taxonomies');

    GL

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic