N
N
Nikolai Petrenko2015-09-01 12:17:12
Internationalization and localization
Nikolai Petrenko, 2015-09-01 12:17:12

How to make Wordpress multilingual?

I have a website, newgamer theme
Plugins Loco Translate, Polylang
Tried to translate using these plugins
Created newgamer.pot, en_US.po, ru_RU.po Likely
translated, added function
add_action('plugins_loaded', 'load_my_textdomain');
function load_my_textdomain(){
$mo_file_path = dirname(__FILE__) . '/lang/'. get_locale() . '.po';
load_textdomain('newgamer', $mo_file_path );
}
and in the template I try to call the translated text
<?php __('Comment: ', 'newgamer'); ?>
In loco translate there was a line 'Comment: ', I synchronized it, translated it into 2 languages, but instead of seeing the text, it simply does not exist, it seems not to be displayed
I apologize for misrepresenting the situation.
Please help me with advice, i.e. how to correctly implement multilingualism in a template for at least 2 languages ​​(ru, en) with the same switch as polylang.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikolai Petrenko, 2015-09-01
@Kingleonide

The solution for me was to install the PolyLang Theme Strings plugin and close the topic.
Wrapped for correct display pll_e('string');

E
Evgeny Perin, 2015-09-01
@seoperin

Polylang has functions for translating strings
https://polylang.wordpress.com/documentation/docum...
We look at pll__ and pll_y , well, we look at other functions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question