Translated words not showing child theme

Found my solution here in the following line after hours of researching for an answer. This little line is one thing that is left out by all tutorials and most answers Remember that your filenames have to be fr_FR.po & fr_FR.mo (depending on your language) and not domain-fr_FR.xx like the plugins do. So I just … Read more

Translate arguments of a user added custom code [closed]

Because you are hardcoding the link, you will need to use icl_link_to_element() function and wrap any text you want to translate inside a gettext function: <?php icl_link_to_element( ‘ID_of_your_news_page’, ‘page’, ‘<h4>’ . __(‘News’) . ‘</h4>’ ); ?> This way you will get the correct version of the link based on the current language with the text … Read more

Changing interface language without multisite

2 notes regarding your own answer: try to not access on super global variables directly, but using filter_input your code throw a notice if $_GET[‘lang’] is not set So your code can be improved: function toscho_change_language() { return ‘bn_BD’; } if ( filter_input( INPUT_GET, ‘lang’, FILTER_SANITIZE_STRING ) === ‘bn’ ) { add_filter( ‘locale’, ‘toscho_change_language’ ); … Read more

Post types translation

Use get_post_types( [‘public’ => TRUE ], ‘objects’ );. This will return the already translated post type labels and other information. Example for tests: add_action( ‘wp_footer’, function() { $post_types = get_post_types( [ ‘public’ => TRUE, ‘_builtin’ => TRUE ], ‘objects’ // complete information, not just the name ); foreach ( $post_types as $slug => $arguments ) … Read more

Where does the locale come from?

Locale comes from WPLANG constant defined in wp-config.php. In the last version of WordPress (4.0, maybe 3.9) something is changing. You can install more languages setting WPLANG to different locale. Then you can select the language in the backend from Settings > General > Site language and set locale in the header. It seems that … Read more

WordPress Translations

.po and .mo files are for translating strings in code files. For translating post content use a translation plugin. I’ve used a few and find WPML to be the best in many aspects. Incidentally, they have a built-in workflow for translating both content and strings in code files.

failed to open stream: Permission denied warning while load_textdomain

If you want to use load_textdomain you must also specify the file name: function my_custom_locale() { load_textdomain(‘my-name’, get_stylesheet_directory().’/languages/my-name- ‘.get_locale().’.mo’); } add_action(‘after_setup_theme’, ‘my_custom_locale’); In my example I added custom translations used in additional template files placed inside the theme-child folder, where I also added the languages files folder (es. my-name-it_IT.mo, my-name-en_GB.mo). I added the code in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)