Version Description
- Speed improvements
- Remove notices from Editor when we don't have translation languages
- Fixed notices with referrer in translator machine
- Fixed issues with urls in other languages
- Fix issue of nested gettext resulting in unwanted characters
- Strip gettext tags from urls run through sanitize_title and esc_url
- Set caching calls non-persistent. Doesn't work with object caching otherwise
- Set lang attribute in html tag all the time including when on default language
- Refactored the way we translate json
- Fixed issue with Woocommerce ajax calls
Download this release
Release Info
| Developer | madalin.ungureanu |
| Plugin | |
| Version | 1.3.8 |
| Comparing to | |
| See all releases | |
Code changes from version 1.3.7 to 1.3.8
- assets/js/trp-editor-script.js +12 -5
- assets/js/trp-translate-dom-changes.js +1 -1
- class-translate-press.php +7 -1
- includes/class-machine-translator.php +2 -1
- includes/class-translation-manager.php +76 -22
- includes/class-translation-render.php +66 -50
- includes/class-url-converter.php +15 -8
- includes/functions.php +0 -22
- index.php +2 -2
- languages/translatepress-multilingual.catalog.php +2 -3
- languages/translatepress-multilingual.pot +35 -39
- readme.txt +13 -1
assets/js/trp-editor-script.js
CHANGED
|
@@ -82,11 +82,11 @@ function TRP_Editor(){
|
|
| 82 |
|
| 83 |
_this.update_parent_url();
|
| 84 |
|
| 85 |
-
_this.iframe_strings_lookup();
|
| 86 |
-
|
| 87 |
if ( _this.trp_lister != null ) {
|
| 88 |
_this.jquery_string_selector.off( 'change', _this.trp_lister.select_string );
|
| 89 |
}
|
|
|
|
|
|
|
| 90 |
_this.trp_lister = new TRP_Lister( dictionaries[trp_on_screen_language] );
|
| 91 |
|
| 92 |
if ( _this.change_tracker != null ) {
|
|
@@ -148,7 +148,10 @@ function TRP_Editor(){
|
|
| 148 |
_this.ajax_get_strings( strings_to_query );
|
| 149 |
}
|
| 150 |
else{
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
| 152 |
}
|
| 153 |
};
|
| 154 |
|
|
@@ -1525,7 +1528,7 @@ jQuery( function() {
|
|
| 1525 |
var gettext_dictionaries = null;
|
| 1526 |
jQuery(function(){
|
| 1527 |
/* initial load and populate the dropdown with gettext strings */
|
| 1528 |
-
|
| 1529 |
/* get the gettext texts ids from the page and pass them to a ajax call to construct the dictonaries */
|
| 1530 |
var gettext_strings = jQuery( '#trp-preview-iframe').contents().find( '[data-trpgettextoriginal]' );
|
| 1531 |
gettext_string_ids = [];
|
|
@@ -1597,7 +1600,11 @@ jQuery(function(){
|
|
| 1597 |
|
| 1598 |
|
| 1599 |
|
| 1600 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1601 |
|
| 1602 |
/* handle saving gettext strings */
|
| 1603 |
jQuery( '#trp-editor' ).on( 'click', '#trp-save-gettext', function(){
|
| 82 |
|
| 83 |
_this.update_parent_url();
|
| 84 |
|
|
|
|
|
|
|
| 85 |
if ( _this.trp_lister != null ) {
|
| 86 |
_this.jquery_string_selector.off( 'change', _this.trp_lister.select_string );
|
| 87 |
}
|
| 88 |
+
_this.iframe_strings_lookup();
|
| 89 |
+
|
| 90 |
_this.trp_lister = new TRP_Lister( dictionaries[trp_on_screen_language] );
|
| 91 |
|
| 92 |
if ( _this.change_tracker != null ) {
|
| 148 |
_this.ajax_get_strings( strings_to_query );
|
| 149 |
}
|
| 150 |
else{
|
| 151 |
+
_this.trp_lister = new TRP_Lister( new TRP_Dictionary( trp_language ) );
|
| 152 |
+
_this.trp_lister.reload_list();
|
| 153 |
+
_this.change_tracker = new TRP_Change_Tracker( _this.original_textarea, translated_textareas );
|
| 154 |
+
_this.saved_translation_ui( true );
|
| 155 |
}
|
| 156 |
};
|
| 157 |
|
| 1528 |
var gettext_dictionaries = null;
|
| 1529 |
jQuery(function(){
|
| 1530 |
/* initial load and populate the dropdown with gettext strings */
|
| 1531 |
+
function trp_initialize_gettext() {
|
| 1532 |
/* get the gettext texts ids from the page and pass them to a ajax call to construct the dictonaries */
|
| 1533 |
var gettext_strings = jQuery( '#trp-preview-iframe').contents().find( '[data-trpgettextoriginal]' );
|
| 1534 |
gettext_string_ids = [];
|
| 1600 |
|
| 1601 |
|
| 1602 |
|
| 1603 |
+
}
|
| 1604 |
+
//trp_initialize_gettext();
|
| 1605 |
+
//jQuery( "#trp-preview-iframe" ).load(function(){
|
| 1606 |
+
jQuery( "#trp-preview-iframe" ).load( trp_initialize_gettext );
|
| 1607 |
+
jQuery( "#trp-preview-iframe" ).on( 'trp_page_loaded', trp_initialize_gettext );
|
| 1608 |
|
| 1609 |
/* handle saving gettext strings */
|
| 1610 |
jQuery( '#trp-editor' ).on( 'click', '#trp-save-gettext', function(){
|
assets/js/trp-translate-dom-changes.js
CHANGED
|
@@ -268,7 +268,7 @@ function TRP_Translator(){
|
|
| 268 |
if( window.parent.jQuery('#trp-preview-iframe').length != 0 ) {
|
| 269 |
var settingsdata = "" + settings.data;
|
| 270 |
if( typeof settings.data == 'undefined' || jQuery.isEmptyObject( settings.data ) || settingsdata.indexOf('action=trp_') === -1 ) {
|
| 271 |
-
window.parent.jQuery('#trp-preview-iframe').trigger('
|
| 272 |
jQuery( window ).trigger('trp_page_loaded');
|
| 273 |
}
|
| 274 |
}
|
| 268 |
if( window.parent.jQuery('#trp-preview-iframe').length != 0 ) {
|
| 269 |
var settingsdata = "" + settings.data;
|
| 270 |
if( typeof settings.data == 'undefined' || jQuery.isEmptyObject( settings.data ) || settingsdata.indexOf('action=trp_') === -1 ) {
|
| 271 |
+
window.parent.jQuery('#trp-preview-iframe').trigger('trp_page_loaded');
|
| 272 |
jQuery( window ).trigger('trp_page_loaded');
|
| 273 |
}
|
| 274 |
}
|
class-translate-press.php
CHANGED
|
@@ -40,7 +40,9 @@ class TRP_Translate_Press{
|
|
| 40 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
| 41 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
| 42 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
| 43 |
-
define( 'TRP_PLUGIN_VERSION', '1.3.
|
|
|
|
|
|
|
| 44 |
|
| 45 |
$this->load_dependencies();
|
| 46 |
$this->initialize_components();
|
|
@@ -186,6 +188,10 @@ class TRP_Translate_Press{
|
|
| 186 |
|
| 187 |
/* we need to treat the date_i18n function differently so we remove the gettext wraps */
|
| 188 |
$this->loader->add_filter( 'date_i18n', $this->translation_manager, 'handle_date_i18n_function_for_gettext', 1, 4 );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
|
| 190 |
/* define an update hook here */
|
| 191 |
$this->loader->add_action( 'plugins_loaded', $this->query, 'check_for_necessary_updates', 10 );
|
| 40 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
| 41 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
| 42 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
| 43 |
+
define( 'TRP_PLUGIN_VERSION', '1.3.8' );
|
| 44 |
+
|
| 45 |
+
wp_cache_add_non_persistent_groups(array('trp'));
|
| 46 |
|
| 47 |
$this->load_dependencies();
|
| 48 |
$this->initialize_components();
|
| 188 |
|
| 189 |
/* we need to treat the date_i18n function differently so we remove the gettext wraps */
|
| 190 |
$this->loader->add_filter( 'date_i18n', $this->translation_manager, 'handle_date_i18n_function_for_gettext', 1, 4 );
|
| 191 |
+
/* strip esc_url() from gettext wraps */
|
| 192 |
+
$this->loader->add_filter( 'clean_url', $this->translation_manager, 'trp_strip_gettext_tags_from_esc_url', 1, 3 );
|
| 193 |
+
/* strip sanitize_title() from gettext wraps and apply custom trp_remove_accents */
|
| 194 |
+
$this->loader->add_filter( 'sanitize_title', $this->translation_manager, 'trp_sanitize_title', 1, 3 );
|
| 195 |
|
| 196 |
/* define an update hook here */
|
| 197 |
$this->loader->add_action( 'plugins_loaded', $this->query, 'check_for_necessary_updates', 10 );
|
includes/class-machine-translator.php
CHANGED
|
@@ -7,7 +7,8 @@
|
|
| 7 |
*/
|
| 8 |
class TRP_Machine_Translator{
|
| 9 |
protected $settings;
|
| 10 |
-
|
|
|
|
| 11 |
/**
|
| 12 |
* TRP_Machine_Translator constructor.
|
| 13 |
*
|
| 7 |
*/
|
| 8 |
class TRP_Machine_Translator{
|
| 9 |
protected $settings;
|
| 10 |
+
protected $referer;
|
| 11 |
+
protected $url_converter;
|
| 12 |
/**
|
| 13 |
* TRP_Machine_Translator constructor.
|
| 14 |
*
|
includes/class-translation-manager.php
CHANGED
|
@@ -818,7 +818,7 @@ class TRP_Translation_Manager{
|
|
| 818 |
global $TRP_LANGUAGE;
|
| 819 |
$trp = TRP_Translate_Press::get_trp_instance();
|
| 820 |
$url_converter = $trp->get_component( 'url_converter' );
|
| 821 |
-
$TRP_LANGUAGE = $url_converter
|
| 822 |
if( empty( $TRP_LANGUAGE ) ) {
|
| 823 |
$settings_obj = new TRP_Settings();
|
| 824 |
$settings = $settings_obj->get_settings();
|
|
@@ -836,6 +836,9 @@ class TRP_Translation_Manager{
|
|
| 836 |
* @return string
|
| 837 |
*/
|
| 838 |
public function process_gettext_strings( $translation, $text, $domain ){
|
|
|
|
|
|
|
|
|
|
| 839 |
global $TRP_LANGUAGE;
|
| 840 |
/* don't do anything if we don't have extra languages on the site */
|
| 841 |
if( count( $this->settings['publish-languages'] ) < 1 )
|
|
@@ -908,31 +911,32 @@ class TRP_Translation_Manager{
|
|
| 908 |
}
|
| 909 |
}
|
| 910 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 911 |
$callstack_functions = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
| 912 |
if( !empty( $callstack_functions ) ){
|
| 913 |
foreach( $callstack_functions as $callstack_function ){
|
| 914 |
-
|
| 915 |
-
|
| 916 |
-
|
| 917 |
-
$callstack_function['function'] == 'wp_enqueue_media' ||
|
| 918 |
-
$callstack_function['function'] == 'wp_register_script' ||
|
| 919 |
-
$callstack_function['function'] == 'wp_print_scripts'||
|
| 920 |
-
$callstack_function['function'] == 'wp_localize_script'||
|
| 921 |
-
$callstack_function['function'] == 'wp_print_media_templates' ||
|
| 922 |
-
$callstack_function['function'] == 'get_bloginfo' ||
|
| 923 |
-
$callstack_function['function'] == 'wp_get_document_title' ||
|
| 924 |
-
$callstack_function['function'] == 'wp_title' ||
|
| 925 |
-
$callstack_function['function'] == 'wp_trim_words'
|
| 926 |
-
) {
|
| 927 |
-
return $translation;
|
| 928 |
-
}
|
| 929 |
|
| 930 |
-
|
| 931 |
-
if( $callstack_function['function'] == 'wc_get_permalink_structure' ){
|
| 932 |
-
return $translation;
|
| 933 |
-
}
|
| 934 |
-
|
| 935 |
-
/* make sure we don't touch the woocommerce process_payment function in WC_Gateway_Stripe. It does a wp_remote_post() call to stripe with localized parameters */
|
| 936 |
if( $callstack_function['function'] == 'process_payment' && $callstack_function['class'] == 'WC_Gateway_Stripe' ){
|
| 937 |
return $translation;
|
| 938 |
}
|
|
@@ -1094,6 +1098,56 @@ class TRP_Translation_Manager{
|
|
| 1094 |
|
| 1095 |
}
|
| 1096 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1097 |
/**
|
| 1098 |
* function that strips the gettext tags from a string
|
| 1099 |
* @param $string
|
| 818 |
global $TRP_LANGUAGE;
|
| 819 |
$trp = TRP_Translate_Press::get_trp_instance();
|
| 820 |
$url_converter = $trp->get_component( 'url_converter' );
|
| 821 |
+
$TRP_LANGUAGE = $url_converter->get_lang_from_url_string($referer);
|
| 822 |
if( empty( $TRP_LANGUAGE ) ) {
|
| 823 |
$settings_obj = new TRP_Settings();
|
| 824 |
$settings = $settings_obj->get_settings();
|
| 836 |
* @return string
|
| 837 |
*/
|
| 838 |
public function process_gettext_strings( $translation, $text, $domain ){
|
| 839 |
+
// if we have nested gettexts strip previous ones, and consider only the outermost
|
| 840 |
+
$text = TRP_Translation_Manager::strip_gettext_tags( $text );
|
| 841 |
+
$translation = TRP_Translation_Manager::strip_gettext_tags( $translation );
|
| 842 |
global $TRP_LANGUAGE;
|
| 843 |
/* don't do anything if we don't have extra languages on the site */
|
| 844 |
if( count( $this->settings['publish-languages'] ) < 1 )
|
| 911 |
}
|
| 912 |
}
|
| 913 |
|
| 914 |
+
$blacklist_functions = apply_filters( 'trp_gettext_blacklist_functions', array(
|
| 915 |
+
'wp_enqueue_script',
|
| 916 |
+
'wp_enqueue_scripts',
|
| 917 |
+
'wp_editor',
|
| 918 |
+
'wp_enqueue_media',
|
| 919 |
+
'wp_register_script',
|
| 920 |
+
'wp_print_scripts',
|
| 921 |
+
'wp_localize_script',
|
| 922 |
+
'wp_print_media_templates',
|
| 923 |
+
'get_bloginfo',
|
| 924 |
+
'wp_get_document_title',
|
| 925 |
+
'wp_title',
|
| 926 |
+
'wp_trim_words',
|
| 927 |
+
'sanitize_title',
|
| 928 |
+
'sanitize_title_with_dashes',
|
| 929 |
+
'esc_url',
|
| 930 |
+
'wc_get_permalink_structure' // make sure we don't touch the woocommerce permalink rewrite slugs that are translated
|
| 931 |
+
), $text, $translation, $domain );
|
| 932 |
$callstack_functions = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
| 933 |
if( !empty( $callstack_functions ) ){
|
| 934 |
foreach( $callstack_functions as $callstack_function ){
|
| 935 |
+
if ( in_array( $callstack_function['function'], $blacklist_functions ) ){
|
| 936 |
+
return $translation;
|
| 937 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 938 |
|
| 939 |
+
/* make sure we don't touch the woocommerce process_payment function in WC_Gateway_Stripe. It does a wp_remote_post() call to stripe with localized parameters */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 940 |
if( $callstack_function['function'] == 'process_payment' && $callstack_function['class'] == 'WC_Gateway_Stripe' ){
|
| 941 |
return $translation;
|
| 942 |
}
|
| 1098 |
|
| 1099 |
}
|
| 1100 |
|
| 1101 |
+
/**
|
| 1102 |
+
* Strip gettext tags from urls that were parsed by esc_url
|
| 1103 |
+
*
|
| 1104 |
+
* Esc_url() replaces spaces with %20. This is why it is not automatically stripped like the rest of the urls.
|
| 1105 |
+
*
|
| 1106 |
+
* @since 1.3.8
|
| 1107 |
+
*
|
| 1108 |
+
* @param $good_protocol_url
|
| 1109 |
+
* @param $original_url
|
| 1110 |
+
* @param $_context
|
| 1111 |
+
*
|
| 1112 |
+
* @return mixed
|
| 1113 |
+
*/
|
| 1114 |
+
function trp_strip_gettext_tags_from_esc_url( $good_protocol_url, $original_url, $_context ){
|
| 1115 |
+
if( strpos( $good_protocol_url, '%20data-trpgettextoriginal=' ) !== false ) {
|
| 1116 |
+
// first replace %20 with space so that gettext tags can be stripped.
|
| 1117 |
+
$good_protocol_url = str_replace( '%20data-trpgettextoriginal=', ' data-trpgettextoriginal=', $good_protocol_url );
|
| 1118 |
+
$good_protocol_url = TRP_Translation_Manager::strip_gettext_tags( $good_protocol_url );
|
| 1119 |
+
}
|
| 1120 |
+
|
| 1121 |
+
return $good_protocol_url;
|
| 1122 |
+
}
|
| 1123 |
+
|
| 1124 |
+
/**
|
| 1125 |
+
* Filter sanitize_title() to use our own remove_accents() function so it's based on the default language, not current locale.
|
| 1126 |
+
*
|
| 1127 |
+
* Also removes trp gettext tags before running the filter because it strip # and ! and / making it impossible to strip the #trpst later
|
| 1128 |
+
*
|
| 1129 |
+
* @since 1.3.1
|
| 1130 |
+
*
|
| 1131 |
+
* @param string $title
|
| 1132 |
+
* @param string $raw_title
|
| 1133 |
+
* @param string $context
|
| 1134 |
+
* @return string
|
| 1135 |
+
*/
|
| 1136 |
+
public function trp_sanitize_title( $title, $raw_title, $context ){
|
| 1137 |
+
// remove trp_tags before sanitization, because otherwise some characters (#,!,/, spaces ) are stripped later, and it becomes impossible to strip trp-gettext later
|
| 1138 |
+
$raw_title = TRP_Translation_Manager::strip_gettext_tags( $raw_title );
|
| 1139 |
+
|
| 1140 |
+
if ( 'save' == $context )
|
| 1141 |
+
$title = trp_remove_accents( $raw_title );
|
| 1142 |
+
|
| 1143 |
+
remove_filter( 'sanitize_title', array( $this, 'trp_sanitize_title') , 1 );
|
| 1144 |
+
$title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
|
| 1145 |
+
add_filter( 'sanitize_title', array( $this, 'trp_sanitize_title'), 1, 3 );
|
| 1146 |
+
|
| 1147 |
+
return $title;
|
| 1148 |
+
}
|
| 1149 |
+
|
| 1150 |
+
|
| 1151 |
/**
|
| 1152 |
* function that strips the gettext tags from a string
|
| 1153 |
* @param $string
|
includes/class-translation-render.php
CHANGED
|
@@ -29,7 +29,10 @@ class TRP_Translation_Render{
|
|
| 29 |
public function start_output_buffer(){
|
| 30 |
global $TRP_LANGUAGE;
|
| 31 |
|
| 32 |
-
if
|
|
|
|
|
|
|
|
|
|
| 33 |
return;//we have two cases where we don't do anything: we are on the admin side and we are not in an ajax call or we are in the left side of the translation editor
|
| 34 |
}
|
| 35 |
else {
|
|
@@ -305,17 +308,23 @@ class TRP_Translation_Render{
|
|
| 305 |
if ($language_code === false) {
|
| 306 |
return $output;
|
| 307 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
|
| 309 |
$preview_mode = isset( $_REQUEST['trp-edit-translation'] ) && $_REQUEST['trp-edit-translation'] == 'preview';
|
| 310 |
|
| 311 |
-
|
| 312 |
/* If we have a json response we need to parse it and only translate the nodes that contain html
|
| 313 |
*
|
| 314 |
* Removed is_ajax_on_frontend() check because we need to capture custom ajax events.
|
| 315 |
* Decided that if $output is json decodable it's a good enough check to handle it this way.
|
| 316 |
* We have necessary checks so that we don't get to this point when is_admin(), or when language is not default.
|
| 317 |
*/
|
| 318 |
-
if( $
|
| 319 |
/* if it's one of our own ajax calls don't do nothing */
|
| 320 |
if ( ! empty( $_REQUEST['action'] ) && strpos( $_REQUEST['action'], 'trp_' ) === 0 && $_REQUEST['action'] != 'trp_split_translation_block' ) {
|
| 321 |
return $output;
|
|
@@ -323,27 +332,9 @@ class TRP_Translation_Render{
|
|
| 323 |
|
| 324 |
//check if we have a json response
|
| 325 |
if ( ! empty( $json_array ) ) {
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
$html_decoded_value = html_entity_decode( (string) $value );
|
| 330 |
-
if ( $html_decoded_value != strip_tags( $html_decoded_value ) ) {
|
| 331 |
-
$json_array[ $key ] = $this->translate_page( stripslashes( $value ) );
|
| 332 |
-
}
|
| 333 |
-
} else {//look for the html elements
|
| 334 |
-
foreach ( $value as $k => $v ) {
|
| 335 |
-
if ( ! empty( $v ) ) {
|
| 336 |
-
if ( ! is_array( $v ) ) {
|
| 337 |
-
$html_decoded_v = html_entity_decode( (string) $v );
|
| 338 |
-
if ( $html_decoded_v != strip_tags( $html_decoded_v ) ) {
|
| 339 |
-
$json_array[ $key ][ $k ] = $this->translate_page( stripslashes( $v ) );
|
| 340 |
-
}
|
| 341 |
-
}
|
| 342 |
-
}
|
| 343 |
-
}
|
| 344 |
-
}
|
| 345 |
-
}
|
| 346 |
-
}
|
| 347 |
}
|
| 348 |
|
| 349 |
return trp_safe_json_encode( $json_array );
|
|
@@ -374,13 +365,14 @@ class TRP_Translation_Render{
|
|
| 374 |
if ( ! $this->translation_manager ) {
|
| 375 |
$this->translation_manager = $trp->get_component( 'translation_manager' );
|
| 376 |
}
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
$all_existing_translation_blocks
|
|
|
|
|
|
|
|
|
|
| 381 |
}
|
| 382 |
-
$merge_rules = $this->translation_manager->get_merge_rules();
|
| 383 |
-
|
| 384 |
$html = trp_str_get_html($output, true, true, TRP_DEFAULT_TARGET_CHARSET, false, TRP_DEFAULT_BR_TEXT, TRP_DEFAULT_SPAN_TEXT);
|
| 385 |
|
| 386 |
/**
|
|
@@ -402,28 +394,29 @@ class TRP_Translation_Render{
|
|
| 402 |
}
|
| 403 |
else{
|
| 404 |
$trp_attr_rows[] = $row;
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
|
|
|
| 415 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
}
|
| 417 |
-
if ( !$found_inner_translation_block ) {
|
| 418 |
-
// make sure we find it later exactly the way it is in DB
|
| 419 |
-
$row->innertext = $translation_block->original;
|
| 420 |
-
$row->setAttribute( 'class', $existing_classes . ' translation-block' );
|
| 421 |
-
}
|
| 422 |
-
}else if ( $preview_mode && $translation_block->block_type == 2 && $translation_block->status != 0 ) {
|
| 423 |
-
// refactor to not do this for each
|
| 424 |
-
$row->setAttribute( 'data-trp-translate-id', $translation_block->id );
|
| 425 |
-
$row->setAttribute( 'data-trp-translate-id-deprecated', $translation_block->id );
|
| 426 |
-
$row->setAttribute( 'class', $existing_classes . 'trp-deprecated-tb' );
|
| 427 |
}
|
| 428 |
}
|
| 429 |
|
|
@@ -491,6 +484,11 @@ class TRP_Translation_Render{
|
|
| 491 |
/* perform preg replace on the remaining trp-gettext tags */
|
| 492 |
$trpremoved = preg_replace( '/(<|<)trp-gettext (.*?)(>|>)/', '', $trpremoved );
|
| 493 |
$trpremoved = preg_replace( '/(<|<)(\\\\)*\/trp-gettext(>|>)/', '', $trpremoved );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 494 |
$html = trp_str_get_html($trpremoved, true, true, TRP_DEFAULT_TARGET_CHARSET, false, TRP_DEFAULT_BR_TEXT, TRP_DEFAULT_SPAN_TEXT);
|
| 495 |
|
| 496 |
$no_translate_selectors = apply_filters( 'trp_no_translate_selectors', array( '#wpadminbar' ), $TRP_LANGUAGE );
|
|
@@ -734,6 +732,22 @@ class TRP_Translation_Render{
|
|
| 734 |
return $html->save();
|
| 735 |
}
|
| 736 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 737 |
/**
|
| 738 |
* Function that should be called only on the default language and when we are not in the editor mode and it is designed as a fallback to clear
|
| 739 |
* any trp gettext tags that we added and for some reason show up although they should not
|
|
@@ -1088,6 +1102,8 @@ class TRP_Translation_Render{
|
|
| 1088 |
if ( TRP_Translation_Manager::is_ajax_on_frontend() && isset( $_REQUEST['trp-edit-translation'] ) && $_REQUEST['trp-edit-translation'] === 'preview' && $output != false ) {
|
| 1089 |
$result = json_decode($output, TRUE);
|
| 1090 |
if ( json_last_error() === JSON_ERROR_NONE) {
|
|
|
|
|
|
|
| 1091 |
array_walk_recursive($result, array($this, 'callback_add_preview_arg'));
|
| 1092 |
$output = trp_safe_json_encode($result);
|
| 1093 |
} //endif
|
| 29 |
public function start_output_buffer(){
|
| 30 |
global $TRP_LANGUAGE;
|
| 31 |
|
| 32 |
+
//when we check if is an ajax request in frontend we also set proper REQUEST variables and language global so we need to run this for every buffer
|
| 33 |
+
$ajax_on_frontend = TRP_Translation_Manager::is_ajax_on_frontend();//TODO refactor this function si it just checks and does not set variables
|
| 34 |
+
|
| 35 |
+
if( ( is_admin() && !$ajax_on_frontend ) || trp_is_translation_editor( 'true' ) ){
|
| 36 |
return;//we have two cases where we don't do anything: we are on the admin side and we are not in an ajax call or we are in the left side of the translation editor
|
| 37 |
}
|
| 38 |
else {
|
| 308 |
if ($language_code === false) {
|
| 309 |
return $output;
|
| 310 |
}
|
| 311 |
+
if ( $language_code == $this->settings['default-language'] ){
|
| 312 |
+
// Don't translate regular strings (non-gettext) when we have no other translation languages except default language ( count( $this->settings['publish-languages'] ) > 1 )
|
| 313 |
+
$translate_normal_strings = false;
|
| 314 |
+
}else{
|
| 315 |
+
$translate_normal_strings = true;
|
| 316 |
+
}
|
| 317 |
|
| 318 |
$preview_mode = isset( $_REQUEST['trp-edit-translation'] ) && $_REQUEST['trp-edit-translation'] == 'preview';
|
| 319 |
|
| 320 |
+
$json_array = json_decode( $output, true );
|
| 321 |
/* If we have a json response we need to parse it and only translate the nodes that contain html
|
| 322 |
*
|
| 323 |
* Removed is_ajax_on_frontend() check because we need to capture custom ajax events.
|
| 324 |
* Decided that if $output is json decodable it's a good enough check to handle it this way.
|
| 325 |
* We have necessary checks so that we don't get to this point when is_admin(), or when language is not default.
|
| 326 |
*/
|
| 327 |
+
if( $json_array && $json_array != $output ) {
|
| 328 |
/* if it's one of our own ajax calls don't do nothing */
|
| 329 |
if ( ! empty( $_REQUEST['action'] ) && strpos( $_REQUEST['action'], 'trp_' ) === 0 && $_REQUEST['action'] != 'trp_split_translation_block' ) {
|
| 330 |
return $output;
|
| 332 |
|
| 333 |
//check if we have a json response
|
| 334 |
if ( ! empty( $json_array ) ) {
|
| 335 |
+
if( !is_array( $json_array ) )//make sure we send an array as json_decode even with true parameter might not return one
|
| 336 |
+
$json_array = array( $json_array );
|
| 337 |
+
array_walk_recursive( $json_array, array( $this, 'translate_json' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
}
|
| 339 |
|
| 340 |
return trp_safe_json_encode( $json_array );
|
| 365 |
if ( ! $this->translation_manager ) {
|
| 366 |
$this->translation_manager = $trp->get_component( 'translation_manager' );
|
| 367 |
}
|
| 368 |
+
if ( $translate_normal_strings ) {
|
| 369 |
+
$all_existing_translation_blocks = $this->trp_query->get_all_translation_blocks( $language_code );
|
| 370 |
+
// trim every translation block original now, to avoid over-calling trim function later
|
| 371 |
+
foreach ( $all_existing_translation_blocks as $key => $existing_tb ) {
|
| 372 |
+
$all_existing_translation_blocks[ $key ]->trimmed_original = $this->trim_translation_block( $all_existing_translation_blocks[ $key ]->original );
|
| 373 |
+
}
|
| 374 |
+
$merge_rules = $this->translation_manager->get_merge_rules();
|
| 375 |
}
|
|
|
|
|
|
|
| 376 |
$html = trp_str_get_html($output, true, true, TRP_DEFAULT_TARGET_CHARSET, false, TRP_DEFAULT_BR_TEXT, TRP_DEFAULT_SPAN_TEXT);
|
| 377 |
|
| 378 |
/**
|
| 394 |
}
|
| 395 |
else{
|
| 396 |
$trp_attr_rows[] = $row;
|
| 397 |
+
if ( $translate_normal_strings ) {
|
| 398 |
+
$translation_block = $this->find_translation_block( $row, $all_existing_translation_blocks, $merge_rules );
|
| 399 |
+
if ( $translation_block ) {
|
| 400 |
+
$existing_classes = $row->getAttribute( 'class' );
|
| 401 |
+
if ( $translation_block->block_type == 1 ) {
|
| 402 |
+
$found_inner_translation_block = false;
|
| 403 |
+
foreach ( $row->children() as $child ) {
|
| 404 |
+
if ( $this->find_translation_block( $child, array( $translation_block ), $merge_rules ) != null ) {
|
| 405 |
+
$found_inner_translation_block = true;
|
| 406 |
+
break;
|
| 407 |
+
}
|
| 408 |
}
|
| 409 |
+
if ( ! $found_inner_translation_block ) {
|
| 410 |
+
// make sure we find it later exactly the way it is in DB
|
| 411 |
+
$row->innertext = $translation_block->original;
|
| 412 |
+
$row->setAttribute( 'class', $existing_classes . ' translation-block' );
|
| 413 |
+
}
|
| 414 |
+
} else if ( $preview_mode && $translation_block->block_type == 2 && $translation_block->status != 0 ) {
|
| 415 |
+
// refactor to not do this for each
|
| 416 |
+
$row->setAttribute( 'data-trp-translate-id', $translation_block->id );
|
| 417 |
+
$row->setAttribute( 'data-trp-translate-id-deprecated', $translation_block->id );
|
| 418 |
+
$row->setAttribute( 'class', $existing_classes . 'trp-deprecated-tb' );
|
| 419 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
}
|
| 421 |
}
|
| 422 |
|
| 484 |
/* perform preg replace on the remaining trp-gettext tags */
|
| 485 |
$trpremoved = preg_replace( '/(<|<)trp-gettext (.*?)(>|>)/', '', $trpremoved );
|
| 486 |
$trpremoved = preg_replace( '/(<|<)(\\\\)*\/trp-gettext(>|>)/', '', $trpremoved );
|
| 487 |
+
|
| 488 |
+
if ( ! $translate_normal_strings ) {
|
| 489 |
+
return $trpremoved;
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
$html = trp_str_get_html($trpremoved, true, true, TRP_DEFAULT_TARGET_CHARSET, false, TRP_DEFAULT_BR_TEXT, TRP_DEFAULT_SPAN_TEXT);
|
| 493 |
|
| 494 |
$no_translate_selectors = apply_filters( 'trp_no_translate_selectors', array( '#wpadminbar' ), $TRP_LANGUAGE );
|
| 732 |
return $html->save();
|
| 733 |
}
|
| 734 |
|
| 735 |
+
/**
|
| 736 |
+
* Callback for the array_walk_recursive to translate json. It translates the values in the resulting json array if they contain html
|
| 737 |
+
* @param $value
|
| 738 |
+
*/
|
| 739 |
+
function translate_json (&$value) {
|
| 740 |
+
//check if it a html text and translate
|
| 741 |
+
$html_decoded_value = html_entity_decode( (string) $value );
|
| 742 |
+
if ( $html_decoded_value != strip_tags( $html_decoded_value ) ) {
|
| 743 |
+
$value = $this->translate_page( stripslashes( $value ) );
|
| 744 |
+
/*the translate-press tag can appear on a gettext string without html and should not be left in the json
|
| 745 |
+
as we don't know how it will be inserted into the page by js */
|
| 746 |
+
$value = preg_replace( '/(<|<)translate-press (.*?)(>|>)/', '', $value );
|
| 747 |
+
$value = preg_replace( '/(<|<)(\\\\)*\/translate-press(>|>)/', '', $value );
|
| 748 |
+
}
|
| 749 |
+
}
|
| 750 |
+
|
| 751 |
/**
|
| 752 |
* Function that should be called only on the default language and when we are not in the editor mode and it is designed as a fallback to clear
|
| 753 |
* any trp gettext tags that we added and for some reason show up although they should not
|
| 1102 |
if ( TRP_Translation_Manager::is_ajax_on_frontend() && isset( $_REQUEST['trp-edit-translation'] ) && $_REQUEST['trp-edit-translation'] === 'preview' && $output != false ) {
|
| 1103 |
$result = json_decode($output, TRUE);
|
| 1104 |
if ( json_last_error() === JSON_ERROR_NONE) {
|
| 1105 |
+
if( !is_array( $result ) )//make sure we send an array as json_decode even with true parameter might not return one
|
| 1106 |
+
$result = array($result);
|
| 1107 |
array_walk_recursive($result, array($this, 'callback_add_preview_arg'));
|
| 1108 |
$output = trp_safe_json_encode($result);
|
| 1109 |
} //endif
|
includes/class-url-converter.php
CHANGED
|
@@ -117,7 +117,7 @@ class TRP_Url_Converter {
|
|
| 117 |
public function change_lang_attr_in_html_tag( $output ){
|
| 118 |
global $TRP_LANGUAGE;
|
| 119 |
$lang = get_bloginfo('language');
|
| 120 |
-
if ( $lang && !empty($TRP_LANGUAGE)
|
| 121 |
$output = str_replace( 'lang="'. $lang .'"', 'lang="'. str_replace('_', '-', $TRP_LANGUAGE ) .'"', $output );
|
| 122 |
}
|
| 123 |
|
|
@@ -148,6 +148,7 @@ class TRP_Url_Converter {
|
|
| 148 |
if ( empty( $language ) ) {
|
| 149 |
$language = $TRP_LANGUAGE;
|
| 150 |
}
|
|
|
|
| 151 |
if ( empty($url) ){
|
| 152 |
$url = $this->cur_page_url();
|
| 153 |
}
|
|
@@ -181,10 +182,10 @@ class TRP_Url_Converter {
|
|
| 181 |
return $url . $trp_link_is_processed; // abort for non-http/https links
|
| 182 |
}
|
| 183 |
|
| 184 |
-
if ( $url_obj->isSchemeless() && !$url_obj->getPath()
|
| 185 |
-
trp_bulk_debug($debug, array('url' => $url, 'abort' => "is anchor"));
|
| 186 |
wp_cache_set('get_url_for_language_' . $hash, $url, 'trp');
|
| 187 |
-
return $url; // abort for anchors
|
| 188 |
}
|
| 189 |
|
| 190 |
if ( $url_obj->getHost() && $abs_home_url_obj->getHost() && $url_obj->getHost() != $abs_home_url_obj->getHost() ){
|
|
@@ -211,12 +212,18 @@ class TRP_Url_Converter {
|
|
| 211 |
$post_id = $possible_post_id;
|
| 212 |
trp_bulk_debug($debug, array('url' => $url, 'found post id' => $post_id, 'for language' => $TRP_LANGUAGE));
|
| 213 |
} else {
|
| 214 |
-
// try again but with the default language home_url
|
| 215 |
-
$TRP_LANGUAGE = $this->settings['default-language'];
|
| 216 |
$post_id = url_to_postid( $url );
|
| 217 |
wp_cache_set( 'possible_post_id_' . hash('md4', $url ), $post_id, 'trp' );
|
| 218 |
-
if($post_id){ trp_bulk_debug($debug, array('url' => $url, 'found post id' => $post_id, 'for default language' => $TRP_LANGUAGE)); }
|
| 219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
}
|
| 221 |
|
| 222 |
if( $post_id ){
|
| 117 |
public function change_lang_attr_in_html_tag( $output ){
|
| 118 |
global $TRP_LANGUAGE;
|
| 119 |
$lang = get_bloginfo('language');
|
| 120 |
+
if ( $lang && !empty($TRP_LANGUAGE) ) {
|
| 121 |
$output = str_replace( 'lang="'. $lang .'"', 'lang="'. str_replace('_', '-', $TRP_LANGUAGE ) .'"', $output );
|
| 122 |
}
|
| 123 |
|
| 148 |
if ( empty( $language ) ) {
|
| 149 |
$language = $TRP_LANGUAGE;
|
| 150 |
}
|
| 151 |
+
|
| 152 |
if ( empty($url) ){
|
| 153 |
$url = $this->cur_page_url();
|
| 154 |
}
|
| 182 |
return $url . $trp_link_is_processed; // abort for non-http/https links
|
| 183 |
}
|
| 184 |
|
| 185 |
+
if ( $url_obj->isSchemeless() && !$url_obj->getPath() ){
|
| 186 |
+
trp_bulk_debug($debug, array('url' => $url, 'abort' => "is anchor or has get params"));
|
| 187 |
wp_cache_set('get_url_for_language_' . $hash, $url, 'trp');
|
| 188 |
+
return $url; // abort for anchors or params only.
|
| 189 |
}
|
| 190 |
|
| 191 |
if ( $url_obj->getHost() && $abs_home_url_obj->getHost() && $url_obj->getHost() != $abs_home_url_obj->getHost() ){
|
| 212 |
$post_id = $possible_post_id;
|
| 213 |
trp_bulk_debug($debug, array('url' => $url, 'found post id' => $post_id, 'for language' => $TRP_LANGUAGE));
|
| 214 |
} else {
|
|
|
|
|
|
|
| 215 |
$post_id = url_to_postid( $url );
|
| 216 |
wp_cache_set( 'possible_post_id_' . hash('md4', $url ), $post_id, 'trp' );
|
| 217 |
+
if ( $post_id ) { trp_bulk_debug($debug, array('url' => $url, 'found post id' => $post_id, 'for default language' => $TRP_LANGUAGE)); }
|
| 218 |
+
|
| 219 |
+
if ( $post_id == 0 ) {
|
| 220 |
+
// try again but with the default language home_url
|
| 221 |
+
$TRP_LANGUAGE = $this->settings['default-language'];
|
| 222 |
+
$post_id = url_to_postid( $url );
|
| 223 |
+
wp_cache_set( 'possible_post_id_' . hash('md4', $url ), $post_id, 'trp' );
|
| 224 |
+
if($post_id){ trp_bulk_debug($debug, array('url' => $url, 'found post id' => $post_id, 'for default language' => $TRP_LANGUAGE)); }
|
| 225 |
+
$TRP_LANGUAGE = $trp_language_copy;
|
| 226 |
+
}
|
| 227 |
}
|
| 228 |
|
| 229 |
if( $post_id ){
|
includes/functions.php
CHANGED
|
@@ -304,28 +304,6 @@ function trp_use_home_url_in_peepso_ajax( $data ){
|
|
| 304 |
return $data;
|
| 305 |
}
|
| 306 |
|
| 307 |
-
/**
|
| 308 |
-
* Filter sanitize_title() to use our own remove_accents() function so it's based on the default language, not current locale.
|
| 309 |
-
*
|
| 310 |
-
* @since 1.3.1
|
| 311 |
-
*
|
| 312 |
-
* @param string $title
|
| 313 |
-
* @param string $raw_title
|
| 314 |
-
* @param string $context
|
| 315 |
-
* @return string
|
| 316 |
-
*/
|
| 317 |
-
add_filter( 'sanitize_title', 'trp_sanitize_title', 1, 3 );
|
| 318 |
-
function trp_sanitize_title( $title, $raw_title, $context ){
|
| 319 |
-
|
| 320 |
-
if ( 'save' == $context )
|
| 321 |
-
$title = trp_remove_accents( $raw_title );
|
| 322 |
-
|
| 323 |
-
remove_filter( 'sanitize_title', 'trp_sanitize_title', 1, 3 );
|
| 324 |
-
$title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
|
| 325 |
-
add_filter( 'sanitize_title', 'trp_sanitize_title', 1, 3 );
|
| 326 |
-
|
| 327 |
-
return $title;
|
| 328 |
-
}
|
| 329 |
|
| 330 |
function trp_remove_accents( $string ){
|
| 331 |
|
| 304 |
return $data;
|
| 305 |
}
|
| 306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
|
| 308 |
function trp_remove_accents( $string ){
|
| 309 |
|
index.php
CHANGED
|
@@ -3,14 +3,14 @@
|
|
| 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.3.
|
| 7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
| 8 |
Author URI: https://cozmoslabs.com/
|
| 9 |
Text Domain: translatepress-multilingual
|
| 10 |
Domain Path: /languages
|
| 11 |
License: GPL2
|
| 12 |
WC requires at least: 2.5.0
|
| 13 |
-
WC tested up to: 3.
|
| 14 |
|
| 15 |
== Copyright ==
|
| 16 |
Copyright 2017 Cozmoslabs (www.cozmoslabs.com)
|
| 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.3.8
|
| 7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
| 8 |
Author URI: https://cozmoslabs.com/
|
| 9 |
Text Domain: translatepress-multilingual
|
| 10 |
Domain Path: /languages
|
| 11 |
License: GPL2
|
| 12 |
WC requires at least: 2.5.0
|
| 13 |
+
WC tested up to: 3.5
|
| 14 |
|
| 15 |
== Copyright ==
|
| 16 |
Copyright 2017 Cozmoslabs (www.cozmoslabs.com)
|
languages/translatepress-multilingual.catalog.php
CHANGED
|
@@ -14,8 +14,9 @@
|
|
| 14 |
<?php __("Deactivate License", "translatepress-multilingual"); ?>
|
| 15 |
<?php __("Method of language detection", "translatepress-multilingual"); ?>
|
| 16 |
<?php __("Select how the language should be detected for first time visitors.<br>The visitor's last displayed language will be remembered through cookies.", "translatepress-multilingual"); ?>
|
| 17 |
-
<?php __("
|
| 18 |
<?php __("Language", "translatepress-multilingual"); ?>
|
|
|
|
| 19 |
<?php __("Slug", "translatepress-multilingual"); ?>
|
| 20 |
<?php __("Active", "translatepress-multilingual"); ?>
|
| 21 |
<?php __("Are you sure you want to remove this language?", "translatepress-multilingual"); ?>
|
|
@@ -64,8 +65,6 @@
|
|
| 64 |
<?php __("Post Slug", "translatepress-multilingual"); ?>
|
| 65 |
<?php __("Page Title", "translatepress-multilingual"); ?>
|
| 66 |
<?php __("<strong>TranslatePress</strong> requires <strong><a href=\"http://php.net/manual/en/book.mbstring.php\">Multibyte String PHP library</a></strong>. Please contact your server administrator to install it on your server.", "translatepress-multilingual"); ?>
|
| 67 |
-
<?php __("All Languages", "translatepress-multilingual"); ?>
|
| 68 |
-
<?php __("Code", "translatepress-multilingual"); ?>
|
| 69 |
<?php __("Select the language you wish to make your website available in.", "translatepress-multilingual"); ?>
|
| 70 |
<?php __("To add <strong>more then two languages</strong> and support for SEO Title, Description, Slug and more check out <a href=\"%s\" class=\"button button-primary\" target=\"_blank\" title=\"TranslatePress Pro\">TranslatePress PRO</a>", "translatepress-multilingual"); ?>
|
| 71 |
<?php __("Not only you are getting extra features and premium support, you also help fund the future development of TranslatePress.", "translatepress-multilingual"); ?>
|
| 14 |
<?php __("Deactivate License", "translatepress-multilingual"); ?>
|
| 15 |
<?php __("Method of language detection", "translatepress-multilingual"); ?>
|
| 16 |
<?php __("Select how the language should be detected for first time visitors.<br>The visitor's last displayed language will be remembered through cookies.", "translatepress-multilingual"); ?>
|
| 17 |
+
<?php __("All Languages", "translatepress-multilingual"); ?>
|
| 18 |
<?php __("Language", "translatepress-multilingual"); ?>
|
| 19 |
+
<?php __("Code", "translatepress-multilingual"); ?>
|
| 20 |
<?php __("Slug", "translatepress-multilingual"); ?>
|
| 21 |
<?php __("Active", "translatepress-multilingual"); ?>
|
| 22 |
<?php __("Are you sure you want to remove this language?", "translatepress-multilingual"); ?>
|
| 65 |
<?php __("Post Slug", "translatepress-multilingual"); ?>
|
| 66 |
<?php __("Page Title", "translatepress-multilingual"); ?>
|
| 67 |
<?php __("<strong>TranslatePress</strong> requires <strong><a href=\"http://php.net/manual/en/book.mbstring.php\">Multibyte String PHP library</a></strong>. Please contact your server administrator to install it on your server.", "translatepress-multilingual"); ?>
|
|
|
|
|
|
|
| 68 |
<?php __("Select the language you wish to make your website available in.", "translatepress-multilingual"); ?>
|
| 69 |
<?php __("To add <strong>more then two languages</strong> and support for SEO Title, Description, Slug and more check out <a href=\"%s\" class=\"button button-primary\" target=\"_blank\" title=\"TranslatePress Pro\">TranslatePress PRO</a>", "translatepress-multilingual"); ?>
|
| 70 |
<?php __("Not only you are getting extra features and premium support, you also help fund the future development of TranslatePress.", "translatepress-multilingual"); ?>
|
languages/translatepress-multilingual.pot
CHANGED
|
@@ -17,7 +17,7 @@ msgstr ""
|
|
| 17 |
msgid "Error! Duplicate Url slug values."
|
| 18 |
msgstr ""
|
| 19 |
|
| 20 |
-
#: class-navigation-based-on-language.php:85
|
| 21 |
msgid "Limit this menu item to the following languages"
|
| 22 |
msgstr ""
|
| 23 |
|
|
@@ -25,87 +25,91 @@ msgstr ""
|
|
| 25 |
msgid "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 you submit the sitemap to Google."
|
| 26 |
msgstr ""
|
| 27 |
|
| 28 |
-
#:
|
| 29 |
msgid "First by browser language, then IP address (recommended)"
|
| 30 |
msgstr ""
|
| 31 |
|
| 32 |
-
#:
|
| 33 |
msgid "First by IP address, then browser language"
|
| 34 |
msgstr ""
|
| 35 |
|
| 36 |
-
#:
|
| 37 |
msgid "Only by browser language"
|
| 38 |
msgstr ""
|
| 39 |
|
| 40 |
-
#:
|
| 41 |
msgid "Only by IP address"
|
| 42 |
msgstr ""
|
| 43 |
|
| 44 |
-
#:
|
| 45 |
msgid "<div class=\"warning\">WARNING. Cannot determine your language preference based on your current IP.<br>This is most likely because the website is on a local environment.</div>"
|
| 46 |
msgstr ""
|
| 47 |
|
| 48 |
-
#:
|
| 49 |
msgid "TranslatePress Settings"
|
| 50 |
msgstr ""
|
| 51 |
|
| 52 |
-
#:
|
| 53 |
msgid "License Key"
|
| 54 |
msgstr ""
|
| 55 |
|
| 56 |
-
#:
|
| 57 |
msgid "Enter your license key."
|
| 58 |
msgstr ""
|
| 59 |
|
| 60 |
-
#:
|
| 61 |
msgid "Activate License"
|
| 62 |
msgstr ""
|
| 63 |
|
| 64 |
-
#:
|
| 65 |
msgid "Deactivate License"
|
| 66 |
msgstr ""
|
| 67 |
|
| 68 |
-
#:
|
| 69 |
msgid "Method of language detection"
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
-
#:
|
| 73 |
msgid "Select how the language should be detected for first time visitors.<br>The visitor's last displayed language will be remembered through cookies."
|
| 74 |
msgstr ""
|
| 75 |
|
| 76 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:2
|
| 77 |
-
msgid "
|
| 78 |
msgstr ""
|
| 79 |
|
| 80 |
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:7, ../translatepress/partials/main-settings-language-selector.php:7
|
| 81 |
msgid "Language"
|
| 82 |
msgstr ""
|
| 83 |
|
| 84 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:8, ../translatepress/partials/main-settings-language-selector.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
msgid "Slug"
|
| 86 |
msgstr ""
|
| 87 |
|
| 88 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:
|
| 89 |
msgid "Active"
|
| 90 |
msgstr ""
|
| 91 |
|
| 92 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:
|
| 93 |
msgid "Are you sure you want to remove this language?"
|
| 94 |
msgstr ""
|
| 95 |
|
| 96 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:
|
| 97 |
msgid "Remove"
|
| 98 |
msgstr ""
|
| 99 |
|
| 100 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:
|
| 101 |
msgid "Choose..."
|
| 102 |
msgstr ""
|
| 103 |
|
| 104 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:
|
| 105 |
msgid "Add"
|
| 106 |
msgstr ""
|
| 107 |
|
| 108 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:
|
| 109 |
msgid "Select the languages you wish to make your website available in."
|
| 110 |
msgstr ""
|
| 111 |
|
|
@@ -233,39 +237,39 @@ msgstr ""
|
|
| 233 |
msgid "Translate Page"
|
| 234 |
msgstr ""
|
| 235 |
|
| 236 |
-
#: ../translatepress/includes/class-translation-manager.php:
|
| 237 |
msgid "Security check"
|
| 238 |
msgstr ""
|
| 239 |
|
| 240 |
-
#: ../translatepress/includes/class-translation-render.php:
|
| 241 |
msgid "Description"
|
| 242 |
msgstr ""
|
| 243 |
|
| 244 |
-
#: ../translatepress/includes/class-translation-render.php:
|
| 245 |
msgid "OG Title"
|
| 246 |
msgstr ""
|
| 247 |
|
| 248 |
-
#: ../translatepress/includes/class-translation-render.php:
|
| 249 |
msgid "OG Site Name"
|
| 250 |
msgstr ""
|
| 251 |
|
| 252 |
-
#: ../translatepress/includes/class-translation-render.php:
|
| 253 |
msgid "OG Description"
|
| 254 |
msgstr ""
|
| 255 |
|
| 256 |
-
#: ../translatepress/includes/class-translation-render.php:
|
| 257 |
msgid "Twitter Title"
|
| 258 |
msgstr ""
|
| 259 |
|
| 260 |
-
#: ../translatepress/includes/class-translation-render.php:
|
| 261 |
msgid "Twitter Description"
|
| 262 |
msgstr ""
|
| 263 |
|
| 264 |
-
#: ../translatepress/includes/class-translation-render.php:
|
| 265 |
msgid "Post Slug"
|
| 266 |
msgstr ""
|
| 267 |
|
| 268 |
-
#: ../translatepress/includes/class-translation-render.php:
|
| 269 |
msgid "Page Title"
|
| 270 |
msgstr ""
|
| 271 |
|
|
@@ -273,14 +277,6 @@ msgstr ""
|
|
| 273 |
msgid "<strong>TranslatePress</strong> requires <strong><a href=\"http://php.net/manual/en/book.mbstring.php\">Multibyte String PHP library</a></strong>. Please contact your server administrator to install it on your server."
|
| 274 |
msgstr ""
|
| 275 |
|
| 276 |
-
#: ../translatepress/partials/main-settings-language-selector.php:2
|
| 277 |
-
msgid "All Languages"
|
| 278 |
-
msgstr ""
|
| 279 |
-
|
| 280 |
-
#: ../translatepress/partials/main-settings-language-selector.php:8
|
| 281 |
-
msgid "Code"
|
| 282 |
-
msgstr ""
|
| 283 |
-
|
| 284 |
#: ../translatepress/partials/main-settings-language-selector.php:59
|
| 285 |
msgid "Select the language you wish to make your website available in."
|
| 286 |
msgstr ""
|
| 17 |
msgid "Error! Duplicate Url slug values."
|
| 18 |
msgstr ""
|
| 19 |
|
| 20 |
+
#: ../tp-add-on-navigation-based-on-language/class-navigation-based-on-language.php:85
|
| 21 |
msgid "Limit this menu item to the following languages"
|
| 22 |
msgstr ""
|
| 23 |
|
| 25 |
msgid "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 you submit the sitemap to Google."
|
| 26 |
msgstr ""
|
| 27 |
|
| 28 |
+
#: includes/class-ald-settings.php:37
|
| 29 |
msgid "First by browser language, then IP address (recommended)"
|
| 30 |
msgstr ""
|
| 31 |
|
| 32 |
+
#: includes/class-ald-settings.php:38
|
| 33 |
msgid "First by IP address, then browser language"
|
| 34 |
msgstr ""
|
| 35 |
|
| 36 |
+
#: includes/class-ald-settings.php:39
|
| 37 |
msgid "Only by browser language"
|
| 38 |
msgstr ""
|
| 39 |
|
| 40 |
+
#: includes/class-ald-settings.php:40
|
| 41 |
msgid "Only by IP address"
|
| 42 |
msgstr ""
|
| 43 |
|
| 44 |
+
#: includes/class-ald-settings.php:110
|
| 45 |
msgid "<div class=\"warning\">WARNING. Cannot determine your language preference based on your current IP.<br>This is most likely because the website is on a local environment.</div>"
|
| 46 |
msgstr ""
|
| 47 |
|
| 48 |
+
#: partials/license-settings-page.php:4, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:4, ../tp-add-on-extra-languages/partials/license-settings-page.php:4, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:4, ../tp-add-on-seo-pack/partials/license-settings-page.php:4, ../translatepress/partials/addons-settings-page.php:3, ../translatepress/partials/main-settings-page.php:5, ../translatepress/partials/test-google-key-settings-page.php:10, ../translatepress/partials/trp-remove-duplicate-rows.php:3, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:4
|
| 49 |
msgid "TranslatePress Settings"
|
| 50 |
msgstr ""
|
| 51 |
|
| 52 |
+
#: partials/license-settings-page.php:10, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:10, ../tp-add-on-extra-languages/partials/license-settings-page.php:10, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:10, ../tp-add-on-seo-pack/partials/license-settings-page.php:10, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:10
|
| 53 |
msgid "License Key"
|
| 54 |
msgstr ""
|
| 55 |
|
| 56 |
+
#: partials/license-settings-page.php:15, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:15, ../tp-add-on-extra-languages/partials/license-settings-page.php:15, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:15, ../tp-add-on-seo-pack/partials/license-settings-page.php:15, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:15
|
| 57 |
msgid "Enter your license key."
|
| 58 |
msgstr ""
|
| 59 |
|
| 60 |
+
#: partials/license-settings-page.php:22, partials/license-settings-page.php:31, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:22, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:31, ../tp-add-on-extra-languages/partials/license-settings-page.php:22, ../tp-add-on-extra-languages/partials/license-settings-page.php:31, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:22, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:31, ../tp-add-on-seo-pack/partials/license-settings-page.php:22, ../tp-add-on-seo-pack/partials/license-settings-page.php:31, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:22, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:31
|
| 61 |
msgid "Activate License"
|
| 62 |
msgstr ""
|
| 63 |
|
| 64 |
+
#: partials/license-settings-page.php:28, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:28, ../tp-add-on-extra-languages/partials/license-settings-page.php:28, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:28, ../tp-add-on-seo-pack/partials/license-settings-page.php:28, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:28
|
| 65 |
msgid "Deactivate License"
|
| 66 |
msgstr ""
|
| 67 |
|
| 68 |
+
#: partials/settings-option.php:2
|
| 69 |
msgid "Method of language detection"
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
+
#: partials/settings-option.php:14
|
| 73 |
msgid "Select how the language should be detected for first time visitors.<br>The visitor's last displayed language will be remembered through cookies."
|
| 74 |
msgstr ""
|
| 75 |
|
| 76 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:2, ../translatepress/partials/main-settings-language-selector.php:2
|
| 77 |
+
msgid "All Languages"
|
| 78 |
msgstr ""
|
| 79 |
|
| 80 |
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:7, ../translatepress/partials/main-settings-language-selector.php:7
|
| 81 |
msgid "Language"
|
| 82 |
msgstr ""
|
| 83 |
|
| 84 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:8, ../translatepress/partials/main-settings-language-selector.php:8
|
| 85 |
+
msgid "Code"
|
| 86 |
+
msgstr ""
|
| 87 |
+
|
| 88 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:9, ../translatepress/partials/main-settings-language-selector.php:9
|
| 89 |
msgid "Slug"
|
| 90 |
msgstr ""
|
| 91 |
|
| 92 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:10
|
| 93 |
msgid "Active"
|
| 94 |
msgstr ""
|
| 95 |
|
| 96 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:43, ../translatepress/partials/main-settings-language-selector.php:40
|
| 97 |
msgid "Are you sure you want to remove this language?"
|
| 98 |
msgstr ""
|
| 99 |
|
| 100 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:43, ../translatepress/partials/main-settings-language-selector.php:40
|
| 101 |
msgid "Remove"
|
| 102 |
msgstr ""
|
| 103 |
|
| 104 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:51, ../translatepress/partials/main-settings-language-selector.php:48
|
| 105 |
msgid "Choose..."
|
| 106 |
msgstr ""
|
| 107 |
|
| 108 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:58, ../translatepress/partials/main-settings-language-selector.php:55
|
| 109 |
msgid "Add"
|
| 110 |
msgstr ""
|
| 111 |
|
| 112 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:61
|
| 113 |
msgid "Select the languages you wish to make your website available in."
|
| 114 |
msgstr ""
|
| 115 |
|
| 237 |
msgid "Translate Page"
|
| 238 |
msgstr ""
|
| 239 |
|
| 240 |
+
#: ../translatepress/includes/class-translation-manager.php:1197
|
| 241 |
msgid "Security check"
|
| 242 |
msgstr ""
|
| 243 |
|
| 244 |
+
#: ../translatepress/includes/class-translation-render.php:164
|
| 245 |
msgid "Description"
|
| 246 |
msgstr ""
|
| 247 |
|
| 248 |
+
#: ../translatepress/includes/class-translation-render.php:170
|
| 249 |
msgid "OG Title"
|
| 250 |
msgstr ""
|
| 251 |
|
| 252 |
+
#: ../translatepress/includes/class-translation-render.php:176
|
| 253 |
msgid "OG Site Name"
|
| 254 |
msgstr ""
|
| 255 |
|
| 256 |
+
#: ../translatepress/includes/class-translation-render.php:182
|
| 257 |
msgid "OG Description"
|
| 258 |
msgstr ""
|
| 259 |
|
| 260 |
+
#: ../translatepress/includes/class-translation-render.php:188
|
| 261 |
msgid "Twitter Title"
|
| 262 |
msgstr ""
|
| 263 |
|
| 264 |
+
#: ../translatepress/includes/class-translation-render.php:194
|
| 265 |
msgid "Twitter Description"
|
| 266 |
msgstr ""
|
| 267 |
|
| 268 |
+
#: ../translatepress/includes/class-translation-render.php:200
|
| 269 |
msgid "Post Slug"
|
| 270 |
msgstr ""
|
| 271 |
|
| 272 |
+
#: ../translatepress/includes/class-translation-render.php:204
|
| 273 |
msgid "Page Title"
|
| 274 |
msgstr ""
|
| 275 |
|
| 277 |
msgid "<strong>TranslatePress</strong> requires <strong><a href=\"http://php.net/manual/en/book.mbstring.php\">Multibyte String PHP library</a></strong>. Please contact your server administrator to install it on your server."
|
| 278 |
msgstr ""
|
| 279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
#: ../translatepress/partials/main-settings-language-selector.php:59
|
| 281 |
msgid "Select the language you wish to make your website available in."
|
| 282 |
msgstr ""
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: https://www.cozmoslabs.com/
|
|
| 4 |
Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
|
| 5 |
Requires at least: 3.1.0
|
| 6 |
Tested up to: 4.9.8
|
| 7 |
-
Stable tag: 1.3.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -124,6 +124,18 @@ For more information please check out [TranslatePress - Multilingual plugin docu
|
|
| 124 |
6. Menu Language Switcher
|
| 125 |
|
| 126 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
= 1.3.7 =
|
| 128 |
* Fixed an issue with Woocommerce and redirects when the default language is not English
|
| 129 |
* Speed improvements
|
| 4 |
Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
|
| 5 |
Requires at least: 3.1.0
|
| 6 |
Tested up to: 4.9.8
|
| 7 |
+
Stable tag: 1.3.8
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 124 |
6. Menu Language Switcher
|
| 125 |
|
| 126 |
== Changelog ==
|
| 127 |
+
= 1.3.8 =
|
| 128 |
+
* Speed improvements
|
| 129 |
+
* Remove notices from Editor when we don't have translation languages
|
| 130 |
+
* Fixed notices with referrer in translator machine
|
| 131 |
+
* Fixed issues with urls in other languages
|
| 132 |
+
* Fix issue of nested gettext resulting in unwanted characters
|
| 133 |
+
* Strip gettext tags from urls run through sanitize_title and esc_url
|
| 134 |
+
* Set caching calls non-persistent. Doesn't work with object caching otherwise
|
| 135 |
+
* Set lang attribute in html tag all the time including when on default language
|
| 136 |
+
* Refactored the way we translate json
|
| 137 |
+
* Fixed issue with Woocommerce ajax calls
|
| 138 |
+
|
| 139 |
= 1.3.7 =
|
| 140 |
* Fixed an issue with Woocommerce and redirects when the default language is not English
|
| 141 |
* Speed improvements
|
