Transposh WordPress Translation - Version 0.2.2

Version Description

Download this release

Release Info

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

Code changes from version 0.2.1 to 0.2.2

Files changed (5) hide show
  1. core/parser.php +8 -6
  2. readme.txt +3 -1
  3. transposh.php +3 -3
  4. transposh_db.php +2 -2
  5. transposh_widget.php +1 -1
core/parser.php CHANGED
@@ -98,12 +98,14 @@ class parser {
98
  * Note html markups are not considered sentence breaker within the scope of this function.
99
  * @param $char charcter checked if breaker
100
  * @param $nextchar needed for checking if . or - breaks
101
- * @return bool true if current position marks a break in sentence
102
  */
103
- function is_sentence_breaker($char, $nextchar)
104
  {
105
- if (($char == '.' || $char == '-') && ($this->is_white_space($nextchar))) return true;
106
- return (strpos(',?()[]"!:|;∙',$char) !== false) ? true : false;
 
 
107
  }
108
 
109
  /**
@@ -157,10 +159,10 @@ class parser {
157
  $pos += $len_of_entity;
158
  }
159
  // will break translation unit when there's a breaker ",.[]()..."
160
- else if($this->is_sentence_breaker($string[$pos],$string[$pos+1]))
161
  {
162
  $this->tag_phrase($string,$start,$pos);
163
- $pos++;
164
  $start = $pos;
165
  }
166
  // Numbers also break, if they are followed by whitespace (don't break 42nd)
98
  * Note html markups are not considered sentence breaker within the scope of this function.
99
  * @param $char charcter checked if breaker
100
  * @param $nextchar needed for checking if . or - breaks
101
+ * @return int length of breaker if current position marks a break in sentence
102
  */
103
+ function is_sentence_breaker($char, $nextchar, $nextnextchar)
104
  {
105
+ if (($char == '.' || $char == '-') && ($this->is_white_space($nextchar))) return 1;
106
+ if (ord($char) == 226 && ord($nextchar) == 136 && ord($nextnextchar) == 153) return 3; //∙
107
+ if (ord($char) == 194 && ord($nextchar) == 183) return 2; //·
108
+ return (strpos(',?()[]"!:|;',$char) !== false) ? 1 : 0;
109
  }
110
 
111
  /**
159
  $pos += $len_of_entity;
160
  }
161
  // will break translation unit when there's a breaker ",.[]()..."
162
+ else if($senb_len = $this->is_sentence_breaker($string[$pos],$string[$pos+1],$string[$pos+2]))
163
  {
164
  $this->tag_phrase($string,$start,$pos);
165
+ $pos += $senb_len;
166
  $start = $pos;
167
  }
168
  // Numbers also break, if they are followed by whitespace (don't break 42nd)
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://transposh.org/
4
  Tags: translation, widget, filter, bilingual, multilingual, transposh, language, crowdsourcing, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese
5
  Requires at least: 2.7
6
  Tested up to: 2.7.1
7
- Stable tag: 0.2.1
8
 
9
  Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
10
 
@@ -97,6 +97,8 @@ Just add the following line to your template:
97
  5. Widget style selection
98
 
99
  == Release notes ==
 
 
100
  * 2009/05/21 - 0.2.1
101
  * Fixed unique breaking case in parser (style used within script and not properly terminated) (thanks again Fernanda)
102
  * Added language list mode to widget
4
  Tags: translation, widget, filter, bilingual, multilingual, transposh, language, crowdsourcing, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese
5
  Requires at least: 2.7
6
  Tested up to: 2.7.1
7
+ Stable tag: 0.2.2
8
 
9
  Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
10
 
97
  5. Widget style selection
98
 
99
  == Release notes ==
100
+ * 2009/05/25 - 0.2.2
101
+ * Fixed wrong handling of multy-byte chars as terminators (middle dots) which caused a regression bug
102
  * 2009/05/21 - 0.2.1
103
  * Fixed unique breaking case in parser (style used within script and not properly terminated) (thanks again Fernanda)
104
  * Added language list mode to widget
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.2.1
8
  Author URI: http://transposh.org/
9
  License: GPL (http://www.gnu.org/licenses/gpl.txt)
10
  */
@@ -357,7 +357,7 @@ function add_transposh_css() {
357
  return;
358
  }
359
  //include the transposh.css
360
- wp_enqueue_style("transposh","$tr_plugin_url/css/transposh.css",array(),'0.2.1');
361
  wp_enqueue_style("jquery","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/ui-lightness/jquery-ui.css",array(),'1.0');
362
 
363
  }
