Localization.Whatever you want!

Hi folks,

I want to tell, how localization support is added to a wordpress plugin.

1) First create a function for plugin.

// localizing
if ( is_admin() ) { add_action('init', 'translate_function'); }
function translate_function() {
	load_plugin_textdomain(translator_file_name, '/wp-content/translator-folder-location/');
}

2) Two important point

__($message)
Searches the localization module for the translation of $message, and passes the translation to the PHP return statement. If no translation is found for $message, it just returns $message.

_e($message)
Searches the localization module for the translation of $message, and passes the translation to the PHP echo statement. If no translation is found for $message, it just echoes $message.

Ex:
echo '<div class=''update''><p>' . __('Options saved') . '</p></div>';
//this line not support localization
echo '<div class=''updated''><p>' . __('Options saved',translator_file_name) . '</p></div>';
//this line support localization

3) The third stage ( Create po & mo files)
I'm using poedit for translations.you can get here

Open poedit and follow pictures./ or follow link

I hope that helps,

Cheers.