Skip to content

Commit

Permalink
Added translation support
Browse files Browse the repository at this point in the history
  • Loading branch information
gagan0123 committed Feb 21, 2013
1 parent 3628243 commit 4548e88
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
8 changes: 4 additions & 4 deletions class-shortcode-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
class Shortcode_Widget extends WP_Widget {

function __construct() {
$widget_ops = array('classname' => 'shortcode_widget', 'description' => __('Shortcode or HTML or Plain Text','shortcode-widget'));
$widget_ops = array('classname' => 'shortcode_widget', 'description' => __('Shortcode or HTML or Plain Text', SHORTCODE_WIDGET_TEXT_DOMAIN));
$control_ops = array('width' => 400, 'height' => 350);
parent::__construct('shortcode-widget', __('Shortcode Widget','shortcode-widget'), $widget_ops, $control_ops);
parent::__construct('shortcode-widget', __('Shortcode Widget', SHORTCODE_WIDGET_TEXT_DOMAIN), $widget_ops, $control_ops);
}

function widget( $args, $instance ) {
Expand Down Expand Up @@ -39,12 +39,12 @@ function form( $instance ) {
$title = strip_tags($instance['title']);
$text = esc_textarea($instance['text']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:','shortcode-widget'); ?></label>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', SHORTCODE_WIDGET_TEXT_DOMAIN); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>

<textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>

<p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs','shortcode-widget'); ?></label></p>
<p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs', SHORTCODE_WIDGET_TEXT_DOMAIN); ?></label></p>
<?php
}
}
Expand Down
10 changes: 8 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
<?php
/*
Plugin Name: Shortcode Widget
Plugin URI: http://www.IaMmE.in
Plugin URI: http://wordpress.org/extend/plugins/shortcode-widget/
Description: Adds a text-like widget that allows you to write shortcode in it. (Just whats missing in the default text widget)
Author: gagan0123
Author URI: http://gagan.pro/
Version: 0.1
Version: 0.2
Text Domain: shortcode-widget
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/

define('SHORTCODE_WIDGET_TEXT_DOMAIN','shortcode_widget');

require_once('class-shortcode-widget.php');

function shortcode_widget_init(){
register_widget('Shortcode_Widget');
}
add_action('widgets_init','shortcode_widget_init');

function shortcode_widget_load_text_domain(){
load_plugin_textdomain( SHORTCODE_WIDGET_TEXT_DOMAIN, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
add_action('plugins_loaded','shortcode_widget_load_text_domain');
?>
5 changes: 3 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: gagan0123
Tags: Shortcode, Widget
Requires at least: 3.3
Tested up to: 3.5
Stable tag: 0.1
Tested up to: 3.5.1
Stable tag: 0.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -21,3 +21,4 @@ Adds a text-like widget that allows you to write shortcode in it. (Just whats mi

== Changelog ==
0.1 Added the shortcode widget
0.2 Added translation support

0 comments on commit 4548e88

Please sign in to comment.