Support » Plugin: Polylang » [Plugin: Polylang] Register taxonomy so that it's name can be translated

  • Hi all! (my first post at
    Polylang is a great plugin for multilingual sites – thanks for creating it! I’m doing the r&d work to allow my taxonomy names to get translated. I have found (and lost…) a page with a script for generating the “register taxonomy” function in such a way, I think, that the names of taxonomies were put into those __(”) functions, to get translated. Do you think it is possible?
    For SEO purposes, I think your plugin is great, as the slugs for taxonomies, posts, pages are translated / separate for each language.
    But for the work to be complete, generated taxonomy names, labels, plurals, and other forms should also go to the .mo and .po files to be translated. Another plugin, xili-language claims to offer similar functionality, but I’m still testing if it really does the job.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Chouby


    Yes. you can use something like:

        'name'=>__('mytaxonomies in English'),
        'singular_name' => __('mytaxonomy in English'),
        'edit item'=>__('edit mytaxonomy in English)

    To be completed for other labels. Everything is well explained in the codex
    This does not depend on Polylang or other similar plugins. This is the right way to write an internationalized plugin which can then be translated using po and mo files.

    OK, sorry: my post was far from precision and optimal placement (at Ultimate Taxonomy Manager’s forum…), but still – thanks for answering. So let’s give my wording another chance:

    If the taxonomies are registered by Ultimate Taxonomy Manager plugin – Code Styling Localisation (the plugin I use to create .po translation files and generate .mo files from them) finds no strings to scan the strings.
    Also, when I create the .po files in the child theme folder, it does not list my child theme as if there was nothing to translate…

    Puting data structure and algorithms into the theme is just intrinsically wrong for me…

    Where do I register the taxonomies, and corresponding algorithms not to lose them when changing themes? And not to open the php file at every website serving?
    Thanks for clues…

    Plugin Author Chouby


    Well, I explained things for static strings. The plugin Code Styling Localization does work only for static strings too. Here your goal is to translate user defined strings. This is technically possible with Polylang 0.6+ but you will need to modify the code inside the Ultimate Taxonomy Manager plugin to tell him to translate strings with Polylang functions. So the caveat is that each time you update the Ultimate Taxonomy Manager plugin, your modifications will be erased (except if you convince the author to include these modifications in the plugin !).

    So you will need WP 3.3+ + Polylang 0.6 or WP 3.1+ + Polylang 0.6.1 (there is a bug in 0.6 which prevents string translations to work with WP versions older than 3.3)

    The modifications refer to Ultimate taxonomy manager 1.2.

    Edit the file ultimate-taxonomy-manager.php and insert the following code at line 466 (just before register_taxonomy…)

    foreach ($xy_tax['args']['labels'] as $key=>$str){
    	if (is_admin())
    		pll_register_string('taxonomy manager', $str);
    		$xy_tax['args']['labels'][$key] = pll__($str);

    Once it is done, you can create taxonomies as you usually do and translate labels in the Polylang strings translation panel.

    Thanks! It works!
    Only for the core category and post tag I needed to recode it to use the translated labels from translation files.

    There is a serious problem with presentation of custom taxonomies of custom posts (“services”) – they are not displayed in the editor. (it says “none”).

    For the posts created today, all taxonomy terms in their respective taxonomy columns of the editur are shown as assigned.
    I am using some taxos to describe the services, like Prio and Detail Level, so a service can only have single priority and detail level, I have therefore chosen to display dropdowns in the editor.

    Now, for all posts marked via Polylang as Polish, the Polish taxonomies assigned to them, are shown in editor as “none”. But these data/assigned taxonomies are there, because I can filter/display the content from the frontend. Also clicking “edit” (post editor) does not display proper data.
    What I have also noticed, there is a post, which has both English and Polish taxonomy terms assigned.

    I have created a post (custom), saved and afterwards: – editor – custom posts list

    If you could help a beginner out, I appreciate it.

    Plugin Author Chouby


    Probably both plugins are not compatible. It was already quite a lot of work to make categories and post tags metaboxes work correctly with Polylang. So unfortunately there are minor chances that it works with metaboxes created by other plugins without extra coding.

    :/ I understand, there are endless combinations…
    Or maybe the problem’s not in the plugin compatibility, but
    my attempts to create a child theme with its own textdomain caused the problem?
    I have created a test post yesterday, and everything is OK today, I’ll give it a try…

    Plugin Author Chouby


    I m not expert enough in child themes to answer your other question.

    But I do not believe it is related with the problem reported here as it is in the backend.

    in xili-language, non-hierarchical taxonomy clouds are managed inside and by xili-tidy-tags (need specific instantiation). website uses theses features.
    Author of trilogy – xili-language, xili-tidy-tags and xili-dictionary

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Polylang] Register taxonomy so that it's name can be translated’ is closed to new replies.