Weglot Translate – Translate your WP website - Version 1.5

Version Description

  • Add data-value, data-title, title attribute support
  • Add links in readme
Download this release

Release Info

Developer remyb92
Plugin Icon 128x128 Weglot Translate – Translate your WP website
Version 1.5
Comparing to
See all releases

Code changes from version 1.4.6 to 1.5

WeglotPHPClient/src/Client.php CHANGED
@@ -20,6 +20,9 @@ class Client
20
 
21
  $currentNode = $node;
22
 
 
 
 
23
  while($currentNode->parent() && $currentNode->parent()->tag!="html") {
24
 
25
  if(isset($currentNode->parent()->$attribute))
@@ -29,16 +32,74 @@ class Client
29
  }
30
  return false;
31
  }
32
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  public function translateDomFromTo($dom,$l_from,$l_to) {
34
  $html = WeglotSDP\str_get_html($dom, true, true, WG_DEFAULT_TARGET_CHARSET, false, WG_DEFAULT_BR_TEXT, WG_DEFAULT_SPAN_TEXT);
35
- //return $html->save();
36
- /*
37
- $doc = new \DOMDocument();
38
- libxml_use_internal_errors(true);
39
- $doc->loadHTML(mb_convert_encoding($dom, 'HTML-ENTITIES', 'UTF-8'));
40
- $xpath = new \DOMXPath($doc);
41
- */
42
 
43
  $exceptions = explode(",",get_option("exclude_blocks"));
44
  array_push($exceptions,"#wpadminbar");
@@ -55,85 +116,83 @@ class Client
55
  $words = array();
56
  $nodes = array();
57
 
58
- foreach ($html->find('text') as $k => $row)
59
- {
60
- if($this->full_trim($row->outertext)!="" && $row->parent()->tag!="script" && $row->parent()->tag!="style" && !is_numeric($this->full_trim($row->outertext)) && !preg_match('/^\d+%$/',$this->full_trim($row->outertext))
61
- && !$this->hasAncestorAttribute($row,'data-wg-notranslate'))
62
- {
63
- if(strpos($row->outertext,'[vc_') !== false) {
64
-
65
- }
66
- else {
67
- array_push($words,array("t"=>"1","w"=>$row->outertext));
68
- array_push($nodes,array('node'=>$row,'type'=>'text'));
69
- }
70
- }
71
- }
72
-
73
- foreach ($html->find('input[type=\'submit\'],input[type=\'button\']') as $k => $row)
74
- {
75
- if($this->full_trim($row->value)!="" && !is_numeric($this->full_trim($row->value)) && !preg_match('/^\d+%$/',$this->full_trim($row->value))
76
- && !$this->hasAncestorAttribute($row,'data-wg-notranslate'))
77
- {
78
- array_push($words,array("t"=>"2","w"=>html_entity_decode($row->value)));
79
- array_push($nodes,array('node'=>$row,'type'=>'submit'));
80
- }
81
- }
82
- foreach ($html->find('input[type=\'text\'],input[type=\'password\'],input[type=\'search\'],input[type=\'email\'],input:not([type]),textarea') as $k => $row)
83
- {
84
- if($this->full_trim($row->placeholder)!=""
85
- && !is_numeric($this->full_trim($row->placeholder)) && !preg_match('/^\d+%$/',$this->full_trim($row->placeholder))
86
- && !$this->hasAncestorAttribute($row,'data-wg-notranslate'))
87
- {
88
- array_push($words,array("t"=>"3","w"=>html_entity_decode($row->placeholder)));
89
- array_push($nodes,array('node'=>$row,'type'=>'placeholder'));
90
- }
91
- }
92
- foreach ($html->find('meta[name="description"],meta[property="og:title"],meta[property="og:description"],meta[property="og:site_name"],meta[name="twitter:title"],meta[name="twitter:description"]') as $k => $row)
93
- {
94
- if($this->full_trim($row->content)!="" && !is_numeric($this->full_trim($row->content)) && !preg_match('/^\d+%$/',$this->full_trim($row->content))
95
- && !$this->hasAncestorAttribute($row,'data-wg-notranslate'))
96
- {
97
- array_push($words,array("t"=>"4","w"=>$row->content));
98
- array_push($nodes,array('node'=>$row,'type'=>'meta_desc'));
99
- }
100
- }
101
- foreach ($html->find('iframe') as $k => $row)
102
- {
103
- if($this->full_trim($row->src)!="" && strpos($this->full_trim($row->src),'.youtube.') !== false && !$this->hasAncestorAttribute($row,'data-wg-notranslate'))
104
- {
105
- array_push($words,array("t"=>"5","w"=>$row->src));
106
- array_push($nodes,array('node'=>$row,'type'=>'iframe_src'));
107
- }
108
- }
109
- foreach ($html->find('img') as $k => $row)
110
- {
111
- if($this->full_trim($row->src)!="" && !$this->hasAncestorAttribute($row,'data-wg-notranslate'))
112
- {
113
- array_push($words,array("t"=>"6","w"=>$row->src));
114
- array_push($nodes,array('node'=>$row,'type'=>'image_src'));
115
- }
116
- if($this->full_trim($row->alt)!="" && !$this->hasAncestorAttribute($row,'data-wg-notranslate'))
117
- {
118
- array_push($words,array("t"=>"7","w"=>$row->alt));
119
- array_push($nodes,array('node'=>$row,'type'=>'image_alt'));
120
- }
121
- }
122
- foreach ($html->find('a') as $k => $row)
123
- {
124
- if($this->full_trim($row->href)!="" && strtolower(substr($this->full_trim($row->href),-4))==".pdf" && !$this->hasAncestorAttribute($row,'data-wg-notranslate'))
125
- {
126
- array_push($words,array("t"=>"8","w"=>$row->href));
127
- array_push($nodes,array('node'=>$row,'type'=>'a_pdf'));
128
- }
129
- $dv = "data-value";
130
- if($this->full_trim($row->$dv)!="" && !$this->hasAncestorAttribute($row,'data-wg-notranslate'))
131
- {
132
- array_push($words,array("t"=>"2","w"=>$row->$dv));
133
- array_push($nodes,array('node'=>$row,'type'=>'dv'));
134
- }
135
- }
136
-
137
 
138
 
139
  $title = "";
@@ -161,38 +220,18 @@ class Client
161
  $translated_words = $answer['to_words'];
162
  if(count($nodes)==count($translated_words)) {
163
  for($i=0;$i<count($nodes);$i++) {
164
- if($nodes[$i]['type']=='text') {
165
- $nodes[$i]['node']->outertext = $translated_words[$i];
166
- }
167
- if($nodes[$i]['type']=='submit') {
168
- $nodes[$i]['node']->setAttribute('value',$translated_words[$i]);
169
- }
170
- if($nodes[$i]['type']=='placeholder') {
171
- $nodes[$i]['node']->setAttribute('placeholder',$translated_words[$i]);
172
- }
173
- if($nodes[$i]['type']=='meta_desc') {
174
- $nodes[$i]['node']->content = $translated_words[$i];
175
- }
176
- if($nodes[$i]['type']=='iframe_src') {
177
- $nodes[$i]['node']->src = $translated_words[$i];
178
- }
179
- if($nodes[$i]['type']=='image_alt') {
180
- $nodes[$i]['node']->alt = $translated_words[$i];
181
- }
182
- if($nodes[$i]['type']=='image_src') {
183
- $nodes[$i]['node']->src = $translated_words[$i];
184
- if($nodes[$i]['node']->hasAttribute("srcset") && $nodes[$i]['node']->srcset != "" && $translated_words[$i]!=$words[$i]['w']) {
185
- $nodes[$i]['node']->srcset = "";
186
- }
187
- }
188
- if($nodes[$i]['type']=='a_pdf') {
189
- $nodes[$i]['node']->href = $translated_words[$i];
190
- }
191
- if($nodes[$i]['type']=='dv') {
192
- $nodes[$i]['node']->$dv = $translated_words[$i];
193
- }
194
  }
195
- //return $doc->saveHTML();
196
  return $html->save();
197
  }
198
  else
@@ -341,7 +380,7 @@ class Client
341
  return $this->url_origin($s, $use_forwarded_host) . $s['REQUEST_URI'];
342
  }
