Forums

i18n inside heredoc (1 post)

  1. remmy8
    Member
    Posted 1 year ago #

    Hello!

    What is the way to make my plugin translatable with HEREDOC and call
    __() inside the HEREDOC statement?

    When I write echo <<<MYTEXT
    __('to be translated', 'myplugin')
    MYTEXT;
    or
    echo <<<MYTEXT
    {__('to be translated', 'myplugin')}
    MYTEXT;
    I get the full statement __('to be translated', 'myplugin') echoed as it is.
    Is there an WP object that should be called for translation (something like {$wp->__('to be translated', 'myplugin')}? Which object it should be?

Topic Closed

This topic has been closed to new replies.

About this Topic