How to translate menu items?

You can create a menu use another language. Then you use conditional code to switch the menu. or you can use title attribute of menu. if($language==’us’): wp_nav_menu(menu1); else: wp_nav_menu(menu2); endif;

Translating publish dates to Arabic

Found it. Anyone with a similar problem can add this code to their site plugin or theme functions.php function convert_numbers_to_arabic( $string ) { $arabic_numbers = array(‘۰’, ‘۱’, ‘۲’, ‘۳’, ‘٤’, ‘۵’, ‘٦’, ‘۷’, ‘۸’, ‘۹’, ‘.’); $english_numbers = array(‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘.’); return str_replace($english_numbers, $arabic_numbers, $string); } add_filter( … Read more

How to syntax Json output for translation?

Technically, and this is highly discouraged do to it’s unfriendly and unpredictable nature, you can do this: <?php _e( $data[‘hair’][‘type’] ); ?> However, you’ll need to have all the possible values for that (“brown hair”, “blond hair”, etc.), listed in a .POT file (a translation template) so that translators know what to translate. You’ll need … Read more

Generate PO File

You can use POedit to generate the PO file from source code: https://codex.wordpress.org/User:Skippy/Creating_POT_Files The problem for me is that my WordPress installation is running on an Amazon Linux server, which does not have a package in the repos for POedit and I couldn’t figure out how to install POedit on my server (only on my … Read more