WordPress and Localization

The localized version is the English version translated. It contains the original and translated strings. You should look for missing translations or badly translated strings. Use a desktop tool like PoEdit or a plugin like Codestyling Localization to manage your WordPress, Themes and Plugins translations (the localized .po and .mo files).

Localize script not working

You’re calling wp_localize_script before the action that enqueues the script has run. Move the localize into the enqueue action, after the script is enqueued. function my_scripts_method() { wp_enqueue_script( ‘ajax_script’, get_stylesheet_directory_uri() . ‘/js/ajax_script.js’, array( ‘jquery’ ) ); wp_localize_script(‘ajax_script’, ‘WPURLS’, array( ‘siteurl’ => get_option(‘siteurl’) )); } add_action( ‘wp_enqueue_scripts’, ‘my_scripts_method’ ); That said, you probably don’t want to … Read more

I18n not working in plugin

The problem I was encountering was a result of not realizing that the 3rd parameter for load_plugin_textdomain should be a relative path to the language directory from WP_PLUGIN_DIR. Since plugin_dir_path returns an absolute path, things broke. Changing the hooked function as follows solved the problem: add_action(‘plugins_loaded’, array(‘PluginName’, ‘loadTextDomain’)); class PluginName { public static function loadTextDomain() … Read more

Localization, escape html elements mid-sentence

I’d use printf to put the markup into place after the translation. You can force the order with the right modifiers, but translators are probably smart enough to not really need that. printf( __(‘The image %sMUST%s be less than %s500 KB%s in size.’, CUSTOM_TEXT_DOMAIN), ‘<em>’, ‘</em>’, ‘<strong>’, ‘</strong>’ ) ; I consider Otto’s post to … Read more

Plugin translation ready – mo file not loaded

The load_plugin_textdomain() function had not the same textdomain as given in the PHP file of the plugin. I had written dummy names for this thread, therefore it could not be seen. But I changed it. Also the .mo and .po files have to have the localization code as set in the WordPress database at WP_LANG. … Read more

User specified Timezone

This mission is almost impossible. Players do not stay at one timezone therefor associating a timezone with a player can result in misleading and confusing output. What you can do is move all time to be expressed at a specific time base, lets say UTC, and write some JS that will translate the UTC time … Read more

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