How to localize built-in strings in a future-proof manner?

i think you need the gettext filter. lifted directly from the codex, here is an example: add_filter( ‘gettext’, ‘theme_change_comment_field_names’, 20, 3 ); /** * Change comment form default field names. * * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext */ function theme_change_comment_field_names( $translated_text, $text, $domain ) { if ( is_singular() ) { switch ( $translated_text ) { case ‘Name’ : … Read more

wordpress localization extending

If dont use the strings inside the theme or plugin the function for localisation, then it is not possible to add this to the mo/po file. You must change the source of the theme or plugin. But used the theme or plugin the functions, than parse the source via plugin or desktop tools to add … 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

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