Version Description
- Fixed blank page when opening Translation Editor in some localized languages
- Added -Advanced- tab with various custom settings
- Added compatibility to allow translating SeedProd plugin Coming Soon page
Download this release
Release Info
Developer | madalin.ungureanu |
Plugin | TranslatePress – Translate Multilingual sites |
Version | 1.5.2 |
Comparing to | |
See all releases |
Code changes from version 1.5.1 to 1.5.2
- assets/css/trp-back-end-style.css +23 -0
- assets/js/trp-back-end-script.js +61 -0
- class-translate-press.php +12 -1
- includes/advanced-settings/disable-dynamic-translation.php +21 -0
- includes/advanced-settings/enable-auto-translate-slug.php +22 -0
- includes/advanced-settings/exclude-gettext-strings.php +33 -0
- includes/advanced-settings/fix-broken-html.php +22 -0
- includes/advanced-settings/fix-invalid-space-between-html-attr.php +56 -0
- includes/advanced-settings/show-dynamic-content-before-translation.php +25 -0
- includes/advanced-settings/skip-dynamic-selectors.php +26 -0
- includes/advanced-settings/strip-gettext-post-content.php +26 -0
- includes/advanced-settings/strip-gettext-post-meta.php +47 -0
- includes/class-advanced-tab.php +227 -0
- includes/class-plugin-notices.php +1 -1
- includes/class-settings.php +11 -10
- includes/class-translation-render.php +37 -31
- includes/functions.php +45 -0
- index.php +1 -1
- languages/translatepress-multilingual.catalog.php +26 -1
- languages/translatepress-multilingual.pot +110 -10
- partials/addons-settings-page.php +1 -2
- partials/advanced-settings-page.php +13 -0
- readme.txt +6 -40
assets/css/trp-back-end-style.css
CHANGED
@@ -152,4 +152,27 @@ input.trp-translation-published{
|
|
152 |
.trp-invalid-license{
|
153 |
line-height: 29px;
|
154 |
color:#ca4a1f;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
}
|
152 |
.trp-invalid-license{
|
153 |
line-height: 29px;
|
154 |
color:#ca4a1f;
|
155 |
+
}
|
156 |
+
|
157 |
+
/* Advanced Settings Page */
|
158 |
+
|
159 |
+
table.trp-adst-list-option{
|
160 |
+
width: 1px;
|
161 |
+
margin-left: -30px
|
162 |
+
}
|
163 |
+
table.trp-adst-list-option td{
|
164 |
+
padding: 5px;
|
165 |
+
}
|
166 |
+
table.trp-adst-list-option th{
|
167 |
+
text-align: center;
|
168 |
+
}
|
169 |
+
.trp-adst-list-option textarea{
|
170 |
+
width: 250px;
|
171 |
+
}
|
172 |
+
.trp-adst-remove-element{
|
173 |
+
color: #a00;
|
174 |
+
cursor: pointer;
|
175 |
+
}
|
176 |
+
.trp-adst-remove-element:hover{
|
177 |
+
color: red;
|
178 |
}
|
assets/js/trp-back-end-script.js
CHANGED
@@ -185,6 +185,60 @@ jQuery( function() {
|
|
185 |
};
|
186 |
};
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
var trpSettingsLanguages = new TRP_Settings_Language_Selector();
|
189 |
|
190 |
jQuery('#trp-default-language').on("select2:selecting", function(e) {
|
@@ -194,5 +248,12 @@ jQuery( function() {
|
|
194 |
var trpGoogleTranslate = TRP_Field_Toggler();
|
195 |
trpGoogleTranslate.init('#trp-g-translate', '#trp-g-translate-key', 'yes' );
|
196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
});
|
198 |
|
185 |
};
|
186 |
};
|
187 |
|
188 |
+
/*
|
189 |
+
* Manage adding and removing items from an option of tpe list from Advanced Settings page
|
190 |
+
*/
|
191 |
+
function TRP_Advanced_Settings_List( table ){
|
192 |
+
|
193 |
+
var _this = this
|
194 |
+
|
195 |
+
this.addEventHandlers = function( table ){
|
196 |
+
var add_list_entry = table.querySelector( '.trp-add-list-entry' );
|
197 |
+
|
198 |
+
// add event listener on ADD button
|
199 |
+
add_list_entry.querySelector('.trp-adst-button-add-new-item').addEventListener("click", function(){
|
200 |
+
|
201 |
+
var clone = add_list_entry.cloneNode(true)
|
202 |
+
|
203 |
+
// Show Add button, hide Remove button
|
204 |
+
clone.querySelector( '.trp-adst-button-add-new-item' ).style.display = 'none'
|
205 |
+
clone.querySelector( '.trp-adst-remove-element' ).style.display = 'block'
|
206 |
+
|
207 |
+
// Add row with new item in the html table
|
208 |
+
var itemInserted = add_list_entry.parentElement.insertBefore( clone, add_list_entry );
|
209 |
+
|
210 |
+
// Set name attributes
|
211 |
+
var dataNames = clone.querySelectorAll( '[data-name]' )
|
212 |
+
for( var i = 0 ; i < dataNames.length ; i++ ) {
|
213 |
+
dataNames[i].setAttribute( 'name', dataNames[i].getAttribute('data-name') );
|
214 |
+
}
|
215 |
+
|
216 |
+
// Reset values of textareas with new items
|
217 |
+
var dataValues = add_list_entry.querySelectorAll( '[data-name]' )
|
218 |
+
for( var i = 0 ; i < dataValues.length ; i++ ) {
|
219 |
+
dataValues[i].value = ''
|
220 |
+
}
|
221 |
+
|
222 |
+
// Add click listener on new row's Remove button
|
223 |
+
var removeButton = itemInserted.querySelector('.trp-adst-remove-element');
|
224 |
+
removeButton.addEventListener("click", _this.remove_item );
|
225 |
+
});
|
226 |
+
|
227 |
+
var removeButtons = table.querySelectorAll( '.trp-adst-remove-element' );
|
228 |
+
for( var i = 0 ; i < removeButtons.length ; i++ ) {
|
229 |
+
removeButtons[i].addEventListener("click", _this.remove_item)
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
this.remove_item = function( event ){
|
234 |
+
if ( confirm( event.target.getAttribute( 'data-confirm-message' ) ) ){
|
235 |
+
jQuery( event.target ).closest( '.trp-list-entry' ).remove()
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
_this.addEventHandlers( table )
|
240 |
+
}
|
241 |
+
|
242 |
var trpSettingsLanguages = new TRP_Settings_Language_Selector();
|
243 |
|
244 |
jQuery('#trp-default-language').on("select2:selecting", function(e) {
|
248 |
var trpGoogleTranslate = TRP_Field_Toggler();
|
249 |
trpGoogleTranslate.init('#trp-g-translate', '#trp-g-translate-key', 'yes' );
|
250 |
|
251 |
+
// Options of type List adding, from Advanced Settings page
|
252 |
+
var trpListOptions = document.querySelectorAll( '.trp-adst-list-option' );
|
253 |
+
for ( var i = 0 ; i < trpListOptions.length ; i++ ){
|
254 |
+
new TRP_Advanced_Settings_List( trpListOptions[i] );
|
255 |
+
}
|
256 |
+
|
257 |
+
|
258 |
});
|
259 |
|
class-translate-press.php
CHANGED
@@ -22,6 +22,7 @@ class TRP_Translate_Press{
|
|
22 |
protected $upgrade;
|
23 |
protected $plugin_updater;
|
24 |
protected $license_page;
|
|
|
25 |
public $active_pro_addons = array();
|
26 |
public static $translate_press = null;
|
27 |
|
@@ -46,7 +47,7 @@ class TRP_Translate_Press{
|
|
46 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
47 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
48 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
49 |
-
define( 'TRP_PLUGIN_VERSION', '1.5.
|
50 |
|
51 |
wp_cache_add_non_persistent_groups(array('trp'));
|
52 |
|
@@ -88,6 +89,7 @@ class TRP_Translate_Press{
|
|
88 |
require_once TRP_PLUGIN_DIR . 'includes/class-uri.php';
|
89 |
require_once TRP_PLUGIN_DIR . 'includes/class-upgrade.php';
|
90 |
require_once TRP_PLUGIN_DIR . 'includes/class-plugin-notices.php';
|
|
|
91 |
require_once TRP_PLUGIN_DIR . 'includes/external-functions.php';
|
92 |
require_once TRP_PLUGIN_DIR . 'includes/functions.php';
|
93 |
require_once TRP_PLUGIN_DIR . 'assets/lib/simplehtmldom/simple_html_dom.php';
|
@@ -98,6 +100,9 @@ class TRP_Translate_Press{
|
|
98 |
* Instantiates components.
|
99 |
*/
|
100 |
protected function initialize_components() {
|
|
|
|
|
|
|
101 |
$this->loader = new TRP_Hooks_Loader();
|
102 |
$this->languages = new TRP_Languages();
|
103 |
$this->settings = new TRP_Settings();
|
@@ -155,6 +160,12 @@ class TRP_Translate_Press{
|
|
155 |
$this->loader->add_action( 'trp_settings_navigation_tabs', $this->settings, 'add_navigation_tabs' );
|
156 |
$this->loader->add_action( 'trp_language_selector', $this->settings, 'languages_selector', 10, 1 );
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
$this->loader->add_action( 'wp_ajax_nopriv_trp_get_translations', $this->editor_api_regular_strings, 'get_translations' );
|
160 |
|
22 |
protected $upgrade;
|
23 |
protected $plugin_updater;
|
24 |
protected $license_page;
|
25 |
+
protected $advanced_tab;
|
26 |
public $active_pro_addons = array();
|
27 |
public static $translate_press = null;
|
28 |
|
47 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
48 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
49 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
50 |
+
define( 'TRP_PLUGIN_VERSION', '1.5.2' );
|
51 |
|
52 |
wp_cache_add_non_persistent_groups(array('trp'));
|
53 |
|
89 |
require_once TRP_PLUGIN_DIR . 'includes/class-uri.php';
|
90 |
require_once TRP_PLUGIN_DIR . 'includes/class-upgrade.php';
|
91 |
require_once TRP_PLUGIN_DIR . 'includes/class-plugin-notices.php';
|
92 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-advanced-tab.php';
|
93 |
require_once TRP_PLUGIN_DIR . 'includes/external-functions.php';
|
94 |
require_once TRP_PLUGIN_DIR . 'includes/functions.php';
|
95 |
require_once TRP_PLUGIN_DIR . 'assets/lib/simplehtmldom/simple_html_dom.php';
|
100 |
* Instantiates components.
|
101 |
*/
|
102 |
protected function initialize_components() {
|
103 |
+
$this->advanced_tab = new TRP_Advanced_Tab();
|
104 |
+
$this->advanced_tab->include_custom_codes();
|
105 |
+
|
106 |
$this->loader = new TRP_Hooks_Loader();
|
107 |
$this->languages = new TRP_Languages();
|
108 |
$this->settings = new TRP_Settings();
|
160 |
$this->loader->add_action( 'trp_settings_navigation_tabs', $this->settings, 'add_navigation_tabs' );
|
161 |
$this->loader->add_action( 'trp_language_selector', $this->settings, 'languages_selector', 10, 1 );
|
162 |
|
163 |
+
$this->loader->add_action( 'trp_settings_tabs', $this->advanced_tab, 'add_advanced_tab_to_settings', 10, 1 );
|
164 |
+
$this->loader->add_action( 'admin_menu', $this->advanced_tab, 'add_submenu_page_advanced' );
|
165 |
+
$this->loader->add_action( 'trp_output_advanced_settings_options', $this->advanced_tab, 'output_advanced_options' );
|
166 |
+
$this->loader->add_action( 'admin_init', $this->advanced_tab, 'register_setting' );
|
167 |
+
$this->loader->add_action( 'admin_notices', $this->advanced_tab, 'admin_notices' );
|
168 |
+
|
169 |
|
170 |
$this->loader->add_action( 'wp_ajax_nopriv_trp_get_translations', $this->editor_api_regular_strings, 'get_translations' );
|
171 |
|
includes/advanced-settings/disable-dynamic-translation.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_disable_dynamic_translation', 30 );
|
4 |
+
function trp_register_disable_dynamic_translation( $settings_array ){
|
5 |
+
$settings_array[] = array(
|
6 |
+
'name' => 'disable_dynamic_translation',
|
7 |
+
'type' => 'checkbox',
|
8 |
+
'label' => esc_html__( 'Disable dynamic translation', 'translatepress-multilingual' ),
|
9 |
+
'description' => wp_kses( __( 'It disables detection of strings displayed dynamically using JavaScript. <br/>Strings loaded via a server side AJAX call will still be translated.', 'translatepress-multilingual' ), array( 'br' => array() ) ),
|
10 |
+
);
|
11 |
+
return $settings_array;
|
12 |
+
}
|
13 |
+
|
14 |
+
add_filter( 'trp_enable_dynamic_translation', 'trp_adst_disable_dynamic' );
|
15 |
+
function trp_adst_disable_dynamic( $enable ){
|
16 |
+
$option = get_option( 'trp_advanced_settings', true );
|
17 |
+
if ( isset( $option['disable_dynamic_translation'] ) && $option['disable_dynamic_translation'] === 'yes' ){
|
18 |
+
return false;
|
19 |
+
}
|
20 |
+
return $enable;
|
21 |
+
}
|
includes/advanced-settings/enable-auto-translate-slug.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_enable_auto_translate_slug', 80 );
|
4 |
+
function trp_register_enable_auto_translate_slug( $settings_array ){
|
5 |
+
$settings_array[] = array(
|
6 |
+
'name' => 'enable_auto_translate_slug',
|
7 |
+
'type' => 'checkbox',
|
8 |
+
'label' => esc_html__( 'Automatically translate slugs', 'translatepress-multilingual' ),
|
9 |
+
'description' => wp_kses( __( 'Generate automatic translations of slugs for posts, pages and Custom Post Types.<br/>Requires <a href="https://translatepress.com/docs/addons/seo-pack/" title="TranslatePress Add-on SEO Pack documentation" target="_blank"> SEO Pack Add-on</a> to be installed and activated.', 'translatepress-multilingual' ), array( 'br' => array(), 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ) ) ),
|
10 |
+
);
|
11 |
+
return $settings_array;
|
12 |
+
}
|
13 |
+
|
14 |
+
add_filter('trp_machine_translate_slug', 'trp_enable_auto_translate_slug');
|
15 |
+
function trp_enable_auto_translate_slug($allow) {
|
16 |
+
|
17 |
+
$option = get_option( 'trp_advanced_settings', true );
|
18 |
+
if ( isset( $option['enable_auto_translate_slug'] ) && $option['enable_auto_translate_slug'] === 'yes' ) {
|
19 |
+
return true;
|
20 |
+
}
|
21 |
+
return $allow;
|
22 |
+
}
|
includes/advanced-settings/exclude-gettext-strings.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_exclude_gettext_strings', 100 );
|
4 |
+
function trp_register_exclude_gettext_strings( $settings_array ){
|
5 |
+
$settings_array[] = array(
|
6 |
+
'name' => 'exclude_gettext_strings',
|
7 |
+
'type' => 'list',
|
8 |
+
'columns' => array(
|
9 |
+
'string' => __('Gettext String', 'translatepress-multilingual' ),
|
10 |
+
'domain' => __('Domain', 'translatepress-multilingual')
|
11 |
+
),
|
12 |
+
'label' => esc_html__( 'Exclude Gettext Strings', 'translatepress-multilingual' ),
|
13 |
+
'description' => wp_kses( __( 'Exclude these strings from being translated as Gettext strings. <br/>Can still be translated as regular strings.', 'translatepress-multilingual' ), array( 'br' => array() ) ),
|
14 |
+
);
|
15 |
+
return $settings_array;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Exclude gettext from being translated
|
20 |
+
*/
|
21 |
+
add_filter('gettext', 'trpc_exclude_strings', 1000, 3 );
|
22 |
+
function trpc_exclude_strings ($translation, $text, $domain ){
|
23 |
+
$option = get_option( 'trp_advanced_settings', true );
|
24 |
+
if ( isset( $option['exclude_gettext_strings'] ) ) {
|
25 |
+
|
26 |
+
foreach( $option['exclude_gettext_strings']['domain'] as $key => $value ){
|
27 |
+
if ( $domain === $value && $text === $option['exclude_gettext_strings']['string'][$key] ){
|
28 |
+
return $text;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
32 |
+
return $translation;
|
33 |
+
}
|
includes/advanced-settings/fix-broken-html.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_fix_broken_html', 50 );
|
4 |
+
function trp_register_fix_broken_html( $settings_array ){
|
5 |
+
$settings_array[] = array(
|
6 |
+
'name' => 'fix_broken_html',
|
7 |
+
'type' => 'checkbox',
|
8 |
+
'label' => esc_html__( 'Fix broken HTML', 'translatepress-multilingual' ),
|
9 |
+
'description' => wp_kses( __( 'General attempt to fix broken or missing HTML on translated pages.<br/><strong>Only try this if the "Fix spaces between html attribute" did not solve the issue.</strong>', 'translatepress-multilingual' ), array( 'br' => array(), 'strong' => array() ) ),
|
10 |
+
);
|
11 |
+
return $settings_array;
|
12 |
+
}
|
13 |
+
|
14 |
+
add_filter('trp_try_fixing_invalid_html', 'trp_fix_broken_html');
|
15 |
+
function trp_fix_broken_html($allow) {
|
16 |
+
|
17 |
+
$option = get_option( 'trp_advanced_settings', true );
|
18 |
+
if ( isset( $option['fix_broken_html'] ) && $option['fix_broken_html'] === 'yes' ) {
|
19 |
+
return true;
|
20 |
+
}
|
21 |
+
return $allow;
|
22 |
+
}
|
includes/advanced-settings/fix-invalid-space-between-html-attr.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_fix_invalid_space_between_html_attr', 40 );
|
4 |
+
function trp_register_fix_invalid_space_between_html_attr( $settings_array ){
|
5 |
+
$settings_array[] = array(
|
6 |
+
'name' => 'fix_invalid_space_between_html_attr',
|
7 |
+
'type' => 'checkbox',
|
8 |
+
'label' => esc_html__( 'Fix spaces between HTML attributes', 'translatepress-multilingual' ),
|
9 |
+
'description' => wp_kses( __( 'Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages.', 'translatepress-multilingual' ), array( 'br' => array()) ),
|
10 |
+
);
|
11 |
+
return $settings_array;
|
12 |
+
}
|
13 |
+
|
14 |
+
add_filter('trp_before_translate_content', 'trp_fix_html_attributes_without_spaces');
|
15 |
+
function trp_fix_html_attributes_without_spaces($output){
|
16 |
+
|
17 |
+
$option = get_option( 'trp_advanced_settings', true );
|
18 |
+
if ( isset( $option['fix_invalid_space_between_html_attr'] ) && $option['fix_invalid_space_between_html_attr'] === 'yes' ){
|
19 |
+
$size = strlen($output);
|
20 |
+
$pos = 0;
|
21 |
+
$pos_c = 0;
|
22 |
+
|
23 |
+
while ($pos_c < $size){
|
24 |
+
|
25 |
+
$len = strcspn($output, '<' , $pos);
|
26 |
+
$pos += $len;
|
27 |
+
|
28 |
+
$len_c = strcspn($output, '>' , $pos);
|
29 |
+
$pos_c += $len_c;
|
30 |
+
|
31 |
+
$even_detection_apostrophe = 0;
|
32 |
+
$even_detection_quote = 0;
|
33 |
+
for ($i = $pos; $i < $pos_c; $i++){
|
34 |
+
$char = $output[$i]; //next
|
35 |
+
if ($char == '"' ){
|
36 |
+
$even_detection_quote ++;
|
37 |
+
if ( $even_detection_quote % 2 == 0){
|
38 |
+
$output = substr_replace( $output, ' ', $i+1, 0 );
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
if ($char == "'" ){
|
43 |
+
$even_detection_apostrophe ++;
|
44 |
+
if ( $even_detection_apostrophe % 2 == 0){
|
45 |
+
$output = substr_replace( $output, ' ', $i+1, 0 );
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
$pos_c ++;
|
51 |
+
$pos = $pos_c;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
return $output;
|
56 |
+
}
|
includes/advanced-settings/show-dynamic-content-before-translation.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_show_dynamic_content_before_translation', 20 );
|
4 |
+
function trp_register_show_dynamic_content_before_translation( $settings_array ){
|
5 |
+
$settings_array[] = array(
|
6 |
+
'name' => 'show_dynamic_content_before_translation',
|
7 |
+
'type' => 'checkbox',
|
8 |
+
'label' => esc_html__( 'Show dynamic content before translation', 'translatepress-multilingual' ),
|
9 |
+
'description' => wp_kses( __( 'Shows dynamically inserted content in original language for a moment before the translation request is finished. <br> May help fix missing content inserted using JavaScript.', 'translatepress-multilingual' ), array( 'br' => array()) ),
|
10 |
+
);
|
11 |
+
return $settings_array;
|
12 |
+
}
|
13 |
+
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Apply "show dynamic content before translation" fix only on front page
|
17 |
+
*/
|
18 |
+
add_filter( 'trp_show_dynamic_content_before_translation', 'trp_show_dynamic_content_before_translation' );
|
19 |
+
function trp_show_dynamic_content_before_translation( $allow ){
|
20 |
+
$option = get_option( 'trp_advanced_settings', true );
|
21 |
+
if ( isset( $option['show_dynamic_content_before_translation'] ) && $option['show_dynamic_content_before_translation'] === 'yes' ){
|
22 |
+
return true;
|
23 |
+
}
|
24 |
+
return $allow;
|
25 |
+
}
|
includes/advanced-settings/skip-dynamic-selectors.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_skip_dynamic_selectors', 110 );
|
4 |
+
function trp_register_skip_dynamic_selectors( $settings_array ){
|
5 |
+
$settings_array[] = array(
|
6 |
+
'name' => 'skip_dynamic_selectors',
|
7 |
+
'type' => 'list',
|
8 |
+
'columns' => array(
|
9 |
+
'selector' => __('Selector', 'translatepress-multilingual' ),
|
10 |
+
),
|
11 |
+
'label' => esc_html__( 'Exclude from dynamic translation', 'translatepress-multilingual' ),
|
12 |
+
'description' => wp_kses( __( 'Do not dynamically translate strings that are found in html nodes matching these selectors.<br>Excludes all the children of HTML nodes matching these selectors from being translated using JavaScript.<br/>These strings will still be translated on the server side if possible.', 'translatepress-multilingual' ), array( 'br' => array() ) ),
|
13 |
+
);
|
14 |
+
return $settings_array;
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
add_filter( 'trp_skip_selectors_from_dynamic_translation', 'trp_skip_dynamic_translation_for_selectors' );
|
19 |
+
function trp_skip_dynamic_translation_for_selectors( $skip_selectors ){
|
20 |
+
$option = get_option( 'trp_advanced_settings', true );
|
21 |
+
$add_skip_selectors = array( );
|
22 |
+
if ( isset( $option['skip_dynamic_selectors'] ) && is_array( $option['skip_dynamic_selectors']['selector'] ) ) {
|
23 |
+
$add_skip_selectors = $option['skip_dynamic_selectors']['selector'];
|
24 |
+
}
|
25 |
+
return array_merge( $skip_selectors, $add_skip_selectors );
|
26 |
+
}
|
includes/advanced-settings/strip-gettext-post-content.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_strip_gettext_post_content', 60 );
|
3 |
+
function trp_register_strip_gettext_post_content( $settings_array ){
|
4 |
+
$settings_array[] = array(
|
5 |
+
'name' => 'strip_gettext_post_content',
|
6 |
+
'type' => 'checkbox',
|
7 |
+
'label' => esc_html__( 'Filter Gettext wrapping from post content and title', 'translatepress-multilingual' ),
|
8 |
+
'description' => wp_kses( __( 'Filters gettext wrapping such as #!trpst#trp-gettext from all updated post content and post title. Does not affect previous post content. <br/><strong>Database backup is recommended before switching on.</strong>', 'translatepress-multilingual' ), array( 'br' => array(), 'strong' => array()) ),
|
9 |
+
);
|
10 |
+
return $settings_array;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Strip gettext wrapping from post title and content.
|
15 |
+
* They will be regular strings, written in the language they were submitted.
|
16 |
+
* Filter called both for wp_insert_post and wp_update_post
|
17 |
+
*/
|
18 |
+
add_filter('wp_insert_post_data', 'trp_filter_trpgettext_from_post_content', 10, 2 );
|
19 |
+
function trp_filter_trpgettext_from_post_content($data, $postarr ){
|
20 |
+
$option = get_option( 'trp_advanced_settings', true );
|
21 |
+
if ( isset( $option['strip_gettext_post_content'] ) && $option['strip_gettext_post_content'] === 'yes' && class_exists( 'TRP_Translation_Manager' ) ){
|
22 |
+
$data['post_content'] = TRP_Translation_Manager::strip_gettext_tags($data['post_content']);
|
23 |
+
$data['post_title'] = TRP_Translation_Manager::strip_gettext_tags($data['post_title']);
|
24 |
+
}
|
25 |
+
return $data;
|
26 |
+
}
|
includes/advanced-settings/strip-gettext-post-meta.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_strip_gettext_post_meta', 70 );
|
4 |
+
function trp_register_strip_gettext_post_meta( $settings_array ){
|
5 |
+
$settings_array[] = array(
|
6 |
+
'name' => 'strip_gettext_post_meta',
|
7 |
+
'type' => 'checkbox',
|
8 |
+
'label' => esc_html__( 'Filter Gettext wrapping from post meta', 'translatepress-multilingual' ),
|
9 |
+
'description' => wp_kses( __( 'Filters gettext wrapping such as #!trpst#trp-gettext from all updated post meta. Does not affect previous post meta. <br/><strong>Database backup is recommended before switching on.</strong>', 'translatepress-multilingual' ), array( 'br' => array(), 'strong' => array()) ),
|
10 |
+
);
|
11 |
+
return $settings_array;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Stripped gettext wrapping from wp_update_post_meta
|
16 |
+
*/
|
17 |
+
add_action( 'added_post_meta', 'trp_filter_trpgettext_from_updated_post_meta', 10, 4);
|
18 |
+
add_action( 'updated_postmeta', 'trp_filter_trpgettext_from_updated_post_meta', 10, 4);
|
19 |
+
function trp_filter_trpgettext_from_updated_post_meta($meta_id, $object_id, $meta_key, $meta_value){
|
20 |
+
$option = get_option( 'trp_advanced_settings', true );
|
21 |
+
if ( isset( $option['strip_gettext_post_meta'] ) && $option['strip_gettext_post_meta'] === 'yes' && class_exists( 'TRP_Translation_Manager' ) ){
|
22 |
+
if ( is_serialized($meta_value) ){
|
23 |
+
$unserialized_meta_value = unserialize($meta_value);
|
24 |
+
$stripped_meta_value = trp_strip_gettext_array( $unserialized_meta_value );
|
25 |
+
$stripped_meta_value = serialize( $stripped_meta_value );
|
26 |
+
}else{
|
27 |
+
$stripped_meta_value = trp_strip_gettext_array( $meta_value );
|
28 |
+
}
|
29 |
+
|
30 |
+
if ( $stripped_meta_value != $meta_value){
|
31 |
+
remove_action('updated_postmeta','trp_filter_trpgettext_from_updated_post_meta' );
|
32 |
+
update_post_meta( $object_id, $meta_key, $stripped_meta_value );
|
33 |
+
add_action( 'updated_postmeta', 'trp_filter_trpgettext_from_updated_post_meta', 10, 4);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
function trp_strip_gettext_array( $value ){
|
39 |
+
if ( is_array( $value ) ){
|
40 |
+
foreach( $value as $key => $item ){
|
41 |
+
$value[$key] = trp_strip_gettext_array( $item );
|
42 |
+
}
|
43 |
+
return $value;
|
44 |
+
}else{
|
45 |
+
return TRP_Translation_Manager::strip_gettext_tags( $value );
|
46 |
+
}
|
47 |
+
}
|
includes/class-advanced-tab.php
ADDED
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TRP_Advanced_Tab {
|
4 |
+
|
5 |
+
/*
|
6 |
+
* Add new tab to TP settings
|
7 |
+
*
|
8 |
+
* Hooked to trp_settings_tabs
|
9 |
+
*/
|
10 |
+
public function add_advanced_tab_to_settings( $tab_array ){
|
11 |
+
$tab_array[] = array(
|
12 |
+
'name' => __( 'Advanced', 'translatepress-multilingual' ),
|
13 |
+
'url' => admin_url( 'admin.php?page=trp_advanced_page' ),
|
14 |
+
'page' => 'trp_advanced_page'
|
15 |
+
);
|
16 |
+
return $tab_array;
|
17 |
+
}
|
18 |
+
|
19 |
+
/*
|
20 |
+
* Add submenu for advanced page tab
|
21 |
+
*
|
22 |
+
* Hooked to admin_menu
|
23 |
+
*/
|
24 |
+
public function add_submenu_page_advanced() {
|
25 |
+
add_submenu_page( 'TRPHidden', 'TranslatePress Advanced Settings', 'TRPHidden', 'manage_options', 'trp_advanced_page', array(
|
26 |
+
$this,
|
27 |
+
'advanced_page_content'
|
28 |
+
) );
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Register setting
|
33 |
+
*
|
34 |
+
* Hooked to admin_init
|
35 |
+
*/
|
36 |
+
public function register_setting(){
|
37 |
+
register_setting( 'trp_advanced_settings', 'trp_advanced_settings', array( $this, 'sanitize_settings' ) );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Output admin notices after saving settings.
|
42 |
+
*/
|
43 |
+
public function admin_notices(){
|
44 |
+
settings_errors( 'trp_advanced_settings' );
|
45 |
+
}
|
46 |
+
|
47 |
+
/*
|
48 |
+
* Sanitize settings
|
49 |
+
*/
|
50 |
+
public function sanitize_settings( $submitted_settings ){
|
51 |
+
$registered_settings = $this->get_settings();
|
52 |
+
$settings = array();
|
53 |
+
foreach ( $registered_settings as $registered_setting ){
|
54 |
+
if ( isset( $submitted_settings[$registered_setting['name']] ) ){
|
55 |
+
switch ($registered_setting['type'] ) {
|
56 |
+
case 'checkbox': {
|
57 |
+
$settings[ $registered_setting['name'] ] = ( $submitted_settings[ $registered_setting['name'] ] === 'yes' ) ? 'yes' : 'no';
|
58 |
+
break;
|
59 |
+
}
|
60 |
+
case 'list': {
|
61 |
+
$settings[ $registered_setting['name'] ] = array();
|
62 |
+
foreach ( $registered_setting['columns'] as $column => $column_name ) {
|
63 |
+
$one_column = $column;
|
64 |
+
$settings[ $registered_setting['name'] ][ $column ] = array();
|
65 |
+
foreach ( $submitted_settings[ $registered_setting['name'] ][ $column ] as $key => $value ) {
|
66 |
+
$settings[ $registered_setting['name'] ][ $column ][] = sanitize_text_field( $value );
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
// remove empty rows
|
71 |
+
foreach ( $settings[ $registered_setting['name'] ][ $one_column ] as $key => $value ) {
|
72 |
+
$is_empty = true;
|
73 |
+
foreach ( $registered_setting['columns'] as $column => $column_name ) {
|
74 |
+
if ( $settings[ $registered_setting['name'] ][$column][$key] != "" ) {
|
75 |
+
$is_empty = false;
|
76 |
+
break;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
if ( $is_empty ){
|
80 |
+
foreach ( $registered_setting['columns'] as $column => $column_name ) {
|
81 |
+
unset( $settings[ $registered_setting['name'] ][$column][$key] );
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
foreach ( $settings[ $registered_setting['name'] ] as $column => $value ) {
|
87 |
+
$settings[ $registered_setting['name'] ][ $column ] = array_values( $settings[ $registered_setting['name'] ][ $column ] );
|
88 |
+
}
|
89 |
+
break;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
add_settings_error( 'trp_advanced_settings', 'settings_updated', __( 'Settings saved.' ), 'updated' );
|
95 |
+
|
96 |
+
return apply_filters( 'trp_extra_sanitize_advanced_settings', $settings, $submitted_settings );
|
97 |
+
}
|
98 |
+
|
99 |
+
/*
|
100 |
+
* Advanced page content
|
101 |
+
*/
|
102 |
+
public function advanced_page_content(){
|
103 |
+
require_once TRP_PLUGIN_DIR . 'partials/advanced-settings-page.php';
|
104 |
+
}
|
105 |
+
|
106 |
+
/*
|
107 |
+
* Require the custom codes from the specified folder
|
108 |
+
*/
|
109 |
+
public function include_custom_codes(){
|
110 |
+
$paths = apply_filters( 'trp_custom_code_path_folder', array( TRP_PLUGIN_DIR . 'includes/advanced-settings/*.php' ) );
|
111 |
+
|
112 |
+
foreach( $paths as $path ) {
|
113 |
+
$path = glob( $path );
|
114 |
+
foreach ( $path as $file ) {
|
115 |
+
require( $file );
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
/*
|
121 |
+
* Get array of registered options from custom code to display in Advanced Settings page
|
122 |
+
*/
|
123 |
+
public function get_settings(){
|
124 |
+
return apply_filters( 'trp_register_advanced_settings', array() );
|
125 |
+
}
|
126 |
+
|
127 |
+
/*
|
128 |
+
* Hooked to trp_settings_navigation_tabs
|
129 |
+
*/
|
130 |
+
public function output_advanced_options(){
|
131 |
+
$advanced_settings_array = $this->get_settings();
|
132 |
+
foreach( $advanced_settings_array as $setting ){
|
133 |
+
switch( $setting['type'] ){
|
134 |
+
case 'checkbox':
|
135 |
+
echo $this->checkbox_setting( $setting );
|
136 |
+
break;
|
137 |
+
case 'list':
|
138 |
+
echo $this->add_to_list_setting( $setting );
|
139 |
+
break;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Return HTML of a checkbox type setting
|
146 |
+
*
|
147 |
+
* @param $setting
|
148 |
+
*
|
149 |
+
* @return 'string'
|
150 |
+
*/
|
151 |
+
public function checkbox_setting( $setting ){
|
152 |
+
$option = get_option( 'trp_advanced_settings', true );
|
153 |
+
$checked = ( isset( $option[ $setting['name'] ] ) && $option[ $setting['name'] ] === 'yes' ) ? 'checked' : '';
|
154 |
+
$html = "
|
155 |
+
<tr>
|
156 |
+
<th scope='row'>" . $setting['label'] . "</th>
|
157 |
+
<td>
|
158 |
+
<label>
|
159 |
+
<input type='checkbox' id='" . $setting['name'] . "' name='trp_advanced_settings[" . $setting['name'] . "]' value='yes' " . $checked . ">
|
160 |
+
" . __('Yes', 'translatepress-multilingual' ). "
|
161 |
+
</label>
|
162 |
+
<p class='description'>
|
163 |
+
" . $setting['description'] . "
|
164 |
+
</p>
|
165 |
+
</td>
|
166 |
+
</tr>";
|
167 |
+
return apply_filters('trp_advanced_setting_checkbox', $html );
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Return HTML of a checkbox type setting
|
172 |
+
*
|
173 |
+
* @param $setting
|
174 |
+
*
|
175 |
+
* @return 'string'
|
176 |
+
*/
|
177 |
+
public function add_to_list_setting( $setting ){
|
178 |
+
$option = get_option( 'trp_advanced_settings', true );
|
179 |
+
$html = "
|
180 |
+
<tr>
|
181 |
+
<th scope='row'>" . $setting['label'] . "</th>
|
182 |
+
<td>
|
183 |
+
<table class='trp-adst-list-option'>
|
184 |
+
<thead>
|
185 |
+
";
|
186 |
+
foreach( $setting['columns'] as $key => $value ){
|
187 |
+
$html .= '<th><strong>' . $value . '</strong></th>';
|
188 |
+
}
|
189 |
+
//"Remove" button
|
190 |
+
$html .= "<th></th>";
|
191 |
+
|
192 |
+
// list existing entries
|
193 |
+
$html .= " </thead>";
|
194 |
+
|
195 |
+
$first_column = '';
|
196 |
+
foreach( $setting['columns'] as $column => $column_name ) {
|
197 |
+
$first_column = $column;
|
198 |
+
break;
|
199 |
+
}
|
200 |
+
if ( isset( $option[ $setting['name'] ] ) && is_array( $option[ $setting['name'] ] ) ) {
|
201 |
+
foreach ( $option[ $setting['name'] ][ $first_column ] as $index => $value ) {
|
202 |
+
$html .= "<tr class='trp-list-entry'>";
|
203 |
+
foreach ( $setting['columns'] as $column => $column_name ) {
|
204 |
+
$html .= "<td><textarea name='trp_advanced_settings[" . $setting['name'] . "][" . $column . "][]'>" . $option[ $setting['name'] ][ $column ][ $index ] . "</textarea></td>";
|
205 |
+
}
|
206 |
+
$html .= "<td><span class='trp-adst-remove-element' data-confirm-message='" . __('Are you sure you want to remove this item?', 'translatepress-multilingual') . "'>" . __( 'Remove', 'translatepress-multilingual' ) . "</span></td>";
|
207 |
+
$html .= "</tr>";
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
// add new entry to list
|
212 |
+
$html .= "<tr class='trp-add-list-entry trp-list-entry'>";
|
213 |
+
foreach( $setting['columns'] as $column => $column_name ) {
|
214 |
+
$html .= "<td><textarea id='new_entry_" . $setting['name'] . "_" . $column . "' data-name='trp_advanced_settings[" . $setting['name'] . "][" . $column . "][]' data-setting-name='" . $setting['name'] . "' data-column-name='" . $column . "'></textarea></td>";
|
215 |
+
}
|
216 |
+
$html .= "<td><input type='button' class='button-secondary trp-adst-button-add-new-item' value='" . __( 'Add', 'translatepress-multilingual' ) . "'><span class='trp-adst-remove-element' style='display: none;' data-confirm-message='" . __('Are you sure you want to remove this item?', 'translatepress-multilingual') . "'>" . __( 'Remove', 'translatepress-multilingual' ) . "</span></td>";
|
217 |
+
$html .= "</tr></table>";
|
218 |
+
|
219 |
+
$html .= "<p class='description'>
|
220 |
+
" . $setting['description'] . "
|
221 |
+
</p>
|
222 |
+
</td>
|
223 |
+
</tr>";
|
224 |
+
return apply_filters( 'trp_advanced_setting_checkbox', $html );
|
225 |
+
}
|
226 |
+
|
227 |
+
}
|
includes/class-plugin-notices.php
CHANGED
@@ -70,7 +70,7 @@ Class TRP_Plugin_Notifications {
|
|
70 |
private static $_instance = null;
|
71 |
private $prefix = 'trp';
|
72 |
private $menu_slug = 'options-general.php';
|
73 |
-
public $pluginPages = array( 'translate-press', 'trp_addons_page', 'trp_license_key' );
|
74 |
|
75 |
protected function __construct() {
|
76 |
add_action( 'admin_init', array( $this, 'dismiss_admin_notifications' ), 200 );
|
70 |
private static $_instance = null;
|
71 |
private $prefix = 'trp';
|
72 |
private $menu_slug = 'options-general.php';
|
73 |
+
public $pluginPages = array( 'translate-press', 'trp_addons_page', 'trp_license_key', 'trp_advanced_page' );
|
74 |
|
75 |
protected function __construct() {
|
76 |
add_action( 'admin_init', array( $this, 'dismiss_admin_notifications' ), 200 );
|
includes/class-settings.php
CHANGED
@@ -287,7 +287,7 @@ class TRP_Settings{
|
|
287 |
* @param string $hook Admin page.
|
288 |
*/
|
289 |
public function enqueue_scripts_and_styles( $hook ) {
|
290 |
-
if ( $hook == 'settings_page_translate-press' || $hook == 'admin_page_trp_license_key' || $hook == 'admin_page_trp_addons_page' ) {
|
291 |
wp_enqueue_style(
|
292 |
'trp-settings-style',
|
293 |
TRP_PLUGIN_URL . 'assets/css/trp-back-end-style.css',
|
@@ -296,7 +296,7 @@ class TRP_Settings{
|
|
296 |
);
|
297 |
}
|
298 |
|
299 |
-
if ( $hook == 'settings_page_translate-press' ) {
|
300 |
wp_enqueue_script( 'trp-settings-script', TRP_PLUGIN_URL . 'assets/js/trp-back-end-script.js', array( 'jquery', 'jquery-ui-sortable' ), TRP_PLUGIN_VERSION );
|
301 |
if ( ! $this->trp_languages ){
|
302 |
$trp = TRP_Translate_Press::get_trp_instance();
|
@@ -379,7 +379,7 @@ class TRP_Settings{
|
|
379 |
*
|
380 |
*/
|
381 |
public function add_navigation_tabs(){
|
382 |
-
$tabs =
|
383 |
array(
|
384 |
'name' => __( 'General', 'translatepress-multilingual' ),
|
385 |
'url' => admin_url( 'options-general.php?page=translate-press' ),
|
@@ -389,13 +389,12 @@ class TRP_Settings{
|
|
389 |
'name' => __( 'Translate Site', 'translatepress-multilingual' ),
|
390 |
'url' => add_query_arg( 'trp-edit-translation', 'true', home_url() ),
|
391 |
'page' => 'trp_translation_editor'
|
392 |
-
)
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
'page' => 'trp_addons_page'
|
399 |
);
|
400 |
|
401 |
if( class_exists('TRP_LICENSE_PAGE') ) {
|
@@ -406,6 +405,8 @@ class TRP_Settings{
|
|
406 |
);
|
407 |
}
|
408 |
|
|
|
|
|
409 |
$active_tab = 'translate-press';
|
410 |
if ( isset( $_GET['page'] ) ){
|
411 |
$active_tab = esc_attr( wp_unslash( $_GET['page'] ) );
|
287 |
* @param string $hook Admin page.
|
288 |
*/
|
289 |
public function enqueue_scripts_and_styles( $hook ) {
|
290 |
+
if ( $hook == 'settings_page_translate-press' || $hook == 'admin_page_trp_license_key' || $hook == 'admin_page_trp_addons_page' || $hook == 'admin_page_trp_advanced_page' ) {
|
291 |
wp_enqueue_style(
|
292 |
'trp-settings-style',
|
293 |
TRP_PLUGIN_URL . 'assets/css/trp-back-end-style.css',
|
296 |
);
|
297 |
}
|
298 |
|
299 |
+
if ( $hook == 'settings_page_translate-press' || $hook == 'admin_page_trp_advanced_page' ) {
|
300 |
wp_enqueue_script( 'trp-settings-script', TRP_PLUGIN_URL . 'assets/js/trp-back-end-script.js', array( 'jquery', 'jquery-ui-sortable' ), TRP_PLUGIN_VERSION );
|
301 |
if ( ! $this->trp_languages ){
|
302 |
$trp = TRP_Translate_Press::get_trp_instance();
|
379 |
*
|
380 |
*/
|
381 |
public function add_navigation_tabs(){
|
382 |
+
$tabs = array(
|
383 |
array(
|
384 |
'name' => __( 'General', 'translatepress-multilingual' ),
|
385 |
'url' => admin_url( 'options-general.php?page=translate-press' ),
|
389 |
'name' => __( 'Translate Site', 'translatepress-multilingual' ),
|
390 |
'url' => add_query_arg( 'trp-edit-translation', 'true', home_url() ),
|
391 |
'page' => 'trp_translation_editor'
|
392 |
+
),
|
393 |
+
array(
|
394 |
+
'name' => __( 'Addons', 'translatepress-multilingual' ),
|
395 |
+
'url' => admin_url( 'admin.php?page=trp_addons_page' ),
|
396 |
+
'page' => 'trp_addons_page'
|
397 |
+
)
|
|
|
398 |
);
|
399 |
|
400 |
if( class_exists('TRP_LICENSE_PAGE') ) {
|
405 |
);
|
406 |
}
|
407 |
|
408 |
+
$tabs = apply_filters( 'trp_settings_tabs', $tabs );
|
409 |
+
|
410 |
$active_tab = 'translate-press';
|
411 |
if ( isset( $_GET['page'] ) ){
|
412 |
$active_tab = esc_attr( wp_unslash( $_GET['page'] ) );
|
includes/class-translation-render.php
CHANGED
@@ -743,7 +743,7 @@ class TRP_Translation_Render{
|
|
743 |
/* perform preg replace on the remaining trp-gettext tags */
|
744 |
$final_html = $this->remove_trp_html_tags( $final_html );
|
745 |
|
746 |
-
return apply_filters( 'trp_translated_html', $final_html, $TRP_LANGUAGE, $language_code );
|
747 |
}
|
748 |
|
749 |
/*
|
@@ -1188,6 +1188,41 @@ class TRP_Translation_Render{
|
|
1188 |
|
1189 |
}
|
1190 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1191 |
/**
|
1192 |
* Enqueue dynamic translation script.
|
1193 |
*/
|
@@ -1200,38 +1235,9 @@ class TRP_Translation_Render{
|
|
1200 |
global $TRP_LANGUAGE;
|
1201 |
|
1202 |
if ( $TRP_LANGUAGE != $this->settings['default-language'] || ( isset( $_REQUEST['trp-edit-translation'] ) && $_REQUEST['trp-edit-translation'] == 'preview' ) ) {
|
1203 |
-
$language_to_query = $TRP_LANGUAGE;
|
1204 |
-
if ( $TRP_LANGUAGE == $this->settings['default-language'] ) {
|
1205 |
-
foreach ($this->settings['translation-languages'] as $language) {
|
1206 |
-
if ( $language != $this->settings['default-language'] ) {
|
1207 |
-
$language_to_query = $language;
|
1208 |
-
break;
|
1209 |
-
}
|
1210 |
-
}
|
1211 |
-
}
|
1212 |
-
$language_to_query = ( count ( $this->settings['translation-languages'] ) < 2 ) ? '' : $language_to_query;
|
1213 |
-
|
1214 |
-
$trp = TRP_Translate_Press::get_trp_instance();
|
1215 |
-
if ( ! $this->translation_manager ) {
|
1216 |
-
$this->translation_manager = $trp->get_component( 'translation_manager' );
|
1217 |
-
}
|
1218 |
-
$nonces = $this->translation_manager->editor_nonces();
|
1219 |
-
$trp_data = array(
|
1220 |
-
'trp_custom_ajax_url' => apply_filters('trp_custom_ajax_url', TRP_PLUGIN_URL . 'includes/trp-ajax.php' ),
|
1221 |
-
'trp_wp_ajax_url' => apply_filters('trp_wp_ajax_url', admin_url('admin-ajax.php')),
|
1222 |
-
'trp_language_to_query' => $language_to_query,
|
1223 |
-
'trp_original_language' => $this->settings['default-language'],
|
1224 |
-
'trp_current_language' => $TRP_LANGUAGE,
|
1225 |
-
'trp_skip_selectors' => apply_filters( 'trp_skip_selectors_from_dynamic_translation', array( '[data-no-translation]', '[data-no-dynamic-translation]', '[data-trp-translate-id-innertext]', 'script', 'style', 'head', 'trp-span', 'translate-press' ), $TRP_LANGUAGE, $this->settings ), // data-trp-translate-id-innertext refers to translation block and it shouldn't be detected
|
1226 |
-
'trp_base_selectors' => $this->get_base_attribute_selectors(),
|
1227 |
-
'trp_attributes_selectors' => $this->get_node_accessors(),
|
1228 |
-
'trp_attributes_accessors' => $this->get_accessors_array(),
|
1229 |
-
'gettranslationsnonceregular' => $nonces['gettranslationsnonceregular'],
|
1230 |
-
'showdynamiccontentbeforetranslation' => apply_filters( 'trp_show_dynamic_content_before_translation', false )
|
1231 |
-
);
|
1232 |
|
1233 |
wp_enqueue_script('trp-dynamic-translator', TRP_PLUGIN_URL . 'assets/js/trp-translate-dom-changes.js', array('jquery'), TRP_PLUGIN_VERSION, true );
|
1234 |
-
wp_localize_script('trp-dynamic-translator', 'trp_data', $
|
1235 |
}
|
1236 |
}
|
1237 |
|
743 |
/* perform preg replace on the remaining trp-gettext tags */
|
744 |
$final_html = $this->remove_trp_html_tags( $final_html );
|
745 |
|
746 |
+
return apply_filters( 'trp_translated_html', $final_html, $TRP_LANGUAGE, $language_code, $preview_mode );
|
747 |
}
|
748 |
|
749 |
/*
|
1188 |
|
1189 |
}
|
1190 |
|
1191 |
+
public function get_trp_data(){
|
1192 |
+
global $TRP_LANGUAGE;
|
1193 |
+
|
1194 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
1195 |
+
if ( ! $this->translation_manager ) {
|
1196 |
+
$this->translation_manager = $trp->get_component( 'translation_manager' );
|
1197 |
+
}
|
1198 |
+
$nonces = $this->translation_manager->editor_nonces();
|
1199 |
+
|
1200 |
+
$language_to_query = $TRP_LANGUAGE;
|
1201 |
+
if ( $TRP_LANGUAGE == $this->settings['default-language'] ) {
|
1202 |
+
foreach ($this->settings['translation-languages'] as $language) {
|
1203 |
+
if ( $language != $this->settings['default-language'] ) {
|
1204 |
+
$language_to_query = $language;
|
1205 |
+
break;
|
1206 |
+
}
|
1207 |
+
}
|
1208 |
+
}
|
1209 |
+
$language_to_query = ( count ( $this->settings['translation-languages'] ) < 2 ) ? '' : $language_to_query;
|
1210 |
+
|
1211 |
+
return array(
|
1212 |
+
'trp_custom_ajax_url' => apply_filters('trp_custom_ajax_url', TRP_PLUGIN_URL . 'includes/trp-ajax.php' ),
|
1213 |
+
'trp_wp_ajax_url' => apply_filters('trp_wp_ajax_url', admin_url('admin-ajax.php')),
|
1214 |
+
'trp_language_to_query' => $language_to_query,
|
1215 |
+
'trp_original_language' => $this->settings['default-language'],
|
1216 |
+
'trp_current_language' => $TRP_LANGUAGE,
|
1217 |
+
'trp_skip_selectors' => apply_filters( 'trp_skip_selectors_from_dynamic_translation', array( '[data-no-translation]', '[data-no-dynamic-translation]', '[data-trp-translate-id-innertext]', 'script', 'style', 'head', 'trp-span', 'translate-press' ), $TRP_LANGUAGE, $this->settings ), // data-trp-translate-id-innertext refers to translation block and it shouldn't be detected
|
1218 |
+
'trp_base_selectors' => $this->get_base_attribute_selectors(),
|
1219 |
+
'trp_attributes_selectors' => $this->get_node_accessors(),
|
1220 |
+
'trp_attributes_accessors' => $this->get_accessors_array(),
|
1221 |
+
'gettranslationsnonceregular' => $nonces['gettranslationsnonceregular'],
|
1222 |
+
'showdynamiccontentbeforetranslation' => apply_filters( 'trp_show_dynamic_content_before_translation', false )
|
1223 |
+
);
|
1224 |
+
}
|
1225 |
+
|
1226 |
/**
|
1227 |
* Enqueue dynamic translation script.
|
1228 |
*/
|
1235 |
global $TRP_LANGUAGE;
|
1236 |
|
1237 |
if ( $TRP_LANGUAGE != $this->settings['default-language'] || ( isset( $_REQUEST['trp-edit-translation'] ) && $_REQUEST['trp-edit-translation'] == 'preview' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1238 |
|
1239 |
wp_enqueue_script('trp-dynamic-translator', TRP_PLUGIN_URL . 'assets/js/trp-translate-dom-changes.js', array('jquery'), TRP_PLUGIN_VERSION, true );
|
1240 |
+
wp_localize_script('trp-dynamic-translator', 'trp_data', $this->get_trp_data() );
|
1241 |
}
|
1242 |
}
|
1243 |
|
includes/functions.php
CHANGED
@@ -750,3 +750,48 @@ function trp_qm_strip_gettext( $data ){
|
|
750 |
}
|
751 |
return $data;
|
752 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
750 |
}
|
751 |
return $data;
|
752 |
}
|
753 |
+
|
754 |
+
/**
|
755 |
+
* Compatibility with SeedProd Coming Soon
|
756 |
+
*
|
757 |
+
* Manually include the scripts and styles if do_action('enqueue_scripts') is not called
|
758 |
+
*/
|
759 |
+
add_filter( 'trp_translated_html', 'trp_force_include_scripts', 10, 4 );
|
760 |
+
function trp_force_include_scripts( $final_html, $TRP_LANGUAGE, $language_code, $preview_mode ){
|
761 |
+
if ( $preview_mode ){
|
762 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
763 |
+
$translation_render = $trp->get_component( 'translation_render' );
|
764 |
+
$trp_data = $translation_render->get_trp_data();
|
765 |
+
|
766 |
+
$scripts_and_styles = apply_filters('trp_editor_missing_scripts_and_styles', array(
|
767 |
+
'jquery' => "<script type='text/javascript' src='" . includes_url( '/js/jquery/jquery.js' ) . "'></script>",
|
768 |
+
'trp-iframe-preview-script.js' => "<script type='text/javascript' src='" . TRP_PLUGIN_URL . "assets/js/trp-iframe-preview-script.js'></script>",
|
769 |
+
'trp-translate-dom-changes.js' => "<script>trp_data = '" . addslashes(json_encode($trp_data) ) . "'; trp_data = JSON.parse(trp_data);</script><script type='text/javascript' src='" . TRP_PLUGIN_URL . "assets/js/trp-translate-dom-changes.js'></script>",
|
770 |
+
'trp-preview-iframe-style-css' => "<link rel='stylesheet' id='trp-preview-iframe-style-css' href='" . TRP_PLUGIN_URL . "assets/css/trp-preview-iframe-style.css' type='text/css' media='all' />",
|
771 |
+
'dashicons' => "<link rel='stylesheet' id='dashicons-css' href='" . includes_url( '/css/dashicons.min.css' ) . "' type='text/css' media='all' />"
|
772 |
+
));
|
773 |
+
|
774 |
+
$missing_script = '';
|
775 |
+
foreach($scripts_and_styles as $key => $value ){
|
776 |
+
if ( strpos( $final_html, $key ) === false ){
|
777 |
+
$missing_script .= $value;
|
778 |
+
}
|
779 |
+
}
|
780 |
+
|
781 |
+
if ( $missing_script !== '' ){
|
782 |
+
$html = TranslatePress\str_get_html( $final_html, true, true, TRP_DEFAULT_TARGET_CHARSET, false, TRP_DEFAULT_BR_TEXT, TRP_DEFAULT_SPAN_TEXT );
|
783 |
+
if ( $html === false ) {
|
784 |
+
return $final_html;
|
785 |
+
}
|
786 |
+
|
787 |
+
$body = $html->find( 'body', 0 );
|
788 |
+
if ( $body ) {
|
789 |
+
$body->innertext = $body->innertext . $missing_script;
|
790 |
+
}
|
791 |
+
|
792 |
+
$final_html = $html->save();
|
793 |
+
}
|
794 |
+
}
|
795 |
+
return $final_html;
|
796 |
+
}
|
797 |
+
|
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, with full support for WooCommerce and site builders.
|
6 |
-
Version: 1.5.
|
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, with full support for WooCommerce and site builders.
|
6 |
+
Version: 1.5.2
|
7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
8 |
Author URI: https://cozmoslabs.com/
|
9 |
Text Domain: translatepress-multilingual
|
languages/translatepress-multilingual.catalog.php
CHANGED
@@ -25,6 +25,30 @@
|
|
25 |
<?php __("Limit this menu item to the following languages", "translatepress-multilingual"); ?>
|
26 |
<?php __("The Yoast SEO Sitemaps will now contain the default language slug: example.com/en/sitemap_index.xml <br/> This works perfectly, just take it into account when submitting the sitemap to Google.", "translatepress-multilingual"); ?>
|
27 |
<?php __("Post Slug", "translatepress-multilingual"); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
<?php __("An error occurred, please try again.", "translatepress-multilingual"); ?>
|
29 |
<?php __("Your license key expired on %s.", "translatepress-multilingual"); ?>
|
30 |
<?php __("Your license key has been disabled.", "translatepress-multilingual"); ?>
|
@@ -153,6 +177,8 @@
|
|
153 |
<?php __("Free Addons", "translatepress-multilingual"); ?>
|
154 |
<?php __("Extend your translation plugin with these free addons.", "translatepress-multilingual"); ?>
|
155 |
<?php __("Use GET parameter to encode language in the url, replacing the language directory. </br> Your urls will look like this: www.example.com?lang=en", "translatepress-multilingual"); ?>
|
|
|
|
|
156 |
<?php __("Active on this site", "translatepress-multilingual"); ?>
|
157 |
<?php __("Your license is invalid", "translatepress-multilingual"); ?>
|
158 |
<?php __("If you do not have any of the <a href=\"%s\">Advanced or Pro Addons</a> activated you do not need a license key", "translatepress-multilingual"); ?>
|
@@ -167,7 +193,6 @@
|
|
167 |
<?php __("replace the default flag", "translatepress-multilingual"); ?>
|
168 |
<?php __("Native language name", "translatepress-multilingual"); ?>
|
169 |
<?php __("No", "translatepress-multilingual"); ?>
|
170 |
-
<?php __("Yes", "translatepress-multilingual"); ?>
|
171 |
<?php __("Select Yes if you want to display languages in their native names. Otherwise, languages will be displayed in English.", "translatepress-multilingual"); ?>
|
172 |
<?php __("Use a subdirectory for the default language", "translatepress-multilingual"); ?>
|
173 |
<?php __("Select Yes if you want to add the subdirectory in the URL for the default language.</br>By selecting Yes, the default language seen by website visitors will become the first one in the \"All Languages\" list.", "translatepress-multilingual"); ?>
|
25 |
<?php __("Limit this menu item to the following languages", "translatepress-multilingual"); ?>
|
26 |
<?php __("The Yoast SEO Sitemaps will now contain the default language slug: example.com/en/sitemap_index.xml <br/> This works perfectly, just take it into account when submitting the sitemap to Google.", "translatepress-multilingual"); ?>
|
27 |
<?php __("Post Slug", "translatepress-multilingual"); ?>
|
28 |
+
<?php __("Disable dynamic translation", "translatepress-multilingual"); ?>
|
29 |
+
<?php __("It disables detection of strings displayed dynamically using JavaScript. <br/>Strings loaded via a server side AJAX call will still be translated.", "translatepress-multilingual"); ?>
|
30 |
+
<?php __("Automatically translate slugs", "translatepress-multilingual"); ?>
|
31 |
+
<?php __("Generate automatic translations of slugs for posts, pages and Custom Post Types.<br/>Requires <a href=\"https://translatepress.com/docs/addons/seo-pack/\" title=\"TranslatePress Add-on SEO Pack documentation\" target=\"_blank\"> SEO Pack Add-on</a> to be installed and activated.", "translatepress-multilingual"); ?>
|
32 |
+
<?php __("Gettext String", "translatepress-multilingual"); ?>
|
33 |
+
<?php __("Domain", "translatepress-multilingual"); ?>
|
34 |
+
<?php __("Exclude Gettext Strings", "translatepress-multilingual"); ?>
|
35 |
+
<?php __("Exclude these strings from being translated as Gettext strings. <br/>Can still be translated as regular strings.", "translatepress-multilingual"); ?>
|
36 |
+
<?php __("Fix broken HTML", "translatepress-multilingual"); ?>
|
37 |
+
<?php __("General attempt to fix broken or missing HTML on translated pages.<br/><strong>Only try this if the \"Fix spaces between html attribute\" did not solve the issue.</strong>", "translatepress-multilingual"); ?>
|
38 |
+
<?php __("Fix spaces between HTML attributes", "translatepress-multilingual"); ?>
|
39 |
+
<?php __("Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages.", "translatepress-multilingual"); ?>
|
40 |
+
<?php __("Show dynamic content before translation", "translatepress-multilingual"); ?>
|
41 |
+
<?php __("Shows dynamically inserted content in original language for a moment before the translation request is finished. <br> May help fix missing content inserted using JavaScript.", "translatepress-multilingual"); ?>
|
42 |
+
<?php __("Selector", "translatepress-multilingual"); ?>
|
43 |
+
<?php __("Exclude from dynamic translation", "translatepress-multilingual"); ?>
|
44 |
+
<?php __("Do not dynamically translate strings that are found in html nodes matching these selectors.<br>Excludes all the children of HTML nodes matching these selectors from being translated using JavaScript.<br/>These strings will still be translated on the server side if possible.", "translatepress-multilingual"); ?>
|
45 |
+
<?php __("Filter Gettext wrapping from post content and title", "translatepress-multilingual"); ?>
|
46 |
+
<?php __("Filters gettext wrapping such as #!trpst#trp-gettext from all updated post content and post title. Does not affect previous post content. <br/><strong>Database backup is recommended before switching on.</strong>", "translatepress-multilingual"); ?>
|
47 |
+
<?php __("Filter Gettext wrapping from post meta", "translatepress-multilingual"); ?>
|
48 |
+
<?php __("Filters gettext wrapping such as #!trpst#trp-gettext from all updated post meta. Does not affect previous post meta. <br/><strong>Database backup is recommended before switching on.</strong>", "translatepress-multilingual"); ?>
|
49 |
+
<?php __("Advanced", "translatepress-multilingual"); ?>
|
50 |
+
<?php __("Yes", "translatepress-multilingual"); ?>
|
51 |
+
<?php __("Are you sure you want to remove this item?", "translatepress-multilingual"); ?>
|
52 |
<?php __("An error occurred, please try again.", "translatepress-multilingual"); ?>
|
53 |
<?php __("Your license key expired on %s.", "translatepress-multilingual"); ?>
|
54 |
<?php __("Your license key has been disabled.", "translatepress-multilingual"); ?>
|
177 |
<?php __("Free Addons", "translatepress-multilingual"); ?>
|
178 |
<?php __("Extend your translation plugin with these free addons.", "translatepress-multilingual"); ?>
|
179 |
<?php __("Use GET parameter to encode language in the url, replacing the language directory. </br> Your urls will look like this: www.example.com?lang=en", "translatepress-multilingual"); ?>
|
180 |
+
<?php __("TranslatePress Advanced Settings", "translatepress-multilingual"); ?>
|
181 |
+
<?php __("Save Changes", "translatepress-multilingual"); ?>
|
182 |
<?php __("Active on this site", "translatepress-multilingual"); ?>
|
183 |
<?php __("Your license is invalid", "translatepress-multilingual"); ?>
|
184 |
<?php __("If you do not have any of the <a href=\"%s\">Advanced or Pro Addons</a> activated you do not need a license key", "translatepress-multilingual"); ?>
|
193 |
<?php __("replace the default flag", "translatepress-multilingual"); ?>
|
194 |
<?php __("Native language name", "translatepress-multilingual"); ?>
|
195 |
<?php __("No", "translatepress-multilingual"); ?>
|
|
|
196 |
<?php __("Select Yes if you want to display languages in their native names. Otherwise, languages will be displayed in English.", "translatepress-multilingual"); ?>
|
197 |
<?php __("Use a subdirectory for the default language", "translatepress-multilingual"); ?>
|
198 |
<?php __("Select Yes if you want to add the subdirectory in the URL for the default language.</br>By selecting Yes, the default language seen by website visitors will become the first one in the \"All Languages\" list.", "translatepress-multilingual"); ?>
|
languages/translatepress-multilingual.pot
CHANGED
@@ -89,7 +89,7 @@ msgstr ""
|
|
89 |
msgid "Are you sure you want to remove this language?"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:43, ../translatepress/partials/main-settings-language-selector.php:40
|
93 |
msgid "Remove"
|
94 |
msgstr ""
|
95 |
|
@@ -97,7 +97,7 @@ msgstr ""
|
|
97 |
msgid "Choose..."
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:58, ../translatepress/partials/main-settings-language-selector.php:55
|
101 |
msgid "Add"
|
102 |
msgstr ""
|
103 |
|
@@ -117,6 +117,102 @@ msgstr ""
|
|
117 |
msgid "Post Slug"
|
118 |
msgstr ""
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:681, ../translatepress/includes/class-edd-sl-plugin-updater.php:713, ../translatepress/includes/class-edd-sl-plugin-updater.php:784
|
121 |
msgid "An error occurred, please try again."
|
122 |
msgstr ""
|
@@ -209,19 +305,19 @@ msgstr ""
|
|
209 |
msgid "Translate Site"
|
210 |
msgstr ""
|
211 |
|
212 |
-
#: ../translatepress/includes/class-settings.php:
|
213 |
msgid "Addons"
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: ../translatepress/includes/class-settings.php:
|
217 |
msgid "License"
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: ../translatepress/includes/class-settings.php:
|
221 |
msgid "Settings"
|
222 |
msgstr ""
|
223 |
|
224 |
-
#: ../translatepress/includes/class-settings.php:
|
225 |
msgid "Pro Features"
|
226 |
msgstr ""
|
227 |
|
@@ -629,6 +725,14 @@ msgstr ""
|
|
629 |
msgid "Use GET parameter to encode language in the url, replacing the language directory. </br> Your urls will look like this: www.example.com?lang=en"
|
630 |
msgstr ""
|
631 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
632 |
#: ../translatepress/partials/license-settings-page.php:25
|
633 |
msgid "Active on this site"
|
634 |
msgstr ""
|
@@ -685,10 +789,6 @@ msgstr ""
|
|
685 |
msgid "No"
|
686 |
msgstr ""
|
687 |
|
688 |
-
#: ../translatepress/partials/main-settings-page.php:41, ../translatepress/partials/main-settings-page.php:54, ../translatepress/partials/main-settings-page.php:67, ../translatepress/partials/main-settings-page.php:80
|
689 |
-
msgid "Yes"
|
690 |
-
msgstr ""
|
691 |
-
|
692 |
#: ../translatepress/partials/main-settings-page.php:44
|
693 |
msgid "Select Yes if you want to display languages in their native names. Otherwise, languages will be displayed in English."
|
694 |
msgstr ""
|
89 |
msgid "Are you sure you want to remove this language?"
|
90 |
msgstr ""
|
91 |
|
92 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:43, ../translatepress/includes/class-advanced-tab.php:206, ../translatepress/includes/class-advanced-tab.php:216, ../translatepress/partials/main-settings-language-selector.php:40
|
93 |
msgid "Remove"
|
94 |
msgstr ""
|
95 |
|
97 |
msgid "Choose..."
|
98 |
msgstr ""
|
99 |
|
100 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:58, ../translatepress/includes/class-advanced-tab.php:216, ../translatepress/partials/main-settings-language-selector.php:55
|
101 |
msgid "Add"
|
102 |
msgstr ""
|
103 |
|
117 |
msgid "Post Slug"
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: ../translatepress/includes/advanced-settings/disable-dynamic-translation.php:8
|
121 |
+
msgid "Disable dynamic translation"
|
122 |
+
msgstr ""
|
123 |
+
|
124 |
+
#: ../translatepress/includes/advanced-settings/disable-dynamic-translation.php:9
|
125 |
+
msgid "It disables detection of strings displayed dynamically using JavaScript. <br/>Strings loaded via a server side AJAX call will still be translated."
|
126 |
+
msgstr ""
|
127 |
+
|
128 |
+
#: ../translatepress/includes/advanced-settings/enable-auto-translate-slug.php:8
|
129 |
+
msgid "Automatically translate slugs"
|
130 |
+
msgstr ""
|
131 |
+
|
132 |
+
#: ../translatepress/includes/advanced-settings/enable-auto-translate-slug.php:9
|
133 |
+
msgid "Generate automatic translations of slugs for posts, pages and Custom Post Types.<br/>Requires <a href=\"https://translatepress.com/docs/addons/seo-pack/\" title=\"TranslatePress Add-on SEO Pack documentation\" target=\"_blank\"> SEO Pack Add-on</a> to be installed and activated."
|
134 |
+
msgstr ""
|
135 |
+
|
136 |
+
#: ../translatepress/includes/advanced-settings/exclude-gettext-strings.php:9
|
137 |
+
msgid "Gettext String"
|
138 |
+
msgstr ""
|
139 |
+
|
140 |
+
#: ../translatepress/includes/advanced-settings/exclude-gettext-strings.php:10
|
141 |
+
msgid "Domain"
|
142 |
+
msgstr ""
|
143 |
+
|
144 |
+
#: ../translatepress/includes/advanced-settings/exclude-gettext-strings.php:12
|
145 |
+
msgid "Exclude Gettext Strings"
|
146 |
+
msgstr ""
|
147 |
+
|
148 |
+
#: ../translatepress/includes/advanced-settings/exclude-gettext-strings.php:13
|
149 |
+
msgid "Exclude these strings from being translated as Gettext strings. <br/>Can still be translated as regular strings."
|
150 |
+
msgstr ""
|
151 |
+
|
152 |
+
#: ../translatepress/includes/advanced-settings/fix-broken-html.php:8
|
153 |
+
msgid "Fix broken HTML"
|
154 |
+
msgstr ""
|
155 |
+
|
156 |
+
#: ../translatepress/includes/advanced-settings/fix-broken-html.php:9
|
157 |
+
msgid "General attempt to fix broken or missing HTML on translated pages.<br/><strong>Only try this if the \"Fix spaces between html attribute\" did not solve the issue.</strong>"
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
#: ../translatepress/includes/advanced-settings/fix-invalid-space-between-html-attr.php:8
|
161 |
+
msgid "Fix spaces between HTML attributes"
|
162 |
+
msgstr ""
|
163 |
+
|
164 |
+
#: ../translatepress/includes/advanced-settings/fix-invalid-space-between-html-attr.php:9
|
165 |
+
msgid "Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages."
|
166 |
+
msgstr ""
|
167 |
+
|
168 |
+
#: ../translatepress/includes/advanced-settings/show-dynamic-content-before-translation.php:8
|
169 |
+
msgid "Show dynamic content before translation"
|
170 |
+
msgstr ""
|
171 |
+
|
172 |
+
#: ../translatepress/includes/advanced-settings/show-dynamic-content-before-translation.php:9
|
173 |
+
msgid "Shows dynamically inserted content in original language for a moment before the translation request is finished. <br> May help fix missing content inserted using JavaScript."
|
174 |
+
msgstr ""
|
175 |
+
|
176 |
+
#: ../translatepress/includes/advanced-settings/skip-dynamic-selectors.php:9
|
177 |
+
msgid "Selector"
|
178 |
+
msgstr ""
|
179 |
+
|
180 |
+
#: ../translatepress/includes/advanced-settings/skip-dynamic-selectors.php:11
|
181 |
+
msgid "Exclude from dynamic translation"
|
182 |
+
msgstr ""
|
183 |
+
|
184 |
+
#: ../translatepress/includes/advanced-settings/skip-dynamic-selectors.php:12
|
185 |
+
msgid "Do not dynamically translate strings that are found in html nodes matching these selectors.<br>Excludes all the children of HTML nodes matching these selectors from being translated using JavaScript.<br/>These strings will still be translated on the server side if possible."
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#: ../translatepress/includes/advanced-settings/strip-gettext-post-content.php:7
|
189 |
+
msgid "Filter Gettext wrapping from post content and title"
|
190 |
+
msgstr ""
|
191 |
+
|
192 |
+
#: ../translatepress/includes/advanced-settings/strip-gettext-post-content.php:8
|
193 |
+
msgid "Filters gettext wrapping such as #!trpst#trp-gettext from all updated post content and post title. Does not affect previous post content. <br/><strong>Database backup is recommended before switching on.</strong>"
|
194 |
+
msgstr ""
|
195 |
+
|
196 |
+
#: ../translatepress/includes/advanced-settings/strip-gettext-post-meta.php:8
|
197 |
+
msgid "Filter Gettext wrapping from post meta"
|
198 |
+
msgstr ""
|
199 |
+
|
200 |
+
#: ../translatepress/includes/advanced-settings/strip-gettext-post-meta.php:9
|
201 |
+
msgid "Filters gettext wrapping such as #!trpst#trp-gettext from all updated post meta. Does not affect previous post meta. <br/><strong>Database backup is recommended before switching on.</strong>"
|
202 |
+
msgstr ""
|
203 |
+
|
204 |
+
#: ../translatepress/includes/class-advanced-tab.php:12
|
205 |
+
msgid "Advanced"
|
206 |
+
msgstr ""
|
207 |
+
|
208 |
+
#: ../translatepress/includes/class-advanced-tab.php:160, ../translatepress/partials/main-settings-page.php:41, ../translatepress/partials/main-settings-page.php:54, ../translatepress/partials/main-settings-page.php:67, ../translatepress/partials/main-settings-page.php:80
|
209 |
+
msgid "Yes"
|
210 |
+
msgstr ""
|
211 |
+
|
212 |
+
#: ../translatepress/includes/class-advanced-tab.php:206, ../translatepress/includes/class-advanced-tab.php:216
|
213 |
+
msgid "Are you sure you want to remove this item?"
|
214 |
+
msgstr ""
|
215 |
+
|
216 |
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:681, ../translatepress/includes/class-edd-sl-plugin-updater.php:713, ../translatepress/includes/class-edd-sl-plugin-updater.php:784
|
217 |
msgid "An error occurred, please try again."
|
218 |
msgstr ""
|
305 |
msgid "Translate Site"
|
306 |
msgstr ""
|
307 |
|
308 |
+
#: ../translatepress/includes/class-settings.php:394
|
309 |
msgid "Addons"
|
310 |
msgstr ""
|
311 |
|
312 |
+
#: ../translatepress/includes/class-settings.php:402
|
313 |
msgid "License"
|
314 |
msgstr ""
|
315 |
|
316 |
+
#: ../translatepress/includes/class-settings.php:430, ../translatepress/includes/class-translation-manager.php:265
|
317 |
msgid "Settings"
|
318 |
msgstr ""
|
319 |
|
320 |
+
#: ../translatepress/includes/class-settings.php:434
|
321 |
msgid "Pro Features"
|
322 |
msgstr ""
|
323 |
|
725 |
msgid "Use GET parameter to encode language in the url, replacing the language directory. </br> Your urls will look like this: www.example.com?lang=en"
|
726 |
msgstr ""
|
727 |
|
728 |
+
#: ../translatepress/partials/advanced-settings-page.php:5
|
729 |
+
msgid "TranslatePress Advanced Settings"
|
730 |
+
msgstr ""
|
731 |
+
|
732 |
+
#: ../translatepress/partials/advanced-settings-page.php:11
|
733 |
+
msgid "Save Changes"
|
734 |
+
msgstr ""
|
735 |
+
|
736 |
#: ../translatepress/partials/license-settings-page.php:25
|
737 |
msgid "Active on this site"
|
738 |
msgstr ""
|
789 |
msgid "No"
|
790 |
msgstr ""
|
791 |
|
|
|
|
|
|
|
|
|
792 |
#: ../translatepress/partials/main-settings-page.php:44
|
793 |
msgid "Select Yes if you want to display languages in their native names. Otherwise, languages will be displayed in English."
|
794 |
msgstr ""
|
partials/addons-settings-page.php
CHANGED
@@ -22,8 +22,7 @@
|
|
22 |
<div class="grid-cell" style="overflow:hidden;">
|
23 |
<a href="https://translatepress.com/pricing/" target="_blank"><img src="<?php echo esc_url( plugins_url('../assets/images/multiple_lang_icon.png', __FILE__) ) ?>" alt="Multiple Languages" style="float: left; margin: 0 1.5rem 1.5rem 0;"></a>
|
24 |
<h3><a href=" <?php echo trp_add_affiliate_id_to_link('https://translatepress.com/pricing/?utm_source=wpbackend&utm_medium=clientsite&utm_content=addons_tab&utm_campaign=tpfree') ?> " target="_blank"> Multiple Languages</a></h3>
|
25 |
-
<p><?php _e( 'Add as many languages as you need for your project to go global.<br>
|
26 |
-
Publish your language only when all your translations are done.', 'translatepress-multilingual' );?> </p>
|
27 |
</div>
|
28 |
</div>
|
29 |
|
22 |
<div class="grid-cell" style="overflow:hidden;">
|
23 |
<a href="https://translatepress.com/pricing/" target="_blank"><img src="<?php echo esc_url( plugins_url('../assets/images/multiple_lang_icon.png', __FILE__) ) ?>" alt="Multiple Languages" style="float: left; margin: 0 1.5rem 1.5rem 0;"></a>
|
24 |
<h3><a href=" <?php echo trp_add_affiliate_id_to_link('https://translatepress.com/pricing/?utm_source=wpbackend&utm_medium=clientsite&utm_content=addons_tab&utm_campaign=tpfree') ?> " target="_blank"> Multiple Languages</a></h3>
|
25 |
+
<p><?php _e( 'Add as many languages as you need for your project to go global.<br>Publish your language only when all your translations are done.', 'translatepress-multilingual' );?> </p>
|
|
|
26 |
</div>
|
27 |
</div>
|
28 |
|
partials/advanced-settings-page.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<div id="trp-advanced-settings" class="wrap">
|
3 |
+
<form method="post" action="options.php">
|
4 |
+
<?php settings_fields( 'trp_advanced_settings' ); ?>
|
5 |
+
<h1> <?php esc_html_e( 'TranslatePress Advanced Settings', 'translatepress-multilingual' );?></h1>
|
6 |
+
<?php do_action ( 'trp_settings_navigation_tabs' ); ?>
|
7 |
+
|
8 |
+
<table id="trp-options" class="form-table">
|
9 |
+
<?php do_action('trp_output_advanced_settings_options' ); ?>
|
10 |
+
</table>
|
11 |
+
<?php submit_button( __( 'Save Changes', 'translatepress-multilingual' ) ); ?>
|
12 |
+
</form>
|
13 |
+
</div>
|
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.2.2
|
7 |
Requires PHP: 5.6.20
|
8 |
-
Stable tag: 1.5.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -142,6 +142,11 @@ For more information please check out [TranslatePress - Multilingual plugin docu
|
|
142 |
|
143 |
|
144 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
145 |
= 1.5.1 =
|
146 |
* Added maximum possible size to srcset for translated images
|
147 |
* Added compatibility with Query Monitor plugin
|
@@ -514,42 +519,3 @@ For more information please check out [TranslatePress - Multilingual plugin docu
|
|
514 |
|
515 |
= 1.0.0 =
|
516 |
* Initial release.
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
1.5.1
|
521 |
-
d213c69 Fixed previous commit on placeholder
|
522 |
-
db1c2ef Merged in iss6118 (pull request #225)
|
523 |
-
3e4bf1c Fixed placeholder attribute not being translated for inputs
|
524 |
-
a74a536 Merged in iss6112 (pull request #224)
|
525 |
-
7f322d7 Use wp_strip_all_tags instead of strip_tags for trimming translation blocks
|
526 |
-
4d0f6ee internationalized the account page
|
527 |
-
bb2d4cf Merged in iss6076 (pull request #223)
|
528 |
-
b70c061 Add filter to allow translation of href as an exception. Fixed trpTranslator in iframe not adding GET preview paramater when dynamic detection is disabled
|
529 |
-
418e26d Merge branch 'master' of bitbucket.org:cozmoslabs/translatepress
|
530 |
-
8fc9eb6 modified some strgings
|
531 |
-
5abc297 Merged in iss6084 (pull request #222)
|
532 |
-
c330958 Fiexd variable trpTranslator is undefined when dynamic detection is turned off by filter
|
533 |
-
6c41e99 Merged in iss6083 (pull request #221)
|
534 |
-
9ac9a0d Updated comment
|
535 |
-
4980236 Fixed translate-dom-changes not working in Editor when viewing as logged out
|
536 |
-
b4d1049 Merged in iss6088 (pull request #220)
|
537 |
-
a466ddf modify just the subject and message is they exist in wp_mail filter with translatepress
|
538 |
-
e8b9d1a Merged in iss6029 (pull request #219)
|
539 |
-
344fbd5 Fixed custom WooCommerce permalinks not working on translated products
|
540 |
-
dcc6dac Merged in iss6059 (pull request #218)
|
541 |
-
a53dc2b Fixed page title not being translated in live mode
|
542 |
-
17c40b9 removed an unwanted file and small readme changes
|
543 |
-
0e06384 update readme.txt to include image translation
|
544 |
-
0be0f51 Merged in iss6048 (pull request #217)
|
545 |
-
d964287 Fix pencil icon not showing for WooCommerce product images in Shop page on Hestia
|
546 |
-
3bc9c2a Merged in iss6051 (pull request #216)
|
547 |
-
9a0bcb3 Fixed title not being translated
|
548 |
-
07b0a77 Merged in iss6002 (pull request #215)
|
549 |
-
7f69260 Added compatibility with Query Monitor
|
550 |
-
ea400a3 Merged in iss6003 (pull request #214)
|
551 |
-
160c1a4 Fixed Translation block created in secondary language didn't work when strings are already translated
|
552 |
-
e15f6cd Merge branch 'master' of bitbucket.org:cozmoslabs/translatepress
|
553 |
-
10ab44e handle the case in which the user did not enter a licence but has active pro addons for license notices
|
554 |
-
1db7f92 Merged in iss6016 (pull request #213)
|
555 |
-
9490c54 Added maximum possible sizes to srcset of translated images
|
5 |
Requires at least: 3.1.0
|
6 |
Tested up to: 5.2.2
|
7 |
Requires PHP: 5.6.20
|
8 |
+
Stable tag: 1.5.2
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
142 |
|
143 |
|
144 |
== Changelog ==
|
145 |
+
= 1.5.2 =
|
146 |
+
* Fixed blank page when opening Translation Editor in some localized languages
|
147 |
+
* Added -Advanced- tab with various custom settings
|
148 |
+
* Added compatibility to allow translating SeedProd plugin Coming Soon page
|
149 |
+
|
150 |
= 1.5.1 =
|
151 |
* Added maximum possible size to srcset for translated images
|
152 |
* Added compatibility with Query Monitor plugin
|
519 |
|
520 |
= 1.0.0 =
|
521 |
* Initial release.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|