• It is possible to make wp-dtree understand multilingual content.
    One just needs to add _e(“<text here>”) in certain places.
    Examples:
    wp-dtree_pge-functions.php
    line 37: echo _e(“$pgeresults”);
    line 39: echo wp_dtree_open_pages_to(_e(“$pgeresults”));

    If you do that, pages now understand multilingual content.

    The same with:
    wp-dtree_cat-functions.php
    line 104: echo _e(“$catresults”);
    line 106: echo wp_dtree_open_cat_to(_e(“$catresults”));

    and:
    wp-dtree_lnk-functions.php
    line 63: echo _e(“$lnkresults”);

    Didn’t search, what’s needed to make top node name multilingual as there is a workaround for it, if you don’t use widgets.

    So, could you, Ulfben, add this functionality to your excelent plugin?
    You just need to copy/paste it.

    Maris Svirksts

Viewing 15 replies - 1 through 15 (of 17 total)
  • Noted. Thanks for helping out. 🙂

    Mojskis – would you please download the development version and let me know if I’m doing this right?

    I just upgraded wp-dtree and something new is now happening.
    I’m using it in a bilingual site, combined with qtranslate.
    Everything is ok for pages content and titles; the tree is correctly reported in both languages.
    However, if you select the link to a secondary language, you go to the page in the default language. This did not happen with the previous version. I tried Moskjis’s suggestions but it results in displaying the tags of both languages (only in the secondary language).

    In my wp-dtree_pge-functions.php I have filters applied:

    37 line : echo apply_filters('the_title', $pgeresults);

    Do you have something to suggest?

    Many thanks in advance
    Stefano

    First off, I don’t think you should apply filters to $pgeresults, as it’s a huge nestled array. I doubt any filter would make sense of it. What are you doing with it?

    Second: how’s qtranslate supposed to work? Are you having two actual copies of every page, displaying the “correct” link depending on a user setting? Or is there one page, one link and the page content filtered on view?

    A link to your site would be good.

    Thread Starter Maris

    (@moskjis)

    to StefaRossi: “it results in displaying the tags of both languages”: do you have the *.mo file for second language?
    See this: link
    The functionality works for me, see this: link

    To ulfben: will check it now.

    Thread Starter Maris

    (@moskjis)

    To Ulfben:
    Did a first check on it. There is improvement, (great work on admin panel), there are not so many improvements with multilanguage support.

    Will check the code during the day.

    P.S. It didn’t show pages for me.

    P.P.S. There is one page, one link et cetera. You just display part of it.
    The tags, it looks for, is: [lang_<your language here>]<Text to display>[/lang<your language here>]
    Don’t know how it does it with *.mo files. But, as it completes it using WordPress build-in functionality: link,
    there should be no problems with or without qtranslate plugin.

    Before all, many thanks for your kind attention (and patience!)

    To both ulfben & Moskjis:
    I didn’t change the wp-dtree code manually – I’m not so practiced in programming to be able to manage code without too unexpected results -. However I noticed that difference in the abobe mentioned line 37…
    I have no double pages or folders; only one page with correct lang tags & using qtranslater; I’m using permalinks. The secondary language is English and the /en/ prefix is added to each page before the page name. This correctly leads to each secondary language page when starting from the buttons in the header, but not from the wp-dtree in the sidebar.

    If you have any kind of suggestion, I will try it immediately as I’m really found of wp-dtree and of its effects.

    Thread Starter Maris

    (@moskjis)

    To StefaRossi: my suggestions were for stable version: 3.4.2, not the development version. For code changing: you just replace the line mentioned with the new line, that’s all. Here is a zipped version: link.
    Note that I didn’t change code for archives or titles, as there was no need for it, at least for me.

    To Ulfben: The approach you took was for localization support alright, but the way you did it was not the one I would take. I understand why you did it that way, but, there is no need to worry about performance losses: the string gets longer only when one uses qtranslate (q. further in the text), and, in that case, they need that string. With q. you change the name on the fly: take it from different WordPress (W. further in the text) .mo file or user specified string. You did the same, before W. or q. could do it and, you did it for the default language (defined in wp-config.php), as you could not possibly see other languages. So, when W. or q. tried to do it there was nothing they could do: the string was already parsed.

    I looked through the code for a bit, so: here is a working example for links section:

    wp-dtree_lnk-functions.php
    change to:
    line 30: ‘title’ => $cat->name
    line 50: ‘title’ => $lnkresult->link_name,
    line 72: echo _e($lnkresults);

    I didn’t change line 70, Didn’t thought there was a need for it, as it looked like it was there for testing purposes.

    Dear Moskjis
    many thanks for your kind effort. I was already using version 3.4.2. Nevertheless, I substituded my whole plugin folder with your zipped one.
    Sorry, but it doesn’t behave as expected. Nothing new happens: the titles are in English but the point the other language.
    I went considering your link to a sample well working functionality but it doesn’t seem so to me: the list of pages titles is correctly turned into the different languages; however, all languages always point to the same pages of the primary language and they seem not to recognize permalinks…
    I really do not know what could I do. Add manually e_ links to all pages? They are not too many and I’m using wp-dtree only for pages…

    Any kind new idea is really welcome

    Thread Starter Maris

    (@moskjis)

    StefaRossi, thank you. You found a bug in, well, my thinking process 🙂
    What is needed is this function:
    qtrans_convertURL(string $url, string $lang)

    It returns an converted URL for the selected language or the current language, if $lang is omitted.

    Sadly, that means, we can’t get real independence from qtranslate.
    We will need to check for it.

    <?php
    if (function_exists(‘qtrans_convertURL’))
    {
    wp_dtree_get_pages(<some new param here>);
    }
    else
    {
    wp_dtree_get_pages();
    }
    ?>

    O, yes, Here functions for developers and template authors can be found.

    Moskjis – could you implement your changes in the development version and send me the (tested) code? (ulf at ulfben dot com)

    I can’t test the qtranslate functionality for you guys, so that would help tremendously.

    (Please note the difference between _e() and __() – _e will echo the translated string. Looking at your first post in this thread, using _e is redundant.)

    Thread Starter Maris

    (@moskjis)

    I’l do it. Not today, but during “computer workdays” – at work.
    And hope, StefaRossi will test it for me, as I seem to be bad at testing. 🙂

    About the difference between _e() and __(). I’m aware of it. But, somehow, only _e() seems to be working the way I want it in this case.
    Maybe some trigger is needed and I just need to find it.

    Thread Starter Maris

    (@moskjis)

    Well, if you add:
    add_action(‘init’, ‘wp_dtree_update_cache’);
    to the new wp-dtree.php, all works as wanted.
    Test it here

    The problem is, it makes caching almost useless.

    I’m thinking about ways to overcome this problem.

    Thank your guys. Both qtranslate and wp-dtree are great plugins. has this problem been sloved?

    to Moskjis:

    Are your advices in the first post avaliable to wp-dtree 3.5 under wordpress 2.7? whether the code of wp-dtree 3.5 need to be edit to make it compatible with Qtranslate?

    When i change the language setting with qtranslate in the dashboard, the language of wp-dtree Categories tree can be changed successfully. But when updating wp-dtree setting and turnning to the main page, wp-dtree keeps language setting choosed in the dashboard and can not be changed by Qtranslate. What’s the promble?
    here is my site : href=”http://www.filsonline.com/?p=131&lang=zh”&gt;

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘[Plugin: WP-dTree] wp-dtree and qtranslate’ is closed to new replies.