@@ -401,7 +401,7 @@ function add_transposh_js() {
401
  wp_deregister_script('jquery');
402
  wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",array(),'1.3.2');
403
  wp_enqueue_script("google","http://www.google.com/jsapi",array(),'1');
404
- wp_enqueue_script("transposh","$tr_plugin_url/js/transposh.js?post_url=$post_url{$edit_mode}&lang={$lang}&prefix=".SPAN_PREFIX,array("jquery"),'0.2.1');
405
  }
406
  }
407
 
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.2.2
8
  Author URI: http://transposh.org/
9
  License: GPL (http://www.gnu.org/licenses/gpl.txt)
10
  */
357
  return;
358
  }
359
  //include the transposh.css
360
+ wp_enqueue_style("transposh","$tr_plugin_url/css/transposh.css",array(),'0.2.2');
361
  wp_enqueue_style("jquery","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/ui-lightness/jquery-ui.css",array(),'1.0');
362
 
363
  }
401
  wp_deregister_script('jquery');
402
  wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",array(),'1.3.2');
403
  wp_enqueue_script("google","http://www.google.com/jsapi",array(),'1');
404
+ wp_enqueue_script("transposh","$tr_plugin_url/js/transposh.js?post_url=$post_url{$edit_mode}&lang={$lang}&prefix=".SPAN_PREFIX,array("jquery"),'0.2.2');
405
  }
406
  }
407
 
transposh_db.php CHANGED
@@ -139,7 +139,7 @@ function update_translation()
139
  $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
140
 
141
  //add our own custom header - so we will know that we got here
142
- header("Transposh: ver-0.2.1 db_version-". DB_VERSION);
143
 
144
  list($translated_text, $old_source) = fetch_translation($original, $lang);
145
  if ($translated_text) {
@@ -243,7 +243,7 @@ function get_translation_history($token, $lang)
243
  $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
244
 
245
  //add our own custom header - so we will know that we got here
246
- header("Transposh: ver-0.2.1 db_version-". DB_VERSION);
247
 
248
  $query = "SELECT translated, translated_by, timestamp, source, user_login ".
249
  "FROM $table_name ".
139
  $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
140
 
141
  //add our own custom header - so we will know that we got here
142
+ header("Transposh: ver-0.2.2 db_version-". DB_VERSION);
143
 
144
  list($translated_text, $old_source) = fetch_translation($original, $lang);
145
  if ($translated_text) {
243
  $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
244
 
245
  //add our own custom header - so we will know that we got here
246
+ header("Transposh: ver-0.2.2 db_version-". DB_VERSION);
247
 
248
  $query = "SELECT translated, translated_by, timestamp, source, user_login ".
249
  "FROM $table_name ".
transposh_widget.php CHANGED
@@ -85,7 +85,7 @@ function add_transposh_widget_css() {
85
  global $tr_plugin_url;
86
 
87
  //include the transposh_widget.css
88
- wp_enqueue_style("transposh_widget","$tr_plugin_url/css/transposh_widget.css",array(),'0.2.1');
89
 
90
  }
91
 
85
  global $tr_plugin_url;
86
 
87
  //include the transposh_widget.css
88
+ wp_enqueue_style("transposh_widget","$tr_plugin_url/css/transposh_widget.css",array(),'0.2.2');
89
 
90
  }
91