Version Description
- Improved automatic translation usage by skipping detection of icalendar strings
- Unsupported languages are now checked automatically when saving Automatic Translation tab settings
- Added new filters that allow changing the custom tables names from external scripts
Download this release
Release Info
Developer | razvan.mo |
Plugin | TranslatePress – Translate Multilingual sites |
Version | 2.2.6 |
Comparing to | |
See all releases |
Code changes from version 2.2.5 to 2.2.6
- class-translate-press.php +1 -1
- includes/class-machine-translation-tab.php +8 -3
- includes/class-query.php +4 -5
- includes/class-translation-render.php +2 -0
- index.php +1 -1
- languages/translatepress-multilingual.pot +7 -7
- readme.txt +6 -1
class-translate-press.php
CHANGED
@@ -60,7 +60,7 @@ class TRP_Translate_Press{
|
|
60 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
61 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
62 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
63 |
-
define( 'TRP_PLUGIN_VERSION', '2.2.
|
64 |
|
65 |
wp_cache_add_non_persistent_groups(array('trp'));
|
66 |
|
60 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
61 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
62 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
63 |
+
define( 'TRP_PLUGIN_VERSION', '2.2.6' );
|
64 |
|
65 |
wp_cache_add_non_persistent_groups(array('trp'));
|
66 |
|
includes/class-machine-translation-tab.php
CHANGED
@@ -64,6 +64,8 @@ class TRP_Machine_Translation_Tab {
|
|
64 |
|
65 |
$free_version = ( ( !class_exists( 'TRP_Handle_Included_Addons' ) ) || ( ( defined( 'TRANSLATE_PRESS' ) && ( TRANSLATE_PRESS !== 'TranslatePress - Developer' && TRANSLATE_PRESS !== 'TranslatePress - Business' && TRANSLATE_PRESS !== 'TranslatePress - Dev' && TRANSLATE_PRESS !== 'TranslatePress - Personal' ) ) ) );
|
66 |
$seo_pack_active = class_exists( 'TRP_IN_Seo_Pack');
|
|
|
|
|
67 |
$settings = array();
|
68 |
$machine_translation_keys = array( 'machine-translation', 'translation-engine', 'google-translate-key', 'deepl-api-type', 'deepl-api-key', 'block-crawlers', 'automatically-translate-slug', 'machine_translation_limit', 'machine_translation_log' );
|
69 |
foreach( $machine_translation_keys as $key ){
|
@@ -71,9 +73,12 @@ class TRP_Machine_Translation_Tab {
|
|
71 |
$settings[$key] = $mt_settings[$key];
|
72 |
}
|
73 |
}
|
74 |
-
if( !empty( $settings['machine-translation'] ) )
|
75 |
-
$settings['machine-translation'] = sanitize_text_field( $settings['machine-translation']
|
76 |
-
|
|
|
|
|
|
|
77 |
$settings['machine-translation'] = 'no';
|
78 |
|
79 |
if( !empty( $settings['translation-engine'] ) )
|
64 |
|
65 |
$free_version = ( ( !class_exists( 'TRP_Handle_Included_Addons' ) ) || ( ( defined( 'TRANSLATE_PRESS' ) && ( TRANSLATE_PRESS !== 'TranslatePress - Developer' && TRANSLATE_PRESS !== 'TranslatePress - Business' && TRANSLATE_PRESS !== 'TranslatePress - Dev' && TRANSLATE_PRESS !== 'TranslatePress - Personal' ) ) ) );
|
66 |
$seo_pack_active = class_exists( 'TRP_IN_Seo_Pack');
|
67 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
68 |
+
$machine_translator = $trp->get_component( 'machine_translator' );
|
69 |
$settings = array();
|
70 |
$machine_translation_keys = array( 'machine-translation', 'translation-engine', 'google-translate-key', 'deepl-api-type', 'deepl-api-key', 'block-crawlers', 'automatically-translate-slug', 'machine_translation_limit', 'machine_translation_log' );
|
71 |
foreach( $machine_translation_keys as $key ){
|
73 |
$settings[$key] = $mt_settings[$key];
|
74 |
}
|
75 |
}
|
76 |
+
if( !empty( $settings['machine-translation'] ) ) {
|
77 |
+
$settings['machine-translation'] = sanitize_text_field( $settings['machine-translation'] );
|
78 |
+
if ( $settings['machine-translation'] === 'yes') {
|
79 |
+
$machine_translator->check_languages_availability( $this->settings['translation-languages'], true );
|
80 |
+
}
|
81 |
+
}else
|
82 |
$settings['machine-translation'] = 'no';
|
83 |
|
84 |
if( !empty( $settings['translation-engine'] ) )
|
includes/class-query.php
CHANGED
@@ -935,7 +935,7 @@ class TRP_Query{
|
|
935 |
if ( $default_language == null ) {
|
936 |
$default_language = $this->settings['default-language'];
|
937 |
}
|
938 |
-
return $this->db->prefix . 'trp_dictionary_' . strtolower( $default_language ) . '_'. strtolower( $language_code );
|
939 |
}
|
940 |
|
941 |
public function get_language_code_from_table_name( $table_name, $default_language = null ){
|
@@ -952,7 +952,7 @@ class TRP_Query{
|
|
952 |
* @return string Table name.
|
953 |
*/
|
954 |
public function get_table_name_for_original_strings(){
|
955 |
-
return sanitize_text_field( $this->db->prefix . 'trp_original_strings' );
|
956 |
}
|
957 |
|
958 |
/**
|
@@ -961,7 +961,7 @@ class TRP_Query{
|
|
961 |
* @return string Table name.
|
962 |
*/
|
963 |
public function get_table_name_for_original_meta(){
|
964 |
-
return sanitize_text_field( $this->db->prefix . 'trp_original_meta' );
|
965 |
}
|
966 |
/**
|
967 |
* Return meta_key for post parent id from meta table
|
@@ -989,8 +989,7 @@ class TRP_Query{
|
|
989 |
}
|
990 |
|
991 |
public function get_gettext_table_name( $language_code ){
|
992 |
-
|
993 |
-
return $wpdb->get_blog_prefix() . 'trp_gettext_' . strtolower( $language_code );
|
994 |
}
|
995 |
|
996 |
/**
|
935 |
if ( $default_language == null ) {
|
936 |
$default_language = $this->settings['default-language'];
|
937 |
}
|
938 |
+
return apply_filters( 'trp_table_name_dictionary', $this->db->prefix . 'trp_dictionary_' . strtolower( $default_language ) . '_'. strtolower( $language_code ), $this->db->prefix, $language_code, $default_language );
|
939 |
}
|
940 |
|
941 |
public function get_language_code_from_table_name( $table_name, $default_language = null ){
|
952 |
* @return string Table name.
|
953 |
*/
|
954 |
public function get_table_name_for_original_strings(){
|
955 |
+
return apply_filters( 'trp_table_name_original_strings', sanitize_text_field( $this->db->prefix . 'trp_original_strings' ), $this->db->prefix );
|
956 |
}
|
957 |
|
958 |
/**
|
961 |
* @return string Table name.
|
962 |
*/
|
963 |
public function get_table_name_for_original_meta(){
|
964 |
+
return apply_filters( 'trp_table_name_original_meta', sanitize_text_field( $this->db->prefix . 'trp_original_meta' ), $this->db->prefix );
|
965 |
}
|
966 |
/**
|
967 |
* Return meta_key for post parent id from meta table
|
989 |
}
|
990 |
|
991 |
public function get_gettext_table_name( $language_code ){
|
992 |
+
return apply_filters( 'trp_table_name_gettext', $this->db->prefix . 'trp_gettext_' . strtolower( $language_code ), $this->db->prefix, $language_code );
|
|
|
993 |
}
|
994 |
|
995 |
/**
|
includes/class-translation-render.php
CHANGED
@@ -718,6 +718,7 @@ class TRP_Translation_Render{
|
|
718 |
&& !$this->has_ancestor_attribute( $row, $no_translate_attribute )
|
719 |
&& !$this->has_ancestor_class( $row, 'translation-block')
|
720 |
&& ( !$ignore_cdata || ( strpos($trimmed_string, '<![CDATA[') !== 0 && strpos($trimmed_string, '<![CDATA[') !== 0 ) )
|
|
|
721 |
&& !$this->contains_substrings($trimmed_string, $skip_strings_containing_key_terms ) )
|
722 |
{
|
723 |
if ( !$translate_encoded_html_as_string ){
|
@@ -786,6 +787,7 @@ class TRP_Translation_Render{
|
|
786 |
&& !$this->has_ancestor_class( $row, 'translation-block')
|
787 |
&& $row->tag != 'link'
|
788 |
&& ( !$ignore_cdata || ( strpos($trimmed_string, '<![CDATA[') !== 0 && strpos($trimmed_string, '<![CDATA[') !== 0 ) )
|
|
|
789 |
&& !$this->contains_substrings($trimmed_string, $skip_strings_containing_key_terms ) )
|
790 |
{
|
791 |
$entity_decoded_trimmed_string = html_entity_decode( $trimmed_string );
|
718 |
&& !$this->has_ancestor_attribute( $row, $no_translate_attribute )
|
719 |
&& !$this->has_ancestor_class( $row, 'translation-block')
|
720 |
&& ( !$ignore_cdata || ( strpos($trimmed_string, '<![CDATA[') !== 0 && strpos($trimmed_string, '<![CDATA[') !== 0 ) )
|
721 |
+
&& (strpos($trimmed_string, 'BEGIN:VCALENDAR') !== 0)
|
722 |
&& !$this->contains_substrings($trimmed_string, $skip_strings_containing_key_terms ) )
|
723 |
{
|
724 |
if ( !$translate_encoded_html_as_string ){
|
787 |
&& !$this->has_ancestor_class( $row, 'translation-block')
|
788 |
&& $row->tag != 'link'
|
789 |
&& ( !$ignore_cdata || ( strpos($trimmed_string, '<![CDATA[') !== 0 && strpos($trimmed_string, '<![CDATA[') !== 0 ) )
|
790 |
+
&& (strpos($trimmed_string, 'BEGIN:VCALENDAR') !== 0 )
|
791 |
&& !$this->contains_substrings($trimmed_string, $skip_strings_containing_key_terms ) )
|
792 |
{
|
793 |
$entity_decoded_trimmed_string = html_entity_decode( $trimmed_string );
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: TranslatePress - Multilingual
|
4 |
Plugin URI: https://translatepress.com/
|
5 |
Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
|
6 |
-
Version: 2.2.
|
7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
8 |
Author URI: https://cozmoslabs.com/
|
9 |
Text Domain: translatepress-multilingual
|
3 |
Plugin Name: TranslatePress - Multilingual
|
4 |
Plugin URI: https://translatepress.com/
|
5 |
Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
|
6 |
+
Version: 2.2.6
|
7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
8 |
Author URI: https://cozmoslabs.com/
|
9 |
Text Domain: translatepress-multilingual
|
languages/translatepress-multilingual.pot
CHANGED
@@ -269,31 +269,31 @@ msgstr ""
|
|
269 |
msgid "Automatic Translation"
|
270 |
msgstr ""
|
271 |
|
272 |
-
#: includes/class-machine-translation-tab.php:
|
273 |
msgid "DeepL"
|
274 |
msgstr ""
|
275 |
|
276 |
-
#: includes/class-machine-translation-tab.php:
|
277 |
msgid "Unsupported languages"
|
278 |
msgstr ""
|
279 |
|
280 |
-
#: includes/class-machine-translation-tab.php:
|
281 |
msgid "The selected automatic translation engine does not provide support for these languages.<br>You can still manually translate pages in these languages using the Translation Editor."
|
282 |
msgstr ""
|
283 |
|
284 |
-
#: includes/class-machine-translation-tab.php:
|
285 |
msgid "Languages without formality"
|
286 |
msgstr ""
|
287 |
|
288 |
-
#: includes/class-machine-translation-tab.php:
|
289 |
msgid "The selected automatic translation engine provides only <a href=\"%s\" target=\"_blank\">default formality</a> settings for these languages for now.<br>Automatic translation will still work if available for these languages. It will just not use the formality setting from TranslatePress <a href=\"%s\" target=\"_self\"> General Tab</a> for the languages listed above."
|
290 |
msgstr ""
|
291 |
|
292 |
-
#: includes/class-machine-translation-tab.php:
|
293 |
msgid "Recheck supported languages"
|
294 |
msgstr ""
|
295 |
|
296 |
-
#: includes/class-machine-translation-tab.php:
|
297 |
msgid "(last checked on %s)"
|
298 |
msgstr ""
|
299 |
|
269 |
msgid "Automatic Translation"
|
270 |
msgstr ""
|
271 |
|
272 |
+
#: includes/class-machine-translation-tab.php:169, add-ons-pro/deepl/includes/class-deepl.php:27
|
273 |
msgid "DeepL"
|
274 |
msgstr ""
|
275 |
|
276 |
+
#: includes/class-machine-translation-tab.php:201
|
277 |
msgid "Unsupported languages"
|
278 |
msgstr ""
|
279 |
|
280 |
+
#: includes/class-machine-translation-tab.php:213
|
281 |
msgid "The selected automatic translation engine does not provide support for these languages.<br>You can still manually translate pages in these languages using the Translation Editor."
|
282 |
msgstr ""
|
283 |
|
284 |
+
#: includes/class-machine-translation-tab.php:240
|
285 |
msgid "Languages without formality"
|
286 |
msgstr ""
|
287 |
|
288 |
+
#: includes/class-machine-translation-tab.php:252
|
289 |
msgid "The selected automatic translation engine provides only <a href=\"%s\" target=\"_blank\">default formality</a> settings for these languages for now.<br>Automatic translation will still work if available for these languages. It will just not use the formality setting from TranslatePress <a href=\"%s\" target=\"_self\"> General Tab</a> for the languages listed above."
|
290 |
msgstr ""
|
291 |
|
292 |
+
#: includes/class-machine-translation-tab.php:265
|
293 |
msgid "Recheck supported languages"
|
294 |
msgstr ""
|
295 |
|
296 |
+
#: includes/class-machine-translation-tab.php:266
|
297 |
msgid "(last checked on %s)"
|
298 |
msgstr ""
|
299 |
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: translate, translation, multilingual, automatic translation, bilingual, fr
|
|
5 |
Requires at least: 3.1.0
|
6 |
Tested up to: 5.9.3
|
7 |
Requires PHP: 5.6.20
|
8 |
-
Stable tag: 2.2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -140,6 +140,11 @@ For more information please check out our [documentation](https://translatepress
|
|
140 |
|
141 |
|
142 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
143 |
= 2.2.5 =
|
144 |
* Fixed span tag appearing in WooCommerce Orders in WP Dashboard
|
145 |
* Fixed warnings from The Event Calendar about SQL commands
|
5 |
Requires at least: 3.1.0
|
6 |
Tested up to: 5.9.3
|
7 |
Requires PHP: 5.6.20
|
8 |
+
Stable tag: 2.2.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
140 |
|
141 |
|
142 |
== Changelog ==
|
143 |
+
= 2.2.6 =
|
144 |
+
* Improved automatic translation usage by skipping detection of icalendar strings
|
145 |
+
* Unsupported languages are now checked automatically when saving Automatic Translation tab settings
|
146 |
+
* Added new filters that allow changing the custom tables names from external scripts
|
147 |
+
|
148 |
= 2.2.5 =
|
149 |
* Fixed span tag appearing in WooCommerce Orders in WP Dashboard
|
150 |
* Fixed warnings from The Event Calendar about SQL commands
|