Support » Plugin: Polylang » Can this be done: Create own custom string and call it in page or widget

  • porga

    (@porga)


    I do not know if this is possible, or if anyone though about it, so I will write to start discussion.

    Simple example: You need to make text widget which will be translated to 10 langs. From my experience Polylang winn only catch widget title and allow it to be translated through custom strings, but not widget content. This way, you need to create 10 different text widgets and link them to show on different languages in order to show each for selected language.

    What could be done: Allow to create “custom string” manually with any type of content (text, rich rext, html, php) and call it with some kind of shortcode, with language ID.

    Process:
    Create custom string with ID=”example”. Enter translations or code for every language available.

    Call that sting with shortcode like this: [customstr example lang=en]
    or [customstr example lang=auto]

    lang=en – forces english translation
    lang=auto – recognizes translation from pll_current_language() and display current language translation.

    This way translations could be reused site-wide, multiple times, without duplicating content for every area they are needed.

    Is something like this practical and possible? I would really like to read your opinions.

    https://wordpress.org/plugins/polylang/

  • The topic ‘Can this be done: Create own custom string and call it in page or widget’ is closed to new replies.