Plugin translation not working apart from name and description

Seems like you forgot to load the text domain The plugin handbook says that: You need to load the MO file with your plugin’s translations. You can load them by calling the function load_plugin_textdomain() (and load_muplugin_textdomain() if your plugin will be used as a Must-Use plugin). This call loads {text-domain}-{locale}.mo from your plugin’s base directory. … Read more

Strings including html for localisation

Your example is correct, simply because it works. There are hundreds of ways to localize strings wich are displayed including html, all good and elegant in their own way. I like to do this as follows: printf( ‘<div class=”updated”> <p>%1$s</p> </div>’, __( ‘All options are restored successfully.’, ‘mytextdomain’ ) ); You also could do this … Read more

Possible to add a language file to a plugin without adding .po/.mo files to plugin directory?

Best way to do this is probably by using a second, custom-made, plugin. Make a new plugin directory. Call it something like “example-com-custom-langs” or something unique to your site. In there, make a php file with a plugin header describing what the plugin does (for your own sanity), and do something like this: add_action(‘plugins_loaded’,’example_com_custom_langs_plugins_loaded’); function … Read more

Change WordPress Language

I found the issue. So what happens is that when you do redownload the wordpress you need to go BACK into settings and update the language setting in the dropdown. It will have a new value there. 🙂

Proper use of internationalization

The two are exactly the same but I would go for the first one: Easier to read No interpolation, keep interpolation for variables And, including the tags inside the format is making things more complicated, I can think of designers being tempted to use more tags if they see you are using them.

Localiztion in javascript

WordPress has a nice function mainly for that wp_localize_script To use it first queue your script: wp_enqueue_script( ‘My_Script_handle’, ‘path/to/script.js’ ); then create an array of strings you want to localize: $data = array( ‘exit’ => __( ‘Exit’,’my-plugin-domain’ ), ‘open’ => __( ‘Open’,’my-plugin-domain’ ), ‘close’ => __( ‘Close’,’my-plugin-domain’ ), ‘next’ => __( ‘Next’,’my-plugin-domain’ ), ‘previous’ => … Read more

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