Transposh WordPress Translation - Version 0.5.5

Version Description

Support for buddypress URLs

Download this release

Release Info

Developer oferwald
Plugin Icon 128x128 Transposh WordPress Translation
Version 0.5.5
Comparing to
See all releases

Code changes from version 0.5.4 to 0.5.5

Files changed (4) hide show
  1. core/constants.php +1 -1
  2. js/transposhedit.js +2 -2
  3. readme.txt +7 -2
  4. transposh.php +20 -2
core/constants.php CHANGED
@@ -99,7 +99,7 @@ $bing_languages = array("en", "ar", "bg", "zh", "zh-tw", "cs", "da", "nl", "ht",
99
  //Define the new capability that will be assigned to roles - translator
100
  define("TRANSLATOR", 'translator');
101
 
102
- define("TRANSPOSH_PLUGIN_VER",'0.5.4');
103
 
104
  //Define segment id prefix, will be included in span tag. also used as class identifier
105
  define("SPAN_PREFIX", "tr_");
99
  //Define the new capability that will be assigned to roles - translator
100
  define("TRANSLATOR", 'translator');
101
 
102
+ define("TRANSPOSH_PLUGIN_VER",'0.5.5');
103
 
104
  //Define segment id prefix, will be included in span tag. also used as class identifier
105
  define("SPAN_PREFIX", "tr_");
js/transposhedit.js CHANGED
@@ -9,5 +9,5 @@ a("table tbody td[source='0']",d.panel).append('<span title="human" style="displ
9
  "none").css("list-style-position","outside");a("#"+t_jp.prefix+"d-tabs-1").css("padding","1px").append('<form id="'+t_jp.prefix+'form"><fieldset><label for="original">Original Text</label><textarea cols="80" row="3" name="original" id="'+t_jp.prefix+'original" class="text ui-widget-content ui-corner-all" readonly="y"/><label for="translation">Translate To</label><textarea cols="80" row="3" name="translation" id="'+t_jp.prefix+'translation" value="" class="text ui-widget-content ui-corner-all"/></fieldset></form>');
10
  a("#"+t_jp.prefix+"d-tabs-1 label").css("display","block");a("#"+t_jp.prefix+"d-tabs-1 textarea.text").css({"margin-bottom":"12px",width:"95%",padding:".4em"});a("#"+t_jp.prefix+"original").val(a("#"+t_jp.prefix+b).attr("data-orig"));a("#"+t_jp.prefix+"translation").val(a("#"+t_jp.prefix+b).html());a("#"+t_jp.prefix+b).attr("data-trans")&&a("#"+t_jp.prefix+"translation").val(a("#"+t_jp.prefix+b).attr("data-trans"));a("#"+t_jp.prefix+"translation").data("edit",{changed:false});a("#"+t_jp.prefix+"translation").keyup(function(){if(a("#"+
11
  t_jp.prefix+b).text()!==a(this).val()){a(this).css("background","yellow");a(this).data("edit",{changed:true})}else{a(this).css("background","");a(this).data("edit",{changed:false})}});a("#"+t_jp.prefix+"d-tabs").dialog({bgiframe:true,modal:true,width:500,buttons:c})}var h,i;a("."+t_jp.prefix).each(function(){var b=a(this).attr("id").substr(a(this).attr("id").lastIndexOf("_")+1),c;a(this).after('<span id="'+t_jp.prefix+"img_"+b+'" class="tr-icon" title="'+a(this).attr("data-orig")+'"></span>');c=a("#"+
12
- t_jp.prefix+"img_"+b);c.click(function(){if(typeof a.fn.tabs!=="function"){a.ajaxSetup({cache:true});a.getScript(t_jp.plugin_url+"/js/lazy.js",function(){a.xLazyLoader({js:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/jquery-ui.min.js",css:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/themes/ui-lightness/jquery-ui.css",success:function(){k(b)}})})}else k(b);return false}).css({border:"0px",margin:"1px",padding:"0px"});if(a(this).attr("data-source")==="0")c.addClass("tr-icon-green");
13
- else a(this).attr("data-source")&&c.addClass("tr-icon-yellow");a(this).attr("data-hidden")==="y"&&c.css({opacity:"0.6"})})})(jQuery);
9
  "none").css("list-style-position","outside");a("#"+t_jp.prefix+"d-tabs-1").css("padding","1px").append('<form id="'+t_jp.prefix+'form"><fieldset><label for="original">Original Text</label><textarea cols="80" row="3" name="original" id="'+t_jp.prefix+'original" class="text ui-widget-content ui-corner-all" readonly="y"/><label for="translation">Translate To</label><textarea cols="80" row="3" name="translation" id="'+t_jp.prefix+'translation" value="" class="text ui-widget-content ui-corner-all"/></fieldset></form>');
