• Hi!

    I’m using customizr theme in a multilanguage installation with qtranslate. I have trouble getting translate the elements of the homepage of the website (text in the slider and in the Featured pages).

    How should I proceed to translate them?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter jordiperez77

    (@jordiperez77)

    Further details of my doubt:

    If i use the qtranslate tags [:es] or [:en] in “Customizr options / front page” I can put different texts. However, the limitation of featured text in 200 car. max is trouble. It is possible to desactivate this limitation of caracters?

    In other side, I can’t use the qtranslate tags [:en] in the slider. They’re not efective. How to proceed?

    Hi Jordi,
    As I’ve got the same problem as you I was wondering if you finally could disable the limitation of characters.
    On the other hand, have you found any other effective way to translate?
    Thanks a lot.
    Rodrigo

    Thread Starter jordiperez77

    (@jordiperez77)

    @Rodrigod

    I haven’t found the way to put off the limit of 200 caracters. It would be nice to know it

    I had your problem too.

    The solution I found was to modify theme’s files as follows, thus losing the possibility of upgrading the theme, but I was planning to freeze updates anyway on that website:
    – limitations for slider text, description and button are found in wp-content/themes/customizr/inc/admin/class-admin-meta_boxes.php

    Having three languages for my site I tripled the numbers. Use Ctrl+F in that file and replace all 250’s with 750 (or 500 if you have 2 langs) and the 80’s with 240 (or 160). Or just comment out the check on limitations altogether, using /* and */, like this:

    /*        if (strlen( $text_value) > 250) {
              $text_value = substr( $text_value,0,strpos( $text_value, ' ' ,250));
              $text_value = $text_value . ' ...';
            }
            else {
              $text_value = $text_value;
            }
    */

    Of course, I don’t recommend modifying theme files to anyone, but it’s a solution, since the theme developers have put a limitation without the possibility to disable it. Disabling length limitations on slider elements would be a great addition to theme options panel.

    As to translating the slider content, using language shortcodes (e.g.: [:en]) I have managed to make them work by wrapping $title, $text and $button_link variables content into __() function (which gets parsed by qtranslate) in wp-content/themes/customizr/parts/class-header-slider.php (lines 188, 189 and 191 in current version) like this:

    $title              = esc_attr(__(get_post_meta( $id, $key = 'slide_title_key' , $single = true )));
    $text               = esc_html(__(get_post_meta( $id, $key = 'slide_text_key' , $single = true )));
    $button_text        = esc_attr(__(get_post_meta( $id, $key = 'slide_button_key' , $single = true )));

    Cheers!

    iaeSAUDI

    (@iaesaudi)

    Please I need update on this code to work with the latest version: 3.1.11
    My website:
    http://iaeksa.net/

    I have edited this file:
    wp-content/themes/customizr/parts/class-content-slider.php

    With this code, From:

    $data['title']          = apply_filters( 'tc_slide_title', $data['title'] , $id );
    $data['text']           = esc_html( apply_filters( 'tc_slide_text', $data['text'], $id ) );
    $data['color_style']    = apply_filters( 'tc_slide_color', $data['color_style'], $id );
    $data['link_id']        = apply_filters( 'tc_slide_link_id', $data['link_id'], $id );
    $data['link_url']       = ( 'demo' == $slider_name_id && is_null($data['link_url']) ) ? admin_url().'customize.php' : $data['link_url'];
    $data['link_url']       = apply_filters( 'tc_slide_link_url', $data['link_url'], $id );
    $data['button_text']    = apply_filters( 'tc_slide_button_text', $data['button_text'], $id );

    To:

    $data['title']          = esc_html( apply_filters( 'tc_slide_title', $data['title'] , $id ) );
    $data['text']           = esc_html( apply_filters( 'tc_slide_text', $data['text'], $id ) );
    $data['color_style']    = apply_filters( 'tc_slide_color', $data['color_style'], $id );
    $data['link_id']        = apply_filters( 'tc_slide_link_id', $data['link_id'], $id );
    $data['link_url']       = ( 'demo' == $slider_name_id && is_null($data['link_url']) ) ? admin_url().'customize.php' : $data['link_url'];
    $data['link_url']       = apply_filters( 'tc_slide_link_url', $data['link_url'], $id );
    $data['button_text']    = esc_html( apply_filters( 'tc_slide_button_text', $data['button_text'], $id ) );

    the home page now recognize some of it, but only showing one language only.

    ElectricFeet

    (@electricfeet)

    This is a post from a long time ago. Since then, Customizr has been updated to fully support qTranslate. If you have an up-to-date version, you can simply use qTranslate shortcodes in the front page text. E.g. [:en]English text[:fr]French text

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Translating home elements with qtranslate’ is closed to new replies.