• First off, I want to thank Nikeo for this awesome theme.

    In this guide I will teach what needs to be modified in the current version (3.0.8) in order to make Customizr play nice with qTranslate. However, my sincere hope is that in some future version, Customizr will become multilingual ready and all these tiny mods won’t be necessary.

    PLEASE BEWARE: If you modify theme files you will lose all those mods on theme update so only do this if you’re willing to do them again with each version or if you’re going to freeze updates for Customizr.

    1. Remove limitations on slider titles, slider descriptions and slider buttons:
    Go to /wp-content/themes/customizr/inc/admin/class-admin-meta-boxes.php and comment out the following lines: 521 to 527, 552 to 558, 756 to 762 (the if-s, with the corresponding accolade). To comment out you either put // in front of each line, or you put /* before the block of lines and */ at the end. Example: (how to comment out lines 756 to 762):

    default://for button, color, title and post link field (actually not a link but an id)
    /*                       if (strlen( $mydata) > 80) {
                            $mydata = substr( $mydata,0,strpos( $mydata, ' ' ,80));
                            $mydata = esc_attr( $mydata) . ' ...';
                            }
                            else {
                              $mydata = esc_attr( $mydata);
                            }
    */                     break;

    To remove the 200 chars limitation for featured pages description (between the image and the button, on first page) you need to comment out lines 118 to 125 in /wp-content/themes/customizr/parts/class-content-featured_pages.php.

    An alternative to removing the limitations is to set them higher, in accordance with the number of languages your multilingual website will be set to (double the limit for 2 languages, triple it for 3, etc.).

    This is because qTranslate saves all languages content in the same field and parses the text before it gets output to the browser, only keeping the active language content.

    2. run __() function on content before it gets output in browser
    After we have removed the limitations, we have to make sure that qTranslate actually parses the texts before they get printed in the browser. To do that, we have to make sure they are run by the __() function, but before the text is run through any of the esc_attr(), esc_html() or any similar functions, as they might strip away the language shortcodes.

    For multilingual slider, you need to apply the __() function on $title, $text and $button_text variables in /wp-content/themes/customizr/parts/class-header-slider.php on lines 188, 189 and 191, before the esc_attr() and esc_html() functions, 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 )));
                            $text_color         = esc_attr(get_post_meta( $id, $key = 'slide_color_key' , $single = true )); // this line doesn't need modifying
                            $button_text        = esc_attr(__(get_post_meta( $id, $key = 'slide_button_key' , $single = true )));

    As of now, I haven’t been able to make multilingual excerpts for pages work with Customizr, but I was able to display multilingual content in featured pages area using laguage shortcodes (eg: [:en]English featured page text[:es]Spanish featured page text) in the custom descriptions provided by the Customizr options screen. For this to work you need to wrap the $text variable in __() function on line 196 in /wp-content/themes/customizr/parts/class-content-featured_pages.php, like this:

    <p class=”fp-text-<?php echo $area ?>”><?php echo __($text); ?></p>

    and, for the buttons, on line 199:

    <?php echo esc_attr(__(tc__f(‘__get_option’ , ‘tc_featured_page_button_text’))) ?>

    I hope I didn’t forget anything and also that this helps those of you who were desperately hoping for a solution to make Customizr slider and featured pages multilingual.

    One more thing: in order for all this to work you have to put multilingual texts in the slide fields using qTranslate shortcodes ([:en] english text[:es]spanish text, etc). This is obvious for many, but you need to actually do it in order for the whole thing to work. ??

    Wishing some tweaks into future releases of the theme will render my post useless, I thank you for your time.

Viewing 15 replies - 16 through 30 (of 53 total)
  • Hi acub,
    thanks for your interest.
    If I can, I want to suggest you of do not forgot to insert the translation function in the title of menu, and in the botton text of slider.
    Strangely in the buttons text of futured pages with this code works “<!–:it–>Scopri di più ?<!–:–><!–:en–>Read more ?<!–:–>” but not in the slider botton text.

    Thanks.

    Pietro

    @pietro This text isn’t translated as it is user-customizable. You can change the button text for each individual slide in the edit media screen, in the slider options.

    Hi,

    I’m using qtranslate too and I would like so much to have this implemented in the next theme version!

    Thanks to all!

    @electricfeet
    Hi,
    yes, but it don’t change when I change the site language, as well as don’t change the titles of widgets.

    Hi @acub!
    There is no rush but, when do you think this implementation will be released?
    There is a lot of expectation ??
    Thanks my friend.

    Thread Starter acub

    (@acub)

    I’m sorry, I cannot answer that question. A temporary solution is to make the mods in your child theme until they’re no longer needed.

    Right now the code is incomplete, as it doesn’t cover excerpts for featured pages. You can only have multilingual content for featured pages descriptions using the custom fields in the Customizr options panel. I’ll look into this over the next few days and as soon as I find a solution I’ll send Nikeo the result. Hopefully it will be included in the next release.

    hi,

    is it possible to bring this changes in the next theme update ?!

    Hi,

    Does the latest version 3.0.10 add those modifications?

    If not @acub can you post an update, if it’s needed?

    Thanks

    Theme Author presscustomizr

    (@nikeo)

    @acub : I did not include the qtranslate compatibility code in this release.
    I had other priorities to address first. This will be seriously studied for next one.
    Regards,
    NIcolas.

    @nikeo : Thanks!

    @ acub

    thanx for this thread it is perfect, the only thing that don’t work is the adding of the language changer.
    What I did is:
    1) creating the child theme
    2) crate the function.php with this code:
    <?php
    add_action(‘__logo_title’, ‘qtr_language_changer’);
    function qtr_language_changer() {
    echo qtrans_generateLanguageSelectCode(‘image’);
    }
    3) copy the style.css from the parent theme and adding your code

    At this point nothing happen…can someone help me?
    PS
    I have a logo in my header and I even tryed to replace ‘__logo_title’ with ‘before_header’ but always it is the same

    Thread Starter acub

    (@acub)

    The hook __logo_title no longer exists in this version. You have to hook your action to __after_header instead.

    acub you are a master…

    can you only tell me in what way did you modify the flag to fit better in the rectangle?

    Thread Starter acub

    (@acub)

    Take some bigger flags (I made mine 32px x 32px) and save them in your theme under /flags as {language_code}_big.png.
    Than add this CSS for each of the languages you use

    .qtrans_flag_{lang_code} {background: transparent url({link_to_your_theme_folder}/flags/{lang_code}_big.png} center center no-repeat;}
    /* Example, for italian: */
    .qtrans_flag_it {background: transparent url(/wp-content/themes/customizr-child/flags/it_big.png) center center no-repeat;}
    /* End of example ********/

    where {lang_code} is your language code and {link_to_your_theme_folder} is your relative or absolute path to theme folder.

    I personally have put them in the qtranslate folder, but it’s wrong, I should move them into the theme folder so I don’t have to re-copy the flags each time I update qtranslate.

    Hey, im using customizr 3.0.13 – what are the lines i should “comment out”?
    Beacause right now 521 to 527 are pretty much empty lines in /wp-content/themes/customizr/inc/admin/class-admin-meta-boxes.php.
    (so i guess the rest arent accurate neither)
    Thanks

Viewing 15 replies - 16 through 30 (of 53 total)
  • The topic ‘Multilingual Customizr – how to guide (using qTranslate) for Customizr 3.0.8’ is closed to new replies.