343
  function full_trim($word) {
344
- return trim($word," \t\n\r\0\x0B\xA0�");
345
  }
346
  }
347
 
20
 
21
  $currentNode = $node;
22
 
23
+ if(isset($currentNode->$attribute))
24
+ return true;
25
+
26
  while($currentNode->parent() && $currentNode->parent()->tag!="html") {
27
 
28
  if(isset($currentNode->parent()->$attribute))
32
  }
33
  return false;
34
  }
35
+
36
+
37
+ public function checkText($row) {
38
+ return ($row->parent()->tag!="script"
39
+ && $row->parent()->tag!="style"
40
+ && !is_numeric($this->full_trim($row->outertext))
41
+ && !preg_match('/^\d+%$/',$this->full_trim($row->outertext)));
42
+ }
43
+
44
+ public function checkButton($row) {
45
+ return (!is_numeric($this->full_trim($row->value))
46
+ && !preg_match('/^\d+%$/',$this->full_trim($row->value)));
47
+ }
48
+
49
+ public function checkInput_dv($row) {
50
+ return true;
51
+ }
52
+
53
+
54
+ public function checkPlaceholder($row) {
55
+ return (!is_numeric($this->full_trim($row->placeholder))
56
+ && !preg_match('/^\d+%$/',$this->full_trim($row->placeholder)) );
57
+ }
58
+
59
+ public function checkMeta_desc($row) {
60
+ return (!is_numeric($this->full_trim($row->placeholder))
61
+ && !preg_match('/^\d+%$/',$this->full_trim($row->placeholder)) );
62
+ }
63
+
64
+ public function checkIframe_src($row) {
65
+ return (strpos($this->full_trim($row->src),'.youtube.') !== false);
66
+ }
67
+
68
+ public function checkImg_src($row) {
69
+ return true;
70
+ }
71
+
72
+ public function checkImg_alt($row) {
73
+ return true;
74
+ }
75
+
76
+ public function checkA_pdf($row) {
77
+ return (strtolower(substr($this->full_trim($row->href),-4))==".pdf");
78
+ }
79
+
80
+ public function checkA_title($row) {
81
+ return true;
82
+ }
83
+
84
+ public function checkA_dv($row) {
85
+ return true;
86
+ }
87
+
88
+ public function checkA_dt($row) {
89
+ return true;
90
+ }
91
+
92
+ function searchForId($id, $array) {
93
+ foreach ($array as $key => $val) {
94
+ if ($val['uid'] === $id) {
95
+ return $key;
96
+ }
97
+ }
98
+ return null;
99
+ }
100
+
101
  public function translateDomFromTo($dom,$l_from,$l_to) {
102
  $html = WeglotSDP\str_get_html($dom, true, true, WG_DEFAULT_TARGET_CHARSET, false, WG_DEFAULT_BR_TEXT, WG_DEFAULT_SPAN_TEXT);
 
 
 
 
 
 
 
103
 
104
  $exceptions = explode(",",get_option("exclude_blocks"));
105
  array_push($exceptions,"#wpadminbar");
116
  $words = array();
117
  $nodes = array();
118
 
119
+
120
+
121
+ $elements_to_check = array(
122
+ "text"
123
+ => array(array("property"=>"outertext",
124
+ "t"=>1,
125
+ "type"=>"text")),
126
+
127
+ "input[type='submit'],input[type='button']"
128
+ => array(array("property"=>"value",
129
+ "t"=>2,
130
+ "type"=>"button"),
131
+ array("property"=>"data-value",
132
+ "t"=>1,
133
+ "type"=>"input_dv")),
134
+
135
+ "input[type=\'text\'],input[type=\'password\'],input[type=\'search\'],input[type=\'email\'],input:not([type]),textarea"
136
+ => array(array("property"=>"placeholder",
137
+ "t"=>3,
138
+ "type"=>"placeholder")),
139
+
140
+ "meta[name=\"description\"],meta[property=\"og:title\"],meta[property=\"og:description\"],meta[property=\"og:site_name\"],meta[name=\"twitter:title\"],meta[name=\"twitter:description\"]"
141
+ => array(array("property"=>"content",
142
+ "t"=>4,
143
+ "type"=>"meta_desc")),
144
+
145
+ "iframe"
146
+ => array(array( "property"=>"src",
147
+ "t"=>5,
148
+ "type"=>"iframe_src")),
149
+
150
+ "img"
151
+ => array(array("property"=>"src",
152
+ "t"=>6,
153
+ "type"=>"img_src"),
154
+ array("property"=>"alt",
155
+ "t"=>7,
156
+ "type"=>"img_alt")),
157
+
158
+
159
+ "a"
160
+ => array(array("property"=>"href",
161
+ "t"=>8,
162
+ "type"=>"a_pdf"),
163
+ array("property"=>"title",
164
+ "t"=>1,
165
+ "type"=>"a_title"),
166
+ array("property"=>"data-value",
167
+ "t"=>1,
168
+ "type"=>"a_dv"),
169
+ array("property"=>"data-title",
170
+ "t"=>1,
171
+ "type"=>"a_dt")),
172
+
173
+
174
+ );
175
+
176
+ foreach($elements_to_check as $key => $elem) {
177
+ foreach ($html->find($key) as $k => $row) {
178
+
179
+ foreach($elem as $element) {
180
+
181
+ $property = $element['property'];
182
+ $t = $element['t'];
183
+ $type = $element['type'];
184
+ $functionName = 'check' . ucfirst($type);
185
+
186
+ if ($this->full_trim($row->$property) != "" && !$this->hasAncestorAttribute($row, 'data-wg-notranslate')
187
+ && $this->$functionName($row)
188
+ ) {
189
+ array_push($words, array("t" => $t, "w" => $row->$property));
190
+ array_push($nodes, array('node' => $row, 'type' => $type, 'property'=>$property));
191
+ }
192
+ }
193
+ }
194
+ }
195
+
 
 
196
 
197
 
198
  $title = "";
220
  $translated_words = $answer['to_words'];
221
  if(count($nodes)==count($translated_words)) {
222
  for($i=0;$i<count($nodes);$i++) {
223
+
224
+ $property = $nodes[$i]['property'];
225
+ $nodes[$i]['node']->$property = $translated_words[$i];
226
+
227
+ if($nodes[$i]['type']=='image_src') {
228
+ $nodes[$i]['node']->src = $translated_words[$i];
229
+ if($nodes[$i]['node']->hasAttribute("srcset") && $nodes[$i]['node']->srcset != "" && $translated_words[$i]!=$words[$i]['w']) {
230
+ $nodes[$i]['node']->srcset = "";
231
+ }
232
+ }
233
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  }
 
235
  return $html->save();
236
  }
237
  else
380
  return $this->url_origin($s, $use_forwarded_host) . $s['REQUEST_URI'];
381
  }
