Forums

[Plugin: WP_Multilingual] How to know which tags already have translations (3 posts)

  1. betoboullosa
    Member
    Posted 4 years ago #

    Hi,

    I've made one hack in order to know which tags, links and categories are already translated. This could be a nightmare when you have hundreds of them.

    In the function WPMManagment in multilingual.php, change the three SELECT statements like this:

    $res = $GLOBALS['wpdb']->get_results("SELECT t.term_id, t.name, (select GROUP_CONCAT(CONCAT(lang_shortcode,': ', translation_name) order by lang_shortcode separator ', ') from wp_langs2translations lt, wp_langs l where lt.lang_id = l.lang_id and lt.item = t.term_id and tr_type = tt.taxonomy group by lt.item) as translation FROM ".$GLOBALS['table_prefix']."term_taxonomy tt, ".$GLOBALS['table_prefix']."terms t  WHERE tt.taxonomy = 'category' AND tt.term_id = t.term_id", ARRAY_A);

    and then change the three foreachs for:

    foreach($res as $k=>$i){
       echo "<option value='".$i['term_id']."'>".$i['name'].": ".$i['translation']."</option>";
    }

    Doing this, the comboboxes will show the tag names (and categories and links) with their translations, if those translations exists.

    It's not the most beautiful design, but it's been very useful for me. Maybe these SELECTs could be used in the main code to improve the user-friendliness of the admin interface.

    Cheers,
    Beto

  2. Oleg Butuzov
    Member
    Posted 4 years ago #

    Nice, Beto.

    I will add it to next release.

  3. Oleg Butuzov
    Member
    Posted 4 years ago #

    done

Topic Closed

This topic has been closed to new replies.

About this Topic