How to make multilingual static elements written in html in Wordpress? For example :

<h1>Привет</h1>. 

I understand that Polylang will not help here. Can I do something manually?

    2 answers 2

    I understand Polylang will not help here.

    Will help.

    if pll_current_language and further as necessary.

    Or you need to register the strings pll_register_string and output them pll_e

    Cm
    https://polylang.pro/doc/developpers-how-to/
    https://polylang.pro/doc/function-reference/

      This is done through the gettext function. Good description in Russian here .

      In your example, the code should look like this:

       <h1><?php echo __('Привет', 'my_text_domain'); ?></h1> 

      Next you need to use poedit to automatically collect all the lines in your code. Instructions in Russian here .

      Then compile .po in .mo, add a theme or plugin.