382
  function full_trim($word) {
383
+ return trim($word," \t\n\r\0\x0B\xA0�");
384
  }
385
  }
386
 
includes/wg-settings-page.php CHANGED
@@ -112,7 +112,7 @@ if ( WGUtils::isLanguageRTL( $this->original_l ) ) { // Right lo left language
112
  </td>
113
  </tr>
114
  <tr valign="top">
115
- <th scope="row"><?php _e( 'Destination Languages', 'weglot' ); ?><p style="font-weight:normal;margin-top:2px;"><?php echo sprintf(__( 'Write the two-letter codes, separated by a comma. Supported languages can be found %shere%s.', 'weglot' ), '<a target="_blank" href="https://weglot.com/translation-api#languages_code">', '</a>'); ?></p></th>
116
  <td>
117
  <div style="display:inline-block;width:300px; margin-top: 35px;">
118
  <select id="select-lto" multiple class="demo-default" style="" placeholder="French, German, Italian, Portuguese, …" name="destination_l" >
112
  </td>
113
  </tr>
114
  <tr valign="top">
115
+ <th scope="row"><?php _e( 'Destination Languages', 'weglot' ); ?><p style="font-weight:normal;margin-top:2px;"><?php echo sprintf(__( 'Choose languages you want to translate into. Supported languages can be found %shere%s.', 'weglot' ), '<a target="_blank" href="https://weglot.com/translation-api#languages_code">', '</a>'); ?></p></th>
116
  <td>
117
  <div style="display:inline-block;width:300px; margin-top: 35px;">
118
  <select id="select-lto" multiple class="demo-default" style="" placeholder="French, German, Italian, Portuguese, …" name="destination_l" >
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: remyb92
3
  Tags: translate,translation,language,multilingual,bilingual,international,localization,multilanguage,multi language,translations,translator,multilangues,traduction,traducteur,ubersetzung,mehrsprachig,traduccion,traduzione,vertaling,vertaler,meertalig
4
  Requires at least: 4.0
5
- Tested up to: 4.7.3
6
- Stable tag: 1.4.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -38,12 +38,12 @@ Weglot Translate benefits:
38
  Is Weglot Translate free?
39
 
40
  Weglot Translate is free for small websites (under 2000 words) with one translation language.
41
- Weglot Translate has Free and Premium plans available at https://weglot.com/pricingwp, depending on your needs. You can always take the Weglot Translate free trial version to test it.
42
  Weglot Translate offers professional support to premium users to help them translate their websites.
43
 
44
  Does Weglot Translate provide support?
45
 
46
- Yes, the Weglot Translate team will support everyone. Post a topic on https://wordpress.org/support/plugin/weglot or email us at support@weglot.com or speak with us on our live chat on the Weglot website.
47
 
48
  Weglot Translate plugin is translated in Dutch, English_UK, French, German, Italian, Portuguese_BR, Russian and Spanish. More translations will be added.
49
 
@@ -59,7 +59,7 @@ Weglot Translate, go multilingual now.
59
  = Installation steps for Weglot Translate =
60
  Weglot Translate is easy to set up:
61
 
62
- 1. Go to https://weglot.com/register-wordpress to set up an account.
63
  2. Grab your api_key from your dashboard, it looks like "wg_XXXXXXX"
64
  3. Find the Weglot Translate settings page on the bottom left of your WordPress admin dashboard.
65
  4. Add and save your api key to Weglot Translate settings, enter your website's original language and enter the translation languages you want, separated by commas (for instance en,de,pt to have translations in English, German and Portuguese).
@@ -67,16 +67,16 @@ Weglot Translate is easy to set up:
67
  6. Click on the Save button.
68
  7. (Optional) Go to Appearance -&gt; Widgets and drag and drop the "Weglot Translate" widget where you want it to appear.
69
  8. Refresh your web page, your website is now available in the selected translation languages. You can switch languages to see translated pages.
70
- 9. If you want, you can edit your translations directly in your account: https://weglot.com/dashboard
71
 
72
 
73
  == Frequently Asked Questions ==
74
  = Is Weglot Translate free? =
75
- Weglot Translate is a freemium plugin: it is free for small websites (under 2000 words) with one translation language. If you need more, you can upgrade. Details of our pricing can be found here: https://weglot.com/pricingwp
76
 
77
  In any case, you can try Weglot free for 10 days.
78
  = Edit my translations =
79
- With Weglot Translate, you can modify translations in "Translations" in your Weglot account here: https://weglot.com/dashboard. If you change a translation, it's automatically saved and displayed on your website.
80
  = The translations I edited are not displayed on my website. =
81
 
82
  All translations edited in your dashboard are automatically displayed in real-time in the translated versions of your website. If you can not see your new translations:
@@ -115,12 +115,12 @@ You can create your own translation rules in your Weglot dashboard by clicking o
115
  2. Use the "Search and Replace" tool to easily search for a word in all your translations and replace it with the one you want.
116
 
117
  = Support =
118
- If you have any questions about Weglot Translate, please post a topic on https://wordpress.org/support/plugin/weglot or contact us at support@weglot.com or directly using our live chat on https://weglot.com.
119
 
120
  == Instructions ==
121
  Weglot Translate is easy to set up:
122
 
123
- 1. Go to https://weglot.com/register-wordpress to set up an account
124
  2. Grab your api_key from your dashboard, it looks like "wg_XXXXXXX"
125
  3. Find the Weglot Translate settings page on the bottom left of your WordPress admin dashboard.
126
  4. Add and save your api key to Weglot Translate settings, enter your website's original language and enter the translation languages you want, separated by commas (for instance en,de,pt to have translations in English, German and Portuguese).
@@ -128,7 +128,7 @@ Weglot Translate is easy to set up:
128
  6. Click on the Save button.
129
  7. (Optional) Go to Appearance -> Widgets and drag and drop the "Weglot Translate" widget where you want it to appear.
130
  8. Refresh your web page, your website is now available in the selected translation languages. You can switch languages to see translated pages.
131
- 9. If you want, you can edit your translations directly in your account: https://weglot.com/dashboard
132
 
133
  == Screenshots ==
134
 
@@ -143,6 +143,10 @@ See changelog for upgrade changes.
143
 
144
  == Changelog ==
145
 
 
 
 
 
146
  = 1.4.6 =
147
  * Add pretty selection of languages
148
  * Improve flags quality
2
  Contributors: remyb92
3
  Tags: translate,translation,language,multilingual,bilingual,international,localization,multilanguage,multi language,translations,translator,multilangues,traduction,traducteur,ubersetzung,mehrsprachig,traduccion,traduzione,vertaling,vertaler,meertalig
4
  Requires at least: 4.0
5
+ Tested up to: 4.8
6
+ Stable tag: 1.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
38
  Is Weglot Translate free?
39
 
40
  Weglot Translate is free for small websites (under 2000 words) with one translation language.
41
+ Weglot Translate has Free and Premium plans available on the [pricing page](https://weglot.com/pricing), depending on your needs. You can always take the Weglot Translate free trial version to test it.
42
  Weglot Translate offers professional support to premium users to help them translate their websites.
43
 
44
  Does Weglot Translate provide support?
45
 
46
+ Yes, the Weglot Translate team will support everyone. Post a topic on the [support forum](https://wordpress.org/support/plugin/weglot) or email us at support@weglot.com or speak with us on our live chat on the Weglot website.
47
 
48
  Weglot Translate plugin is translated in Dutch, English_UK, French, German, Italian, Portuguese_BR, Russian and Spanish. More translations will be added.
49
 
59
  = Installation steps for Weglot Translate =
60
  Weglot Translate is easy to set up:
61
 
62
+ 1. Go to [https://weglot.com/register-wordpress](https://weglot.com/register-wordpress) to set up an account.
63
  2. Grab your api_key from your dashboard, it looks like "wg_XXXXXXX"
64
  3. Find the Weglot Translate settings page on the bottom left of your WordPress admin dashboard.
65
  4. Add and save your api key to Weglot Translate settings, enter your website's original language and enter the translation languages you want, separated by commas (for instance en,de,pt to have translations in English, German and Portuguese).
67
  6. Click on the Save button.
68
  7. (Optional) Go to Appearance -&gt; Widgets and drag and drop the "Weglot Translate" widget where you want it to appear.
69
  8. Refresh your web page, your website is now available in the selected translation languages. You can switch languages to see translated pages.
70
+ 9. If you want, you can edit your translations directly in [your account](https://weglot.com/dashboard)
71
 
72
 
73
  == Frequently Asked Questions ==
74
  = Is Weglot Translate free? =
75
+ Weglot Translate is a freemium plugin: it is free for small websites (under 2000 words) with one translation language. If you need more, you can upgrade. Details of our pricing can be found [here]: (https://weglot.com/pricing)
76
 
77
  In any case, you can try Weglot free for 10 days.
78
  = Edit my translations =
79
+ With Weglot Translate, you can modify translations in "Translations" in your Weglot [account here](https://weglot.com/dashboard). If you change a translation, it's automatically saved and displayed on your website.
80
  = The translations I edited are not displayed on my website. =
81
 
82
  All translations edited in your dashboard are automatically displayed in real-time in the translated versions of your website. If you can not see your new translations:
115
  2. Use the "Search and Replace" tool to easily search for a word in all your translations and replace it with the one you want.
116
 
117
  = Support =
118
+ If you have any questions about Weglot Translate, please post a topic on the [support forum](https://wordpress.org/support/plugin/weglot) or contact us at support@weglot.com or directly using our live chat on [https://weglot.com] (https://weglot.com).
119
 
120
  == Instructions ==
121
  Weglot Translate is easy to set up:
122
 
123
+ 1. Go to [https://weglot.com/register-wordpress](https://weglot.com/register-wordpress) to set up an account
124
  2. Grab your api_key from your dashboard, it looks like "wg_XXXXXXX"
125
  3. Find the Weglot Translate settings page on the bottom left of your WordPress admin dashboard.
126
  4. Add and save your api key to Weglot Translate settings, enter your website's original language and enter the translation languages you want, separated by commas (for instance en,de,pt to have translations in English, German and Portuguese).
128
  6. Click on the Save button.
129
  7. (Optional) Go to Appearance -> Widgets and drag and drop the "Weglot Translate" widget where you want it to appear.
130
  8. Refresh your web page, your website is now available in the selected translation languages. You can switch languages to see translated pages.
131
+ 9. If you want, you can edit your translations directly in [your account](https://weglot.com/dashboard)
132
 
133
  == Screenshots ==
134
 
143
 
144
  == Changelog ==
145
 
146
+ = 1.5 =
147
+ * Add data-value, data-title, title attribute support
148
+ * Add links in readme
149
+
150
  = 1.4.6 =
151
  * Add pretty selection of languages
152
  * Improve flags quality
weglot.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * @package Weglot
4
- * @version 1.4.6
5
  */
6
 
7
  /*
@@ -12,7 +12,7 @@ Author: Remy B
12
  Author URI: https://weglot.com/
13
  Text Domain: weglot
14
  Domain Path: /languages/
15
- Version: 1.4.6
16
  */
17
 
18
  /* Copyright 2015 Remy Berda (email : remy@weglot.com)
@@ -36,11 +36,7 @@ Version: 1.4.6
36
  */
37
  if ( ! defined( 'ABSPATH' ) ) exit;
38
 
39
- //define( 'WP_DEBUG', true );
40
- //define( 'WP_DEBUG_LOG', true );
41
-
42
-
43
- define('WEGLOT_VERSION', '1.4.6');
44
  define('WEGLOT_DIR', dirname(__FILE__));
45
  define('WEGLOT_BNAME', plugin_basename(__FILE__));
46
  define('WEGLOT_DIRURL', plugin_dir_url( __FILE__ ));
@@ -90,7 +86,6 @@ class Weglot {
90
  add_action('init', array(&$this, 'init_function'),11);
91
  add_action('wp_head',array(&$this, 'add_alternate'));
92
  add_action('wp', array(&$this, 'rr_404_my_event') );
93
- add_shortcode('weglot_switcher', array(&$this, 'wg_switcher_creation'));
94
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array(&$this,'wg_plugin_action_links') );
95
 
96
  $this->original_l = get_option("original_l");
@@ -149,7 +144,7 @@ class Weglot {
149
  $isURLOK = $this->isEligibleURL($urlRacine);
150
  if($isURLOK) {
151
  add_action('widgets_init', array(&$this, 'addWidget'));
152
-
153
  if(get_option("is_menu")=='on') {
154
  add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
155
  function your_custom_menu_item ( $items, $args ) {
@@ -516,7 +511,7 @@ class Weglot {
516
  return $final."<!--Not allowed-->";
517
  }
518
  $translatedPage = $this->translator->translateDomFromTo($final,$this->original_l,$l); //$page is your html page
519
- // to do : condenser, replacer les endwidths par contient 'upload' ?
520
 
521
  $admin_url = admin_url();
522
 
1
  <?php
2
  /**
3
  * @package Weglot
4
+ * @version 1.5
5
  */
6
 
7
  /*
12
  Author URI: https://weglot.com/
13
  Text Domain: weglot
14
  Domain Path: /languages/
15
+ Version: 1.5
16
  */
17
 
18
  /* Copyright 2015 Remy Berda (email : remy@weglot.com)
36
  */
37
  if ( ! defined( 'ABSPATH' ) ) exit;
38
 
39
+ define('WEGLOT_VERSION', '1.5');
 
 
 
 
40
  define('WEGLOT_DIR', dirname(__FILE__));
41
  define('WEGLOT_BNAME', plugin_basename(__FILE__));
42
  define('WEGLOT_DIRURL', plugin_dir_url( __FILE__ ));
86
  add_action('init', array(&$this, 'init_function'),11);
87
  add_action('wp_head',array(&$this, 'add_alternate'));
88
  add_action('wp', array(&$this, 'rr_404_my_event') );
 
89
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array(&$this,'wg_plugin_action_links') );
90
 
91
  $this->original_l = get_option("original_l");
144
  $isURLOK = $this->isEligibleURL($urlRacine);
145
  if($isURLOK) {
146
  add_action('widgets_init', array(&$this, 'addWidget'));
147
+ add_shortcode('weglot_switcher', array(&$this, 'wg_switcher_creation'));
148
  if(get_option("is_menu")=='on') {
149
  add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
150
  function your_custom_menu_item ( $items, $args ) {
511
  return $final."<!--Not allowed-->";
512
  }
513
  $translatedPage = $this->translator->translateDomFromTo($final,$this->original_l,$l); //$page is your html page
514
+ // to do : condenser, replacer les endwidths par contient 'upload' ?
515
 
516
  $admin_url = admin_url();
517