Version Description
Improved speed and database structure
Download this release
Release Info
Developer | oferwald |
Plugin | Transposh WordPress Translation |
Version | 0.5.1 |
Comparing to | |
See all releases |
Code changes from version 0.5.0 to 0.5.1
- core/constants.php +1 -1
- core/parser.php +30 -3
- readme.txt +7 -1
- transposh.php +2 -1
- wp/transposh_backup.php +7 -0
- wp/transposh_db.php +75 -17
core/constants.php
CHANGED
@@ -97,7 +97,7 @@ $bing_languages = array("en", "ar", "bg", "zh", "zh-tw", "cs", "da", "nl", "ht",
|
|
97 |
//Define the new capability that will be assigned to roles - translator
|
98 |
define("TRANSLATOR", 'translator');
|
99 |
|
100 |
-
define("TRANSPOSH_PLUGIN_VER",'0.5.
|
101 |
|
102 |
//Define segment id prefix, will be included in span tag. also used as class identifier
|
103 |
define("SPAN_PREFIX", "tr_");
|
97 |
//Define the new capability that will be assigned to roles - translator
|
98 |
define("TRANSLATOR", 'translator');
|
99 |
|
100 |
+
define("TRANSPOSH_PLUGIN_VER",'0.5.1');
|
101 |
|
102 |
//Define segment id prefix, will be included in span tag. also used as class identifier
|
103 |
define("SPAN_PREFIX", "tr_");
|
core/parser.php
CHANGED
@@ -88,6 +88,8 @@ class parserstats {
|
|
88 |
class parser {
|
89 |
public $url_rewrite_func = null;
|
90 |
public $fetch_translate_func = null;
|
|
|
|
|
91 |
private $segment_id = 0;
|
92 |
/** @var simple_html_dom_node Contains the current node */
|
93 |
private $currentnode;
|
@@ -330,7 +332,7 @@ class parser {
|
|
330 |
elseif($num_len = $this->is_number($string,$pos)) {
|
331 |
// this is the case of B2 or B2,
|
332 |
if (($this->is_white_space($string[$pos-1]) || ($start == $pos)
|
333 |
-
|
334 |
($this->is_white_space($string[$pos+$num_len]) || $this->is_sentence_breaker($string[$pos+$num_len],$string[$pos+$num_len+1],$string[$pos+$num_len+2]))) {
|
335 |
// we will now compensate on the number followed by breaker case, if we need to
|
336 |
if (!($this->is_white_space($string[$pos-1]) || ($start == $pos))) {
|
@@ -399,7 +401,7 @@ class parser {
|
|
399 |
elseif ($node->tag == 'body') {
|
400 |
$this->inbody = true;
|
401 |
}
|
402 |
-
elseif ($node->tag == 'select') {
|
403 |
$this->inselect = $level;
|
404 |
}
|
405 |
// in submit type inputs, we want to translate the value
|
@@ -466,8 +468,13 @@ class parser {
|
|
466 |
else
|
467 |
$this->html->find('html',0)->dir="ltr";
|
468 |
|
469 |
-
if ($this->lang)
|
470 |
$this->html->find('html',0)->lang=$this->lang;
|
|
|
|
|
|
|
|
|
|
|
471 |
|
472 |
// not much point in further processing if we don't have a function that does it
|
473 |
if ($this->fetch_translate_func == null) {
|
@@ -502,6 +509,26 @@ class parser {
|
|
502 |
}
|
503 |
}
|
504 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
// actually translate tags
|
506 |
// texts are first
|
507 |
foreach ($this->html->find('text') as $e) {
|
88 |
class parser {
|
89 |
public $url_rewrite_func = null;
|
90 |
public $fetch_translate_func = null;
|
91 |
+
public $prefetch_translate_func = null;
|
92 |
+
|
93 |
private $segment_id = 0;
|
94 |
/** @var simple_html_dom_node Contains the current node */
|
95 |
private $currentnode;
|
332 |
elseif($num_len = $this->is_number($string,$pos)) {
|
333 |
// this is the case of B2 or B2,
|
334 |
if (($this->is_white_space($string[$pos-1]) || ($start == $pos)
|
335 |
+
|| ($this->is_sentence_breaker($string[$pos+$num_len-1],$string[$pos+$num_len],$string[$pos+$num_len+1]))) &&
|
336 |
($this->is_white_space($string[$pos+$num_len]) || $this->is_sentence_breaker($string[$pos+$num_len],$string[$pos+$num_len+1],$string[$pos+$num_len+2]))) {
|
337 |
// we will now compensate on the number followed by breaker case, if we need to
|
338 |
if (!($this->is_white_space($string[$pos-1]) || ($start == $pos))) {
|
401 |
elseif ($node->tag == 'body') {
|
402 |
$this->inbody = true;
|
403 |
}
|
404 |
+
elseif ($node->tag == 'select' || $node->tag == 'textarea') {
|
405 |
$this->inselect = $level;
|
406 |
}
|
407 |
// in submit type inputs, we want to translate the value
|
468 |
else
|
469 |
$this->html->find('html',0)->dir="ltr";
|
470 |
|
471 |
+
if ($this->lang) {
|
472 |
$this->html->find('html',0)->lang=$this->lang;
|
473 |
+
// add support for <meta name="language" content="<lang>">
|
474 |
+
if ($this->html->find('meta[name=language]')) {
|
475 |
+
$this->html->find('meta[name=language]')->content = $this->lang;
|
476 |
+
}
|
477 |
+
}
|
478 |
|
479 |
// not much point in further processing if we don't have a function that does it
|
480 |
if ($this->fetch_translate_func == null) {
|
509 |
}
|
510 |
}
|
511 |
|
512 |
+
// try some prefetching... (//todo - maybe move directly to the phrase create)
|
513 |
+
foreach ($this->html->find('text') as $e) {
|
514 |
+
foreach ($e->nodes as $ep) {
|
515 |
+
$originals[] = $ep->phrase;
|
516 |
+
}
|
517 |
+
}
|
518 |
+
foreach (array('title','value') as $title) {
|
519 |
+
foreach ($this->html->find('['.$title.']') as $e) {
|
520 |
+
foreach ($e->nodes as $ep) {
|
521 |
+
$originals[] = $ep->phrase;
|
522 |
+
}
|
523 |
+
}
|
524 |
+
}
|
525 |
+
foreach ($this->html->find('[content]') as $e) {
|
526 |
+
foreach ($e->nodes as $ep) {
|
527 |
+
$originals[] = $ep->phrase;
|
528 |
+
}
|
529 |
+
}
|
530 |
+
call_user_func_array($this->prefetch_translate_func,array($originals,$this->lang));
|
531 |
+
|
532 |
// actually translate tags
|
533 |
// texts are first
|
534 |
foreach ($this->html->find('text') as $e) {
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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: 2.9.2
|
7 |
-
Stable tag: 0.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,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.0 =
|
163 |
Ability to translate all content, backup service for human translations
|
164 |
= 0.4.3 =
|
@@ -171,6 +173,10 @@ This version provides integration with google-sitemaps-xml and wp-super-cache
|
|
171 |
This version allows sorting of languages within the widget
|
172 |
|
173 |
== Changelog ==
|
|
|
|
|
|
|
|
|
174 |
= 2010/03/24 - 0.5.0 =
|
175 |
* Ability to backup human translation to a remote database (hosted on google appengine)
|
176 |
* Ability to translate all existing content with a single click from the administration page
|
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: 2.9.2
|
7 |
+
Stable tag: 0.5.1
|
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.1 =
|
163 |
+
Improved speed and database structure
|
164 |
= 0.5.0 =
|
165 |
Ability to translate all content, backup service for human translations
|
166 |
= 0.4.3 =
|
173 |
This version allows sorting of languages within the widget
|
174 |
|
175 |
== Changelog ==
|
176 |
+
= 2010/04/11 - 0.5.1 =
|
177 |
+
* Improved database structure to support long translations
|
178 |
+
* Improved speed by pre-fetching contents with a single mysql query (over 70% faster in some cases)
|
179 |
+
* Fix for textarea tag bug - (thanks [timo] (http://www.herbaldepecona.com/))
|
180 |
= 2010/03/24 - 0.5.0 =
|
181 |
* Ability to backup human translation to a remote database (hosted on google appengine)
|
182 |
* Ability to translate all existing content with a single click from the administration page
|
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.
|
8 |
Author URI: http://transposh.org/
|
9 |
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
10 |
*/
|
@@ -164,6 +164,7 @@ class transposh_plugin {
|
|
164 |
//translate the entire page
|
165 |
$parse = new parser();
|
166 |
$parse->fetch_translate_func = array(&$this->database,'fetch_translation');
|
|
|
167 |
$parse->url_rewrite_func = array(&$this, 'rewrite_url');
|
168 |
$parse->dir_rtl = (in_array ($this->target_language, $GLOBALS['rtl_languages']));
|
169 |
$parse->lang = $this->target_language;
|
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.1
|
8 |
Author URI: http://transposh.org/
|
9 |
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
10 |
*/
|
164 |
//translate the entire page
|
165 |
$parse = new parser();
|
166 |
$parse->fetch_translate_func = array(&$this->database,'fetch_translation');
|
167 |
+
$parse->prefetch_translate_func = array(&$this->database,'prefetch_translations');
|
168 |
$parse->url_rewrite_func = array(&$this, 'rewrite_url');
|
169 |
$parse->dir_rtl = (in_array ($this->target_language, $GLOBALS['rtl_languages']));
|
170 |
$parse->lang = $this->target_language;
|
wp/transposh_backup.php
CHANGED
@@ -37,6 +37,13 @@ class transposh_backup {
|
|
37 |
$body = array();
|
38 |
$body["home_url"] = $this->transposh->home_url;
|
39 |
$body["key"] = $this->transposh->options->get_transposh_key();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
$result = wp_remote_post(TRANSPOSH_BACKUP_SERVICE_URL, array('body' => $body));
|
41 |
if (is_wp_error($result)) {
|
42 |
echo "500 - ".$result->get_error_message();
|
37 |
$body = array();
|
38 |
$body["home_url"] = $this->transposh->home_url;
|
39 |
$body["key"] = $this->transposh->options->get_transposh_key();
|
40 |
+
//Check if there are thing to backup, before even accessing the service
|
41 |
+
$rowstosend = $this->transposh->database->get_all_human_translation_history('null', 1);
|
42 |
+
if (empty($rowstosend)) {
|
43 |
+
echo "500 - No human translations to backup.";
|
44 |
+
return;
|
45 |
+
}
|
46 |
+
|
47 |
$result = wp_remote_post(TRANSPOSH_BACKUP_SERVICE_URL, array('body' => $body));
|
48 |
if (is_wp_error($result)) {
|
49 |
echo "500 - ".$result->get_error_message();
|
wp/transposh_db.php
CHANGED
@@ -32,7 +32,7 @@ define("TRANSLATIONS_TABLE", "translations");
|
|
32 |
define("TRANSLATIONS_LOG", "translations_log");
|
33 |
|
34 |
//Database version
|
35 |
-
define("DB_VERSION", "1.
|
36 |
|
37 |
//Constant used as key in options database
|
38 |
define("TRANSPOSH_DB_VERSION", "transposh_db_version");
|
@@ -40,10 +40,35 @@ define("TRANSPOSH_DB_VERSION", "transposh_db_version");
|
|
40 |
class transposh_database {
|
41 |
/** @property transposh_plugin $transposh father class */
|
42 |
private $transposh;
|
|
|
43 |
//constructor of class, PHP4 compatible construction for backward compatibility
|
44 |
function transposh_database(&$transposh) {
|
45 |
$this->transposh = &$transposh;
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
/**
|
48 |
* Fetch translation from db or cache.
|
49 |
* Returns An array that contains the translated string and it source.
|
@@ -67,15 +92,21 @@ class transposh_database {
|
|
67 |
}
|
68 |
}
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
73 |
|
74 |
-
|
75 |
-
$
|
76 |
-
$
|
77 |
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
if(ENABLE_APC && function_exists('apc_store')) {
|
@@ -190,6 +221,7 @@ class transposh_database {
|
|
190 |
}
|
191 |
// Setting the values string for the database (notice how concatanation is handled)
|
192 |
$values .= "('" . $original . "','" . $translation . "','" . $lang . "','" . $source . "')".(($items != $i+1) ?', ':'');
|
|
|
193 |
// Setting the transaction log records
|
194 |
$logvalues .= "('" . $original . "','" . $translation . "','" . $lang . "','".$loguser."','".$source."')".(($items != $i+1) ?', ':'');
|
195 |
|
@@ -202,10 +234,16 @@ class transposh_database {
|
|
202 |
// avoid empty work
|
203 |
if (!$values) return;
|
204 |
// perform insertion to the database, with one query :)
|
205 |
-
$update = "REPLACE INTO ".$GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE." (original, translated, lang, source)
|
206 |
-
VALUES $values";
|
207 |
-
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
$result = $GLOBALS['wpdb']->query($update);
|
210 |
|
211 |
if($result !== FALSE) {
|
@@ -293,11 +331,11 @@ class transposh_database {
|
|
293 |
|
294 |
exit;
|
295 |
}
|
296 |
-
|
297 |
/**
|
298 |
* Function to return human translations history
|
299 |
* @param string $date - either null for all or a date to get terms after
|
300 |
-
* @return array List of rows
|
301 |
*/
|
302 |
function get_all_human_translation_history($date ="null", $limit = "") {
|
303 |
|
@@ -332,24 +370,44 @@ class transposh_database {
|
|
332 |
$table_name = $GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE;
|
333 |
|
334 |
|
335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
"lang CHAR(5) NOT NULL,".
|
337 |
"translated VARCHAR(255),".
|
338 |
"source TINYINT NOT NULL,".
|
339 |
-
"PRIMARY KEY (original, lang)) DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci"
|
340 |
|
341 |
dbDelta($sql);
|
342 |
|
343 |
$table_name = $GLOBALS['wpdb']->prefix . TRANSLATIONS_LOG;
|
344 |
|
345 |
|
346 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
"lang CHAR(5) NOT NULL,".
|
348 |
"translated VARCHAR(255),".
|
349 |
"translated_by VARCHAR(15),".
|
350 |
"source TINYINT NOT NULL,".
|
351 |
"timestamp TIMESTAMP,".
|
352 |
-
"PRIMARY KEY (original, lang, timestamp)) DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci"
|
353 |
|
354 |
dbDelta($sql);
|
355 |
update_option(TRANSPOSH_DB_VERSION, DB_VERSION);
|
32 |
define("TRANSLATIONS_LOG", "translations_log");
|
33 |
|
34 |
//Database version
|
35 |
+
define("DB_VERSION", "1.04");
|
36 |
|
37 |
//Constant used as key in options database
|
38 |
define("TRANSPOSH_DB_VERSION", "transposh_db_version");
|
40 |
class transposh_database {
|
41 |
/** @property transposh_plugin $transposh father class */
|
42 |
private $transposh;
|
43 |
+
private $translations;
|
44 |
//constructor of class, PHP4 compatible construction for backward compatibility
|
45 |
function transposh_database(&$transposh) {
|
46 |
$this->transposh = &$transposh;
|
47 |
}
|
48 |
+
|
49 |
+
function prefetch_translations($originals, $lang) {
|
50 |
+
if (!$originals) return;
|
51 |
+
foreach ($originals as $original) {
|
52 |
+
$original = $GLOBALS['wpdb']->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
|
53 |
+
if(ENABLE_APC && function_exists('apc_fetch')) {
|
54 |
+
$cached = apc_fetch($original .'___'. $lang, $rc);
|
55 |
+
if($rc === TRUE) {
|
56 |
+
//
|
57 |
+
continue;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
$where .= (($where) ? ' OR ' :'')."original = '$original'";
|
61 |
+
}
|
62 |
+
if (!$where) return;
|
63 |
+
$table_name = $GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE;
|
64 |
+
$query = "SELECT original, translated, source FROM $table_name WHERE ($where) and lang = '$lang' ";
|
65 |
+
$rows = $GLOBALS['wpdb']->get_results($query,ARRAY_A);
|
66 |
+
if(empty($rows)) return;
|
67 |
+
foreach ($rows as $row) {
|
68 |
+
$this->translations[$row['original']] = array(stripslashes($row['translated']), $row['source']);
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
/**
|
73 |
* Fetch translation from db or cache.
|
74 |
* Returns An array that contains the translated string and it source.
|
92 |
}
|
93 |
}
|
94 |
|
95 |
+
if ($this->translations[$original]) {
|
96 |
+
$translated = $this->translations[$original];
|
97 |
+
|
98 |
+
} else {
|
99 |
|
100 |
+
$table_name = $GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE;
|
101 |
+
$query = "SELECT * FROM $table_name WHERE original = '$original' and lang = '$lang' ";
|
102 |
+
$row = $GLOBALS['wpdb']->get_row($query);
|
103 |
|
104 |
+
if($row !== FALSE) {
|
105 |
+
$translated_text = stripslashes($row->translated);
|
106 |
+
$translated = array($translated_text, $row->source);
|
107 |
+
|
108 |
+
|
109 |
+
}
|
110 |
}
|
111 |
|
112 |
if(ENABLE_APC && function_exists('apc_store')) {
|
221 |
}
|
222 |
// Setting the values string for the database (notice how concatanation is handled)
|
223 |
$values .= "('" . $original . "','" . $translation . "','" . $lang . "','" . $source . "')".(($items != $i+1) ?', ':'');
|
224 |
+
$delvalues .= "(original ='$original' AND lang='$lang')".(($items != $i+1) ?' OR ':'');
|
225 |
// Setting the transaction log records
|
226 |
$logvalues .= "('" . $original . "','" . $translation . "','" . $lang . "','".$loguser."','".$source."')".(($items != $i+1) ?', ':'');
|
227 |
|
234 |
// avoid empty work
|
235 |
if (!$values) return;
|
236 |
// perform insertion to the database, with one query :)
|
|
|
|
|
|
|
237 |
|
238 |
+
// since we have no primary key, replace made no sense
|
239 |
+
/*$update = "REPLACE INTO ".$GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE." (original, translated, lang, source)
|
240 |
+
VALUES $values";*/
|
241 |
+
//so we'll delete all values and insert them...
|
242 |
+
$update = "DELETE FROM ".$GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE." WHERE $delvalues";
|
243 |
+
|
244 |
+
$result = $GLOBALS['wpdb']->query($update);
|
245 |
+
$update = "INSERT INTO ".$GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE." (original, translated, lang, source) VALUES $values";
|
246 |
+
|
247 |
$result = $GLOBALS['wpdb']->query($update);
|
248 |
|
249 |
if($result !== FALSE) {
|
331 |
|
332 |
exit;
|
333 |
}
|
334 |
+
|
335 |
/**
|
336 |
* Function to return human translations history
|
337 |
* @param string $date - either null for all or a date to get terms after
|
338 |
+
* @return array List of rows
|
339 |
*/
|
340 |
function get_all_human_translation_history($date ="null", $limit = "") {
|
341 |
|
370 |
$table_name = $GLOBALS['wpdb']->prefix . TRANSLATIONS_TABLE;
|
371 |
|
372 |
|
373 |
+
// notice - keep every field on a new line or dbdelta fails
|
374 |
+
$GLOBALS['wpdb']->query("ALTER TABLE $table_name DROP PRIMARY KEY");
|
375 |
+
$sql = "CREATE TABLE $table_name (
|
376 |
+
original TEXT NOT NULL,
|
377 |
+
lang CHAR(5) NOT NULL,
|
378 |
+
translated TEXT,
|
379 |
+
source TINYINT NOT NULL,
|
380 |
+
KEY original (original(6),lang)
|
381 |
+
) DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";
|
382 |
+
/* $sql = "CREATE TABLE $table_name (original VARCHAR(255) NOT NULL,".
|
383 |
"lang CHAR(5) NOT NULL,".
|
384 |
"translated VARCHAR(255),".
|
385 |
"source TINYINT NOT NULL,".
|
386 |
+
"PRIMARY KEY (original, lang)) DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";*/
|
387 |
|
388 |
dbDelta($sql);
|
389 |
|
390 |
$table_name = $GLOBALS['wpdb']->prefix . TRANSLATIONS_LOG;
|
391 |
|
392 |
|
393 |
+
// notice - keep every field on a new line or dbdelta fails
|
394 |
+
$GLOBALS['wpdb']->query("ALTER TABLE $table_name DROP PRIMARY KEY");
|
395 |
+
$sql = "CREATE TABLE $table_name (
|
396 |
+
original text NOT NULL,
|
397 |
+
lang CHAR(5) NOT NULL,
|
398 |
+
translated text,
|
399 |
+
translated_by VARCHAR(15),
|
400 |
+
source TINYINT NOT NULL,
|
401 |
+
timestamp TIMESTAMP,
|
402 |
+
KEY original (original(6),lang,timestamp)
|
403 |
+
) DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";
|
404 |
+
/* $sql = "CREATE TABLE $table_name (original VARCHAR(255) NOT NULL,".
|
405 |
"lang CHAR(5) NOT NULL,".
|
406 |
"translated VARCHAR(255),".
|
407 |
"translated_by VARCHAR(15),".
|
408 |
"source TINYINT NOT NULL,".
|
409 |
"timestamp TIMESTAMP,".
|
410 |
+
"PRIMARY KEY (original, lang, timestamp)) DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";*/
|
411 |
|
412 |
dbDelta($sql);
|
413 |
update_option(TRANSPOSH_DB_VERSION, DB_VERSION);
|