2011-06-28, 01:47:58
I am trying to modify Chris's socialize plugin for i18n support but I just don't know where I lost it. I've read the wiki and created a gs-socialize/lang/ folder along with two necessary php language files: en_US.php & pl_PL.php. However, I always get the text shown in English.
Code:
<?php
/*
Plugin Name: GS-Socialize
Description: Adds social bookmark icons/links to the bottom of all posts/pages.
Version: 1.1
Author: Chris Cagle
Author URI: http://www.cagintranet.com/
*/
# get correct id for plugin
$thisfile=basename(__FILE__, ".php");
define('GSSOCIALICONPATH', $SITEURL.'plugins/gs-socialize/img/');
#i18n support
global $LANG;
if (function_exists('i18n_load_texts')) {
i18n_load_texts('gs-socialize');
} else {
i18n_merge('gs-socialize') || i18n_merge('gs-socialize','en_US');
}
# registration
register_plugin(
$thisfile,
'GS Socialize',
'1.1',
'Chris Cagle',
'http://www.cagintranet.com/',
'Adds social bookmark icons/links to the bottom of all posts/pages',
'',
''
);
# hooks
add_action('theme-header', 'gssocial_css');
add_action('content-bottom', 'gssocial_icons');
# functions
function gssocial_css() {
echo '
<style type="text/css">
div#socialize {margin:20px 0;}
div#socialize a {margin:0 8px 0 0 0;}
</style>
';
}
function gssocial_icons() {
echo '
<div id="socialize">
<b class="gssocial-title" >' .i18n_r("gs-socialize/SHARE"). '</b>
<a href="http://www.facebook.com/share.php?u='. get_page_url(TRUE) .'&t='. return_page_title() .'" title="Facebook" ><img src="'.GSSOCIALICONPATH .'facebook.png" alt="Facebook" /></a>
<a href="http://twitter.com/home?status='. return_page_title() .' - '. get_page_url(TRUE) .'" title="Twitter" ><img src="'.GSSOCIALICONPATH .'twitter.png" alt="Twitter" /></a>
</div>';
/*
<a href="http://delicious.com/post?url='. get_page_url(TRUE) .'&title='. return_page_title() .'" title="Add to Delicious" ><img src="'.GSSOCIALICONPATH .'delicious.png" alt="Add to Delicious" /></a>
<a href="http://digg.com/submit?phase=2&url='. get_page_url(TRUE) .'&title='. return_page_title() .'" title="Submit to Digg" ><img src="'.GSSOCIALICONPATH .'digg.png" alt="Submit to Digg" /></a>
<a href="http://www.stumbleupon.com/submit?url='. get_page_url(TRUE) .'&title='. return_page_title() .'" title="Stumble This" ><img src="'.GSSOCIALICONPATH .'stumble.png" alt="Stumble This" /></a>
';
*/
}
?>