10
  a("#"+t_jp.prefix+"d-tabs-1 label").css("display","block");a("#"+t_jp.prefix+"d-tabs-1 textarea.text").css({"margin-bottom":"12px",width:"95%",padding:".4em"});a("#"+t_jp.prefix+"original").val(a("#"+t_jp.prefix+b).attr("data-orig"));a("#"+t_jp.prefix+"translation").val(a("#"+t_jp.prefix+b).html());a("#"+t_jp.prefix+b).attr("data-trans")&&a("#"+t_jp.prefix+"translation").val(a("#"+t_jp.prefix+b).attr("data-trans"));a("#"+t_jp.prefix+"translation").data("edit",{changed:false});a("#"+t_jp.prefix+"translation").keyup(function(){if(a("#"+
11
  t_jp.prefix+b).text()!==a(this).val()){a(this).css("background","yellow");a(this).data("edit",{changed:true})}else{a(this).css("background","");a(this).data("edit",{changed:false})}});a("#"+t_jp.prefix+"d-tabs").dialog({bgiframe:true,modal:true,width:500,buttons:c})}var h,i;a("."+t_jp.prefix).each(function(){var b=a(this).attr("id").substr(a(this).attr("id").lastIndexOf("_")+1),c;a(this).after('<span id="'+t_jp.prefix+"img_"+b+'" class="tr-icon" title="'+a(this).attr("data-orig")+'"></span>');c=a("#"+
12
+ t_jp.prefix+"img_"+b);c.click(function(){if(typeof a.fn.tabs!=="function"||typeof a.fn.dialog!=="function"){a.ajaxSetup({cache:true});a.getScript(t_jp.plugin_url+"/js/lazy.js",function(){a.xLazyLoader({js:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/jquery-ui.min.js",css:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/themes/ui-lightness/jquery-ui.css",success:function(){k(b)}})})}else k(b);return false}).css({border:"0px",margin:"1px",padding:"0px"});if(a(this).attr("data-source")===
13
+ "0")c.addClass("tr-icon-green");else a(this).attr("data-source")&&c.addClass("tr-icon-yellow");a(this).attr("data-hidden")==="y"&&c.css({opacity:"0.6"})})})(jQuery);
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: oferwald
3
  Donate link: http://transposh.org/donate/
4
  Tags: translation, widget, filter, bilingual, multilingual, transposh, translate, language, crowdsourcing, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese
5
  Requires at least: 2.7
6
- Tested up to: 3.0 rc-2
7
- Stable tag: 0.5.4
8
 
9
  Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
10
 
@@ -159,6 +159,8 @@ images based on the current language
159
  5. Widget style selection box, with three basic appearances, flags below (in Hebrew), language selection on the top right and language list on the bottom right.
160
 
161
  == Upgrade Notice ==
 
 
162
  = 0.5.3 =
163
  Support URL translation
164
  = 0.5.2 =
@@ -177,6 +179,9 @@ This version provides integration with google-sitemaps-xml and wp-super-cache
177
  This version allows sorting of languages within the widget
178
 
179
  == Changelog ==
 
 
 
180
  = 2010/06/06 - 0.5.4 =
181
  * Fix some issues with the widget regarding url translation
182
  * Fix some inclusion issue with transposh_ajax.php file
3
  Donate link: http://transposh.org/donate/
4
  Tags: translation, widget, filter, bilingual, multilingual, transposh, translate, language, crowdsourcing, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese
5
  Requires at least: 2.7
6
+ Tested up to: 3.0
7
+ Stable tag: 0.5.5
8
 
9
  Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
10
 
159
  5. Widget style selection box, with three basic appearances, flags below (in Hebrew), language selection on the top right and language list on the bottom right.
160
 
161
  == Upgrade Notice ==
162
+ = 0.5.5 =
163
+ Support for buddypress URLs
164
  = 0.5.3 =
165
  Support URL translation
166
  = 0.5.2 =
179
  This version allows sorting of languages within the widget
180
 
181
  == Changelog ==
182
+ = 2010/06/18 - 0.5.5 =
183
+ * Add support for buddypress URLs
184
+ * Fix UI issues when jQuery tools were used on the page
185
  = 2010/06/06 - 0.5.4 =
186
  * Fix some issues with the widget regarding url translation
187
  * Fix some inclusion issue with transposh_ajax.php file
transposh.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: http://transposh.org/
5
  Description: Translation filter for WordPress, After enabling please set languages at the <a href="options-general.php?page=transposh">the options page</a> Want to help? visit our development site at <a href="http://trac.transposh.org/">trac.transposh.org</a>.
6
  Author: Team Transposh
7
- Version: 0.5.4
8
  Author URI: http://transposh.org/
