• I’m trying to write a plugin. I want to use polylang functions in my plugin. I will make my plugin cannot active without polylang plugin.
    When my plugin activate, I want to create 2 polylang language automatic. One is primary language for site and another is custom language.
    When user write a post in primary language, my plugin will translate to another custom language using some conversion process.
    Is it possible to create language sets and auto translate using 3rd party plugin like mine?
    Currently I can’t show my code, because it is just an idea.

    https://www.ads-software.com/plugins/polylang/

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

    (@chouby)

    Hi!

    Once your languages are created, the Polylang API should help you.

    To create the languages programmatically, you will need to deal a bit more with internals but that should be as easy as:

    /*
     * list of arguments that $args must contain:
     * name           -> language name (used only for display)
     * slug           -> language code (ideally 2-letters ISO 639-1 language code
     * locale         -> WordPress locale. If something wrong is used for the locale, the .mo files will not be loaded...
     * rtl            -> 1 if rtl language, 0 otherwise
     * term_group     -> language order when displayed
     *
     * optional arguments that $args can contain:
     * no_default_cat -> if set, no default category will be created for this language
     */
    
    $options = get_option('polylang');
    $model = new PLL_Admin_Model($options);
    $model->add_language($args);
    Thread Starter Sithu Thwin

    (@herzcthu)

    Hi Chouby,
    Thanks for the answer.
    Now I can get a good start.
    Will come back after I wrote some code and found problem ??

    I’m one of your plugin localization maintainer.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Addons functionality in Polylang ?’ is closed to new replies.