9
  License: GPL (http://www.gnu.org/licenses/gpl.txt)
10
  */
@@ -114,6 +114,7 @@ class transposh_plugin {
114
  add_filter('request', array(&$this,'request_filter'));
115
  }
116
  add_filter('comment_text', array(&$this,'comment_text_wrap'),9999); // this is a late filter...
 
117
  add_action('init', array(&$this,'on_init'),0); // really high priority
118
  add_action('parse_request', array(&$this,'on_parse_request'));
119
  add_action('plugins_loaded', array(&$this,'plugin_loaded'));
@@ -124,6 +125,8 @@ class transposh_plugin {
124
  add_action("sm_addurl",array(&$this,'add_sm_transposh_urls'));
125
  add_action('transposh_backup_event', array(&$this,'run_backup'));
126
  add_action('comment_post', array(&$this,'add_comment_meta_settings'), 1);
 
 
127
 
128
  register_activation_hook(__FILE__, array(&$this,'plugin_activate'));
129
  register_deactivation_hook(__FILE__,array(&$this,'plugin_deactivate'));
@@ -139,6 +142,7 @@ class transposh_plugin {
139
  stripos($url,'/wp-admin/') !== FALSE ||
140
  stripos($url,'/xmlrpc.php') !== FALSE);
141
  }
 
142
  /**
143
  * Called when the buffer containing the original page is flushed. Triggers the translation process.
144
  * @param string $buffer Original page
@@ -743,10 +747,24 @@ class transposh_plugin {
743
  add_comment_meta($post_id, 'tp_language', get_language_from_url($_SERVER['HTTP_REFERER'],$this->home_url), true);
744
  }
745
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
746
  /**
747
  * Modify comments to include the relevant language span
748
  * @param string $text
749
- * @return string
750
  */
751
  function comment_text_wrap($text) {
752
  $comment_lang = get_comment_meta(get_comment_ID(), 'tp_language', true);
4
  Plugin URI: http://transposh.org/
5
  Description: Translation filter for WordPress, After enabling please set languages at the <a href="options-general.php?page=transposh">the options page</a> Want to help? visit our development site at <a href="http://trac.transposh.org/">trac.transposh.org</a>.
6
  Author: Team Transposh
7
+ Version: 0.5.5
8
  Author URI: http://transposh.org/
9
  License: GPL (http://www.gnu.org/licenses/gpl.txt)
10
  */
114
  add_filter('request', array(&$this,'request_filter'));
115
  }
116
  add_filter('comment_text', array(&$this,'comment_text_wrap'),9999); // this is a late filter...
117
+ add_filter('bp_uri', array(&$this,'bp_uri_filter')); // buddypress compatability
118
  add_action('init', array(&$this,'on_init'),0); // really high priority
119
  add_action('parse_request', array(&$this,'on_parse_request'));
120
  add_action('plugins_loaded', array(&$this,'plugin_loaded'));
125
  add_action("sm_addurl",array(&$this,'add_sm_transposh_urls'));
126
  add_action('transposh_backup_event', array(&$this,'run_backup'));
127
  add_action('comment_post', array(&$this,'add_comment_meta_settings'), 1);
128
+ //TODO add_action('manage_comments_nav', array(&$this,'manage_comments_nav'));
129
+ //TODO comment_row_actions (filter)
130
 
131
  register_activation_hook(__FILE__, array(&$this,'plugin_activate'));
132
  register_deactivation_hook(__FILE__,array(&$this,'plugin_deactivate'));
142
  stripos($url,'/wp-admin/') !== FALSE ||
143
  stripos($url,'/xmlrpc.php') !== FALSE);
144
  }
145
+
146
  /**
147
  * Called when the buffer containing the original page is flushed. Triggers the translation process.
148
  * @param string $buffer Original page
747
  add_comment_meta($post_id, 'tp_language', get_language_from_url($_SERVER['HTTP_REFERER'],$this->home_url), true);
748
  }
749
 
750
+ /**
751
+ * This filter method helps buddypress understand the transposh generated URLs
752
+ * @param string $uri The url that was originally received
753
+ * @return string The url that buddypress should see
754
+ */
755
+ function bp_uri_filter($uri) {
756
+ $lang = get_language_from_url($uri, $this->home_url);
757
+ $uri = cleanup_url($uri, $this->home_url);
758
+ if ($this->options->get_enable_url_translate()) {
759
+ $uri = get_original_url($uri,'', $lang, array($this->database,'fetch_original'));
760
+ }
761
+ return $uri;
762
+ }
763
+
764
  /**
765
  * Modify comments to include the relevant language span
766
  * @param string $text
767
+ * @return string
768
  */
769
  function comment_text_wrap($text) {
770
  $comment_lang = get_comment_meta(get_comment_ID(), 'tp_language', true);