Version Description
- Added a lot of hooks in the translation manager interface so other people can insert new content there.
- We now take into account the presence of www or lack of it in custom links that might be local
- We now make sure we're not changing the locale in the backend if the language order is different.
- Fixed issue with incorrect language adding in the backend that caused notices in the front-end
- Removed obsolete function add_cookie
- Fixed trailingslashit over get_permalink in url-converter
- Removed adding cookie from php. Fixed enqueue_styles on license and add-ons tabs. Removed deprecated function.
Download this release
Release Info
| Developer | madalin.ungureanu |
| Plugin | |
| Version | 1.2.8 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.7 to 1.2.8
- assets/css/trp-back-end-style.css +4 -0
- assets/js/trp-back-end-script.js +53 -1
- class-translate-press.php +2 -2
- includes/class-language-switcher.php +14 -27
- includes/class-languages.php +12 -1
- includes/class-settings.php +3 -16
- includes/class-translation-render.php +47 -0
- includes/class-url-converter.php +4 -1
- includes/functions.php +20 -0
- index.php +1 -1
- languages/translatepress-multilingual.catalog.php +1 -0
- languages/translatepress-multilingual.pot +47 -43
- partials/main-settings-language-selector.php +5 -20
- partials/translation-manager.php +7 -1
- readme.txt +11 -2
assets/css/trp-back-end-style.css
CHANGED
|
@@ -137,4 +137,8 @@ input.trp-translation-published{
|
|
| 137 |
padding: 1rem;
|
| 138 |
background: #fff;
|
| 139 |
max-width:800px;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
}
|
| 137 |
padding: 1rem;
|
| 138 |
background: #fff;
|
| 139 |
max-width:800px;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
.trp-settings-delimiter-border{
|
| 143 |
+
border-top: 1px solid #d9d9d9;
|
| 144 |
}
|
assets/js/trp-back-end-script.js
CHANGED
|
@@ -28,7 +28,53 @@ function TRP_Settings_Language_Selector() {
|
|
| 28 |
};
|
| 29 |
|
| 30 |
this.add_language = function(){
|
| 31 |
-
jQuery(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
};
|
| 33 |
|
| 34 |
this.update_default_language = function(){
|
|
@@ -76,11 +122,17 @@ function TRP_Settings_Language_Selector() {
|
|
| 76 |
|
| 77 |
this.initialize = function () {
|
| 78 |
this.initialize_select2();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
duplicate_url_error_message = trp_url_slugs_info['error_message_duplicate_slugs'];
|
| 80 |
iso_codes = trp_url_slugs_info['iso_codes'];
|
| 81 |
|
| 82 |
jQuery( '#trp-sortable-languages' ).sortable({ handle: '.trp-sortable-handle' });
|
| 83 |
jQuery( '#trp-add-language' ).click( _this.add_language );
|
|
|
|
| 84 |
jQuery( '#trp-default-language' ).on( 'change', _this.update_default_language );
|
| 85 |
jQuery( "form[action='options.php']").on ( 'submit', _this.check_unique_url_slugs );
|
| 86 |
jQuery( '#trp-languages-table' ).on( 'change', '.trp-translation-language', _this.update_url_slug_and_status );
|
| 28 |
};
|
| 29 |
|
| 30 |
this.add_language = function(){
|
| 31 |
+
var selected_language = jQuery( '#trp-select-language' );
|
| 32 |
+
var new_language = selected_language.val();
|
| 33 |
+
if ( new_language == "" ){
|
| 34 |
+
return;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
if (jQuery( "#trp-languages-table .trp-language" ).length >= 2 ){
|
| 38 |
+
jQuery(".trp-upsell-multiple-languages").show('fast');
|
| 39 |
+
return;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
selected_language.val( '' ).trigger( 'change' );
|
| 43 |
+
|
| 44 |
+
var new_option = jQuery( '.trp-language' ).first().clone();
|
| 45 |
+
new_option = jQuery( new_option );
|
| 46 |
+
|
| 47 |
+
new_option.find( '.trp-hidden-default-language' ).remove();
|
| 48 |
+
new_option.find( '.select2-container' ).remove();
|
| 49 |
+
var select = new_option.find( 'select.trp-translation-language' );
|
| 50 |
+
select.removeAttr( 'disabled' );
|
| 51 |
+
select.find( 'option' ).each(function(index, el){
|
| 52 |
+
el.text = el.text.replace('Default: ', '');
|
| 53 |
+
})
|
| 54 |
+
|
| 55 |
+
select.val( new_language );
|
| 56 |
+
select.select2();
|
| 57 |
+
|
| 58 |
+
var checkbox = new_option.find( 'input.trp-translation-published' );
|
| 59 |
+
checkbox.removeAttr( 'disabled' );
|
| 60 |
+
checkbox.val( new_language );
|
| 61 |
+
|
| 62 |
+
var url_slug = new_option.find( 'input.trp-language-slug' );
|
| 63 |
+
url_slug.val( _this.get_default_url_slug( new_language ) );
|
| 64 |
+
url_slug.attr('name', 'trp_settings[url-slugs][' + new_language + ']' );
|
| 65 |
+
|
| 66 |
+
var remove = new_option.find( '.trp-remove-language' ).toggle();
|
| 67 |
+
|
| 68 |
+
new_option = jQuery( '#trp-sortable-languages' ).append( new_option );
|
| 69 |
+
new_option.find( '.trp-remove-language' ).last().click( _this.remove_language );
|
| 70 |
+
};
|
| 71 |
+
|
| 72 |
+
this.remove_language = function( element ){
|
| 73 |
+
var message = jQuery( element.target ).attr( 'data-confirm-message' );
|
| 74 |
+
var confirmed = confirm( message );
|
| 75 |
+
if ( confirmed ) {
|
| 76 |
+
jQuery ( element.target ).parent().parent().remove();
|
| 77 |
+
}
|
| 78 |
};
|
| 79 |
|
| 80 |
this.update_default_language = function(){
|
| 122 |
|
| 123 |
this.initialize = function () {
|
| 124 |
this.initialize_select2();
|
| 125 |
+
|
| 126 |
+
if ( !jQuery( '.trp-language-selector-limited' ).length ){
|
| 127 |
+
return;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
duplicate_url_error_message = trp_url_slugs_info['error_message_duplicate_slugs'];
|
| 131 |
iso_codes = trp_url_slugs_info['iso_codes'];
|
| 132 |
|
| 133 |
jQuery( '#trp-sortable-languages' ).sortable({ handle: '.trp-sortable-handle' });
|
| 134 |
jQuery( '#trp-add-language' ).click( _this.add_language );
|
| 135 |
+
jQuery( '.trp-remove-language' ).click( _this.remove_language );
|
| 136 |
jQuery( '#trp-default-language' ).on( 'change', _this.update_default_language );
|
| 137 |
jQuery( "form[action='options.php']").on ( 'submit', _this.check_unique_url_slugs );
|
| 138 |
jQuery( '#trp-languages-table' ).on( 'change', '.trp-translation-language', _this.update_url_slug_and_status );
|
class-translate-press.php
CHANGED
|
@@ -39,7 +39,7 @@ class TRP_Translate_Press{
|
|
| 39 |
define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
| 40 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
| 41 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
| 42 |
-
define( 'TRP_PLUGIN_VERSION', '1.2.
|
| 43 |
|
| 44 |
$this->load_dependencies();
|
| 45 |
$this->initialize_components();
|
|
@@ -165,7 +165,7 @@ class TRP_Translate_Press{
|
|
| 165 |
$this->loader->add_filter( 'widget_text', null, 'shortcode_unautop', 11 );
|
| 166 |
|
| 167 |
/* handle dynamic texts with gettext */
|
| 168 |
-
$this->loader->add_filter( 'locale', $this->languages, 'change_locale' );
|
| 169 |
|
| 170 |
$this->loader->add_action( 'init', $this->translation_manager, 'create_gettext_translated_global' );
|
| 171 |
$this->loader->add_action( 'admin_init', $this->translation_manager, 'create_gettext_translated_global' );
|
| 39 |
define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
| 40 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
| 41 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
| 42 |
+
define( 'TRP_PLUGIN_VERSION', '1.2.8' );
|
| 43 |
|
| 44 |
$this->load_dependencies();
|
| 45 |
$this->initialize_components();
|
| 165 |
$this->loader->add_filter( 'widget_text', null, 'shortcode_unautop', 11 );
|
| 166 |
|
| 167 |
/* handle dynamic texts with gettext */
|
| 168 |
+
$this->loader->add_filter( 'locale', $this->languages, 'change_locale' );
|
| 169 |
|
| 170 |
$this->loader->add_action( 'init', $this->translation_manager, 'create_gettext_translated_global' );
|
| 171 |
$this->loader->add_action( 'admin_init', $this->translation_manager, 'create_gettext_translated_global' );
|
includes/class-language-switcher.php
CHANGED
|
@@ -20,7 +20,7 @@ class TRP_Language_Switcher{
|
|
| 20 |
* TRP_Language_Switcher constructor.
|
| 21 |
*
|
| 22 |
* @param array $settings Settings option.
|
| 23 |
-
* @param $
|
| 24 |
*/
|
| 25 |
public function __construct( $settings, $trp ){
|
| 26 |
$this->settings = $settings;
|
|
@@ -35,7 +35,7 @@ class TRP_Language_Switcher{
|
|
| 35 |
/**
|
| 36 |
* Returns a valid current language code.
|
| 37 |
*
|
| 38 |
-
* Adds
|
| 39 |
*
|
| 40 |
* @param $trp TRP_Translate_Press TRP singleton object
|
| 41 |
*
|
|
@@ -46,20 +46,18 @@ class TRP_Language_Switcher{
|
|
| 46 |
|
| 47 |
$needed_language = $this->determine_needed_language( $language_from_url, $trp );
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
add_filter( 'template_redirect', array( $this, 'redirect_to_correct_language' ) );
|
| 59 |
}
|
| 60 |
-
|
| 61 |
|
| 62 |
-
$this->add_cookie( $needed_language );
|
| 63 |
return $needed_language;
|
| 64 |
}
|
| 65 |
|
|
@@ -96,22 +94,11 @@ class TRP_Language_Switcher{
|
|
| 96 |
$trp = TRP_Translate_Press::get_trp_instance();
|
| 97 |
$this->trp_languages = $trp->get_component( 'url_converter' );
|
| 98 |
}
|
| 99 |
-
|
|
|
|
| 100 |
exit;
|
| 101 |
}
|
| 102 |
|
| 103 |
-
/**
|
| 104 |
-
* Adds cookie with language
|
| 105 |
-
*
|
| 106 |
-
* @param string $language_code Language code to add cookie for
|
| 107 |
-
*/
|
| 108 |
-
public function add_cookie( $language_code ) {
|
| 109 |
-
if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
|
| 110 |
-
return;
|
| 111 |
-
}
|
| 112 |
-
setcookie( 'trp_language', $language_code, strtotime( '+30 days' ), "/" );
|
| 113 |
-
}
|
| 114 |
-
|
| 115 |
/**
|
| 116 |
* Returns HTML for shortcode language switcher.
|
| 117 |
*
|
| 20 |
* TRP_Language_Switcher constructor.
|
| 21 |
*
|
| 22 |
* @param array $settings Settings option.
|
| 23 |
+
* @param $trp TRP_Translate_Press Trp object
|
| 24 |
*/
|
| 25 |
public function __construct( $settings, $trp ){
|
| 26 |
$this->settings = $settings;
|
| 35 |
/**
|
| 36 |
* Returns a valid current language code.
|
| 37 |
*
|
| 38 |
+
* Adds filter for redirect if necessary
|
| 39 |
*
|
| 40 |
* @param $trp TRP_Translate_Press TRP singleton object
|
| 41 |
*
|
| 46 |
|
| 47 |
$needed_language = $this->determine_needed_language( $language_from_url, $trp );
|
| 48 |
|
| 49 |
+
$allow_redirect = apply_filters( 'trp_allow_language_redirect', true, $needed_language );
|
| 50 |
+
if ( $allow_redirect ) {
|
| 51 |
+
if ( ( $language_from_url == null && isset( $this->settings['add-subdirectory-to-default-language'] ) && $this->settings['add-subdirectory-to-default-language'] == 'yes' ) ||
|
| 52 |
+
( $language_from_url == null && $needed_language != $this->settings['default-language'] ) ||
|
| 53 |
+
( $language_from_url != null && $needed_language != $language_from_url )
|
| 54 |
+
) {
|
| 55 |
+
global $TRP_NEEDED_LANGUAGE;
|
| 56 |
+
$TRP_NEEDED_LANGUAGE = $needed_language;
|
| 57 |
+
add_filter( 'template_redirect', array( $this, 'redirect_to_correct_language' ) );
|
|
|
|
| 58 |
}
|
| 59 |
+
}
|
| 60 |
|
|
|
|
| 61 |
return $needed_language;
|
| 62 |
}
|
| 63 |
|
| 94 |
$trp = TRP_Translate_Press::get_trp_instance();
|
| 95 |
$this->trp_languages = $trp->get_component( 'url_converter' );
|
| 96 |
}
|
| 97 |
+
$link_to_redirect = apply_filters( 'trp_link_to_redirect_to', $this->url_converter->get_url_for_language( $TRP_NEEDED_LANGUAGE, null, '' ), $TRP_NEEDED_LANGUAGE );
|
| 98 |
+
header( 'Location: ' . $link_to_redirect );
|
| 99 |
exit;
|
| 100 |
}
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
/**
|
| 103 |
* Returns HTML for shortcode language switcher.
|
| 104 |
*
|
includes/class-languages.php
CHANGED
|
@@ -11,6 +11,7 @@ class TRP_Languages{
|
|
| 11 |
protected $wp_languages;
|
| 12 |
protected $wp_languages_backup = array();
|
| 13 |
protected $settings;
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
/**
|
|
@@ -36,7 +37,17 @@ class TRP_Languages{
|
|
| 36 |
* @return mixed
|
| 37 |
*/
|
| 38 |
public function change_locale( $locale ){
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
if( !empty($TRP_LANGUAGE) && $this->settings["default-language"] != $TRP_LANGUAGE ){
|
| 41 |
$locale = $TRP_LANGUAGE;
|
| 42 |
}
|
| 11 |
protected $wp_languages;
|
| 12 |
protected $wp_languages_backup = array();
|
| 13 |
protected $settings;
|
| 14 |
+
protected $is_admin_request;
|
| 15 |
|
| 16 |
|
| 17 |
/**
|
| 37 |
* @return mixed
|
| 38 |
*/
|
| 39 |
public function change_locale( $locale ){
|
| 40 |
+
if ( !$this->is_admin_request ){
|
| 41 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
| 42 |
+
$trp_is_admin_request = $trp->get_component( 'url_converter' );
|
| 43 |
+
$this->is_admin_request= $trp_is_admin_request->is_admin_request();
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
if ( $this->is_admin_request )
|
| 47 |
+
return $locale;
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
global $TRP_LANGUAGE;
|
| 51 |
if( !empty($TRP_LANGUAGE) && $this->settings["default-language"] != $TRP_LANGUAGE ){
|
| 52 |
$locale = $TRP_LANGUAGE;
|
| 53 |
}
|
includes/class-settings.php
CHANGED
|
@@ -251,8 +251,8 @@ class TRP_Settings{
|
|
| 251 |
}
|
| 252 |
$default_settings = array(
|
| 253 |
'default-language' => $default,
|
| 254 |
-
'translation-languages' => array( $default
|
| 255 |
-
'publish-languages' => array( $default
|
| 256 |
'native_or_english_name' => 'english_name',
|
| 257 |
'add-subdirectory-to-default-language' => 'no',
|
| 258 |
'force-language-to-custom-links' => 'yes',
|
|
@@ -272,7 +272,6 @@ class TRP_Settings{
|
|
| 272 |
$settings_option[$key_default_setting] = $value_default_setting;
|
| 273 |
}
|
| 274 |
}
|
| 275 |
-
$settings_option = $this->check_settings_option( $settings_option, $default_settings );
|
| 276 |
}
|
| 277 |
$this->settings = $settings_option;
|
| 278 |
}
|
|
@@ -283,7 +282,7 @@ class TRP_Settings{
|
|
| 283 |
* @param string $hook Admin page.
|
| 284 |
*/
|
| 285 |
public function enqueue_scripts_and_styles( $hook ) {
|
| 286 |
-
if ( $hook == 'settings_page_translate-press' || $hook == '
|
| 287 |
wp_enqueue_style(
|
| 288 |
'trp-settings-style',
|
| 289 |
TRP_PLUGIN_URL . 'assets/css/trp-back-end-style.css',
|
|
@@ -325,18 +324,6 @@ class TRP_Settings{
|
|
| 325 |
require_once TRP_PLUGIN_DIR . 'partials/main-settings-language-selector.php';
|
| 326 |
}
|
| 327 |
|
| 328 |
-
/**
|
| 329 |
-
* Validate settings option.
|
| 330 |
-
*
|
| 331 |
-
* @deprecated
|
| 332 |
-
* @param array $settings Settings option.
|
| 333 |
-
* @param array $default_settings Default settings option.
|
| 334 |
-
* @return array Validated settings option.
|
| 335 |
-
*/
|
| 336 |
-
public function check_settings_option( $settings, $default_settings ){
|
| 337 |
-
return $settings;
|
| 338 |
-
}
|
| 339 |
-
|
| 340 |
/**
|
| 341 |
* Update language switcher menu items.
|
| 342 |
*
|
| 251 |
}
|
| 252 |
$default_settings = array(
|
| 253 |
'default-language' => $default,
|
| 254 |
+
'translation-languages' => array( $default ),
|
| 255 |
+
'publish-languages' => array( $default ),
|
| 256 |
'native_or_english_name' => 'english_name',
|
| 257 |
'add-subdirectory-to-default-language' => 'no',
|
| 258 |
'force-language-to-custom-links' => 'yes',
|
| 272 |
$settings_option[$key_default_setting] = $value_default_setting;
|
| 273 |
}
|
| 274 |
}
|
|
|
|
| 275 |
}
|
| 276 |
$this->settings = $settings_option;
|
| 277 |
}
|
| 282 |
* @param string $hook Admin page.
|
| 283 |
*/
|
| 284 |
public function enqueue_scripts_and_styles( $hook ) {
|
| 285 |
+
if ( $hook == 'settings_page_translate-press' || $hook == 'admin_page_trp_license_key' || $hook == 'admin_page_trp_addons_page' ) {
|
| 286 |
wp_enqueue_style(
|
| 287 |
'trp-settings-style',
|
| 288 |
TRP_PLUGIN_URL . 'assets/css/trp-back-end-style.css',
|
| 324 |
require_once TRP_PLUGIN_DIR . 'partials/main-settings-language-selector.php';
|
| 325 |
}
|
| 326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
/**
|
| 328 |
* Update language switcher menu items.
|
| 329 |
*
|
includes/class-translation-render.php
CHANGED
|
@@ -645,6 +645,9 @@ class TRP_Translation_Render{
|
|
| 645 |
// force custom links to have the correct language
|
| 646 |
foreach( $html->find('a[href!="#"]') as $a_href) {
|
| 647 |
$url = $a_href->href;
|
|
|
|
|
|
|
|
|
|
| 648 |
$is_external_link = $this->is_external_link( $url );
|
| 649 |
$is_admin_link = $this->is_admin_link($url);
|
| 650 |
|
|
@@ -721,7 +724,51 @@ class TRP_Translation_Render{
|
|
| 721 |
return true;
|
| 722 |
}
|
| 723 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 724 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 725 |
/**
|
| 726 |
* Whether given url links to a different language than the current one.
|
| 727 |
*
|
| 645 |
// force custom links to have the correct language
|
| 646 |
foreach( $html->find('a[href!="#"]') as $a_href) {
|
| 647 |
$url = $a_href->href;
|
| 648 |
+
|
| 649 |
+
$url = $this->maybe_is_local_url($url);
|
| 650 |
+
|
| 651 |
$is_external_link = $this->is_external_link( $url );
|
| 652 |
$is_admin_link = $this->is_admin_link($url);
|
| 653 |
|
| 724 |
return true;
|
| 725 |
}
|
| 726 |
}
|
| 727 |
+
/**
|
| 728 |
+
* Checks to see if the user didn't incorrectly formated a url that's different from the home_url
|
| 729 |
+
* Takes into account http, https, www and all the possible combinations between them.
|
| 730 |
+
*
|
| 731 |
+
* @param string $url Url.
|
| 732 |
+
* @return string Correct URL that's the same structure as home_url
|
| 733 |
+
*/
|
| 734 |
+
public function maybe_is_local_url( $url ){
|
| 735 |
+
|
| 736 |
+
if ( apply_filters('disable_maybe_is_local_url', false) ){
|
| 737 |
+
return $url;
|
| 738 |
+
}
|
| 739 |
+
|
| 740 |
+
// Abort if parameter URL is empty
|
| 741 |
+
if( empty($url) ) {
|
| 742 |
+
return $url;
|
| 743 |
+
}
|
| 744 |
+
if ( strpos( $url, '#' ) === 0 || strpos( $url, '/' ) === 0){
|
| 745 |
+
return $url;
|
| 746 |
+
}
|
| 747 |
+
|
| 748 |
+
// Parse home URL and parameter URL
|
| 749 |
+
$link_url = parse_url( $url );
|
| 750 |
+
$home_url = parse_url( home_url() );
|
| 751 |
+
|
| 752 |
+
// Decide on target
|
| 753 |
+
if( !isset ($link_url['host'] ) || $link_url['host'] == $home_url['host'] ) {
|
| 754 |
+
// Is an internal link
|
| 755 |
+
return $url;
|
| 756 |
+
} else {
|
| 757 |
|
| 758 |
+
// test out possible local urls that the user might have mistyped
|
| 759 |
+
$valid_local_prefix = array('http://', 'https://', 'http://www.', 'https://www.');
|
| 760 |
+
foreach ($valid_local_prefix as $prefix){
|
| 761 |
+
foreach ($valid_local_prefix as $replacement_prefix){
|
| 762 |
+
if( str_replace($prefix, $replacement_prefix, $link_url['scheme'] . '://' . $link_url['host']) == $home_url['scheme'] . '://' .$home_url['host'] ){
|
| 763 |
+
return str_replace($prefix, $replacement_prefix, $url);
|
| 764 |
+
}
|
| 765 |
+
}
|
| 766 |
+
}
|
| 767 |
+
|
| 768 |
+
// Is an external link
|
| 769 |
+
return $url;
|
| 770 |
+
}
|
| 771 |
+
}
|
| 772 |
/**
|
| 773 |
* Whether given url links to a different language than the current one.
|
| 774 |
*
|
includes/class-url-converter.php
CHANGED
|
@@ -185,7 +185,10 @@ class TRP_Url_Converter {
|
|
| 185 |
* so we can get the correct permalink (slug and all) and add the remaining arguments that might exist.
|
| 186 |
*/
|
| 187 |
$TRP_LANGUAGE = $language;
|
| 188 |
-
|
|
|
|
|
|
|
|
|
|
| 189 |
$TRP_LANGUAGE = $trp_language_copy;
|
| 190 |
} else {
|
| 191 |
// If no $post_id is set we simply replace the current language root with the new language root.
|
| 185 |
* so we can get the correct permalink (slug and all) and add the remaining arguments that might exist.
|
| 186 |
*/
|
| 187 |
$TRP_LANGUAGE = $language;
|
| 188 |
+
if ( !empty ( $arguments ) ){
|
| 189 |
+
$arguments = apply_filters( 'trp_get_url_for_language_custom_arguments', '/' . ltrim($arguments, '/' ), $language, $url, $post_id );
|
| 190 |
+
}
|
| 191 |
+
$new_url = get_permalink( $post_id ) . $arguments;
|
| 192 |
$TRP_LANGUAGE = $trp_language_copy;
|
| 193 |
} else {
|
| 194 |
// If no $post_id is set we simply replace the current language root with the new language root.
|
includes/functions.php
CHANGED
|
@@ -154,3 +154,23 @@ function trp_sanitize_string( $filtered ){
|
|
| 154 |
|
| 155 |
return $filtered;
|
| 156 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
|
| 155 |
return $filtered;
|
| 156 |
}
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
/** Compatibility functions */
|
| 161 |
+
|
| 162 |
+
/**
|
| 163 |
+
* Do not redirect when elementor preview is present
|
| 164 |
+
*
|
| 165 |
+
* @param $allow_redirect
|
| 166 |
+
*
|
| 167 |
+
* @return bool
|
| 168 |
+
*/
|
| 169 |
+
function trp_elementor_compatibility( $allow_redirect ){
|
| 170 |
+
// compatibility with Elementor preview. Do not redirect to subdir language when elementor preview is present.
|
| 171 |
+
if ( isset( $_GET['elementor-preview'] ) ) {
|
| 172 |
+
return false;
|
| 173 |
+
}
|
| 174 |
+
return $allow_redirect;
|
| 175 |
+
}
|
| 176 |
+
add_filter( 'trp_allow_language_redirect', 'trp_elementor_compatibility' );
|
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.2.
|
| 7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
| 8 |
Author URI: https://cozmoslabs.com/
|
| 9 |
Text Domain: translatepress-multilingual
|
| 3 |
Plugin Name: TranslatePress - Multilingual
|
| 4 |
Plugin URI: https://translatepress.com/
|
| 5 |
Description: Experience a better way of translating your WordPress site, with full support for WooCommerce and site builders.
|
| 6 |
+
Version: 1.2.8
|
| 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
|
@@ -1,6 +1,7 @@
|
|
| 1 |
<?php __("", "translatepress-multilingual"); ?>
|
| 2 |
<?php __("Error! Duplicate Url slug values.", "translatepress-multilingual"); ?>
|
| 3 |
<?php __("Limit this menu item to the following languages", "translatepress-multilingual"); ?>
|
|
|
|
| 4 |
<?php __("TranslatePress Settings", "translatepress-multilingual"); ?>
|
| 5 |
<?php __("License Key", "translatepress-multilingual"); ?>
|
| 6 |
<?php __("Enter your license key.", "translatepress-multilingual"); ?>
|
| 1 |
<?php __("", "translatepress-multilingual"); ?>
|
| 2 |
<?php __("Error! Duplicate Url slug values.", "translatepress-multilingual"); ?>
|
| 3 |
<?php __("Limit this menu item to the following languages", "translatepress-multilingual"); ?>
|
| 4 |
+
<?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 you submit the sitemap to Google.", "translatepress-multilingual"); ?>
|
| 5 |
<?php __("TranslatePress Settings", "translatepress-multilingual"); ?>
|
| 6 |
<?php __("License Key", "translatepress-multilingual"); ?>
|
| 7 |
<?php __("Enter your license key.", "translatepress-multilingual"); ?>
|
languages/translatepress-multilingual.pot
CHANGED
|
@@ -17,27 +17,31 @@ 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 |
|
| 24 |
-
#: ../tp-add-on-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
msgid "TranslatePress Settings"
|
| 26 |
msgstr ""
|
| 27 |
|
| 28 |
-
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:10, ../tp-add-on-extra-languages/partials/license-settings-page.php:10, 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
|
| 29 |
msgid "License Key"
|
| 30 |
msgstr ""
|
| 31 |
|
| 32 |
-
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:15, ../tp-add-on-extra-languages/partials/license-settings-page.php:15, 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
|
| 33 |
msgid "Enter your license key."
|
| 34 |
msgstr ""
|
| 35 |
|
| 36 |
-
#: ../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, partials/license-settings-page.php:22, 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
|
| 37 |
msgid "Activate License"
|
| 38 |
msgstr ""
|
| 39 |
|
| 40 |
-
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:28, ../tp-add-on-extra-languages/partials/license-settings-page.php:28, 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
|
| 41 |
msgid "Deactivate License"
|
| 42 |
msgstr ""
|
| 43 |
|
|
@@ -65,11 +69,11 @@ msgstr ""
|
|
| 65 |
msgid "Remove"
|
| 66 |
msgstr ""
|
| 67 |
|
| 68 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:46, ../translatepress/partials/main-settings-language-selector.php:
|
| 69 |
msgid "Choose..."
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:53, ../translatepress/partials/main-settings-language-selector.php:
|
| 73 |
msgid "Add"
|
| 74 |
msgstr ""
|
| 75 |
|
|
@@ -109,23 +113,23 @@ msgstr ""
|
|
| 109 |
msgid "Only Flags"
|
| 110 |
msgstr ""
|
| 111 |
|
| 112 |
-
#: ../translatepress/includes/class-settings.php:
|
| 113 |
msgid "Current Language"
|
| 114 |
msgstr ""
|
| 115 |
|
| 116 |
-
#: ../translatepress/includes/class-settings.php:
|
| 117 |
msgid "General"
|
| 118 |
msgstr ""
|
| 119 |
|
| 120 |
-
#: ../translatepress/includes/class-settings.php:
|
| 121 |
msgid "Translate Site"
|
| 122 |
msgstr ""
|
| 123 |
|
| 124 |
-
#: ../translatepress/includes/class-settings.php:
|
| 125 |
msgid "License"
|
| 126 |
msgstr ""
|
| 127 |
|
| 128 |
-
#: ../translatepress/includes/class-settings.php:
|
| 129 |
msgid "Addons"
|
| 130 |
msgstr ""
|
| 131 |
|
|
@@ -212,15 +216,15 @@ msgstr ""
|
|
| 212 |
msgid "All Languages"
|
| 213 |
msgstr ""
|
| 214 |
|
| 215 |
-
#: ../translatepress/partials/main-settings-language-selector.php:
|
| 216 |
msgid "Select the language you wish to make your website available in."
|
| 217 |
msgstr ""
|
| 218 |
|
| 219 |
-
#: ../translatepress/partials/main-settings-language-selector.php:
|
| 220 |
msgid "To add <strong>more then two languages</strong> and support for SEO Title, Description, Slug and more checkout <a href=\"%s\" class=\"button button-primary\" target=\"_blank\" title=\"TranslatePress Pro\">TranslatePress PRO</a>"
|
| 221 |
msgstr ""
|
| 222 |
|
| 223 |
-
#: ../translatepress/partials/main-settings-language-selector.php:
|
| 224 |
msgid "Not only you are getting extra features and premium support, you also help fund the future development of TranslatePress."
|
| 225 |
msgstr ""
|
| 226 |
|
|
@@ -348,111 +352,111 @@ msgstr ""
|
|
| 348 |
msgid "Entire Response From wp_remote_get():"
|
| 349 |
msgstr ""
|
| 350 |
|
| 351 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 352 |
msgid "Saved!"
|
| 353 |
msgstr ""
|
| 354 |
|
| 355 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 356 |
msgid "Save translation"
|
| 357 |
msgstr ""
|
| 358 |
|
| 359 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 360 |
msgid "Select string to translate..."
|
| 361 |
msgstr ""
|
| 362 |
|
| 363 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 364 |
msgid "Gettext strings"
|
| 365 |
msgstr ""
|
| 366 |
|
| 367 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 368 |
msgid "Previous"
|
| 369 |
msgstr ""
|
| 370 |
|
| 371 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 372 |
msgid "Next"
|
| 373 |
msgstr ""
|
| 374 |
|
| 375 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 376 |
msgid "View as"
|
| 377 |
msgstr ""
|
| 378 |
|
| 379 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 380 |
msgid "Current User"
|
| 381 |
msgstr ""
|
| 382 |
|
| 383 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 384 |
msgid "Logged Out"
|
| 385 |
msgstr ""
|
| 386 |
|
| 387 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 388 |
msgid "Available in our Pro Versions"
|
| 389 |
msgstr ""
|
| 390 |
|
| 391 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 392 |
msgid "You have unsaved changes!"
|
| 393 |
msgstr ""
|
| 394 |
|
| 395 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 396 |
msgid "Original String"
|
| 397 |
msgstr ""
|
| 398 |
|
| 399 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 400 |
msgid "To %s"
|
| 401 |
msgstr ""
|
| 402 |
|
| 403 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 404 |
msgid "From %s"
|
| 405 |
msgstr ""
|
| 406 |
|
| 407 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 408 |
msgid "Discard changes"
|
| 409 |
msgstr ""
|
| 410 |
|
| 411 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 412 |
msgid "Other languages"
|
| 413 |
msgstr ""
|
| 414 |
|
| 415 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 416 |
msgid "You can add a new language from <a href=\"%s\">Settings->TranslatePress</a>"
|
| 417 |
msgstr ""
|
| 418 |
|
| 419 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 420 |
msgid "However, you can still use TranslatePress to <strong style=\"background: #f5fb9d;\">modify gettext strings</strong> available in your page."
|
| 421 |
msgstr ""
|
| 422 |
|
| 423 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 424 |
msgid "Strings that are user created can't be modified, only those from themes and plugins."
|
| 425 |
msgstr ""
|
| 426 |
|
| 427 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 428 |
msgid "Your Website <br/> Multiple Languages"
|
| 429 |
msgstr ""
|
| 430 |
|
| 431 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 432 |
msgid "Support for 221 Languages"
|
| 433 |
msgstr ""
|
| 434 |
|
| 435 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 436 |
msgid "Translate SEO Title, Description, Slug"
|
| 437 |
msgstr ""
|
| 438 |
|
| 439 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 440 |
msgid "Translate Facebook Tags"
|
| 441 |
msgstr ""
|
| 442 |
|
| 443 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 444 |
msgid "Create Translator Accounts"
|
| 445 |
msgstr ""
|
| 446 |
|
| 447 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 448 |
msgid "Publish when the translation is done"
|
| 449 |
msgstr ""
|
| 450 |
|
| 451 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 452 |
msgid "Supported By Real People"
|
| 453 |
msgstr ""
|
| 454 |
|
| 455 |
-
#: ../translatepress/partials/translation-manager.php:
|
| 456 |
msgid "Learn More"
|
| 457 |
msgstr ""
|
| 458 |
|
| 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 |
|
| 24 |
+
#: ../tp-add-on-seo-pack/class-seo-pack.php:154
|
| 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 |
+
#: ../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:17, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:4
|
| 29 |
msgid "TranslatePress Settings"
|
| 30 |
msgstr ""
|
| 31 |
|
| 32 |
+
#: ../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
|
| 33 |
msgid "License Key"
|
| 34 |
msgstr ""
|
| 35 |
|
| 36 |
+
#: ../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
|
| 37 |
msgid "Enter your license key."
|
| 38 |
msgstr ""
|
| 39 |
|
| 40 |
+
#: ../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
|
| 41 |
msgid "Activate License"
|
| 42 |
msgstr ""
|
| 43 |
|
| 44 |
+
#: ../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
|
| 45 |
msgid "Deactivate License"
|
| 46 |
msgstr ""
|
| 47 |
|
| 69 |
msgid "Remove"
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:46, ../translatepress/partials/main-settings-language-selector.php:20, ../translatepress/partials/main-settings-language-selector.php:45
|
| 73 |
msgid "Choose..."
|
| 74 |
msgstr ""
|
| 75 |
|
| 76 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:53, ../translatepress/partials/main-settings-language-selector.php:52
|
| 77 |
msgid "Add"
|
| 78 |
msgstr ""
|
| 79 |
|
| 113 |
msgid "Only Flags"
|
| 114 |
msgstr ""
|
| 115 |
|
| 116 |
+
#: ../translatepress/includes/class-settings.php:338
|
| 117 |
msgid "Current Language"
|
| 118 |
msgstr ""
|
| 119 |
|
| 120 |
+
#: ../translatepress/includes/class-settings.php:379
|
| 121 |
msgid "General"
|
| 122 |
msgstr ""
|
| 123 |
|
| 124 |
+
#: ../translatepress/includes/class-settings.php:384, ../translatepress/includes/class-translation-manager.php:626
|
| 125 |
msgid "Translate Site"
|
| 126 |
msgstr ""
|
| 127 |
|
| 128 |
+
#: ../translatepress/includes/class-settings.php:392
|
| 129 |
msgid "License"
|
| 130 |
msgstr ""
|
| 131 |
|
| 132 |
+
#: ../translatepress/includes/class-settings.php:398
|
| 133 |
msgid "Addons"
|
| 134 |
msgstr ""
|
| 135 |
|
| 216 |
msgid "All Languages"
|
| 217 |
msgstr ""
|
| 218 |
|
| 219 |
+
#: ../translatepress/partials/main-settings-language-selector.php:56
|
| 220 |
msgid "Select the language you wish to make your website available in."
|
| 221 |
msgstr ""
|
| 222 |
|
| 223 |
+
#: ../translatepress/partials/main-settings-language-selector.php:62
|
| 224 |
msgid "To add <strong>more then two languages</strong> and support for SEO Title, Description, Slug and more checkout <a href=\"%s\" class=\"button button-primary\" target=\"_blank\" title=\"TranslatePress Pro\">TranslatePress PRO</a>"
|
| 225 |
msgstr ""
|
| 226 |
|
| 227 |
+
#: ../translatepress/partials/main-settings-language-selector.php:63
|
| 228 |
msgid "Not only you are getting extra features and premium support, you also help fund the future development of TranslatePress."
|
| 229 |
msgstr ""
|
| 230 |
|
| 352 |
msgid "Entire Response From wp_remote_get():"
|
| 353 |
msgstr ""
|
| 354 |
|
| 355 |
+
#: ../translatepress/partials/translation-manager.php:47
|
| 356 |
msgid "Saved!"
|
| 357 |
msgstr ""
|
| 358 |
|
| 359 |
+
#: ../translatepress/partials/translation-manager.php:51
|
| 360 |
msgid "Save translation"
|
| 361 |
msgstr ""
|
| 362 |
|
| 363 |
+
#: ../translatepress/partials/translation-manager.php:66
|
| 364 |
msgid "Select string to translate..."
|
| 365 |
msgstr ""
|
| 366 |
|
| 367 |
+
#: ../translatepress/partials/translation-manager.php:69
|
| 368 |
msgid "Gettext strings"
|
| 369 |
msgstr ""
|
| 370 |
|
| 371 |
+
#: ../translatepress/partials/translation-manager.php:74
|
| 372 |
msgid "Previous"
|
| 373 |
msgstr ""
|
| 374 |
|
| 375 |
+
#: ../translatepress/partials/translation-manager.php:75
|
| 376 |
msgid "Next"
|
| 377 |
msgstr ""
|
| 378 |
|
| 379 |
+
#: ../translatepress/partials/translation-manager.php:79
|
| 380 |
msgid "View as"
|
| 381 |
msgstr ""
|
| 382 |
|
| 383 |
+
#: ../translatepress/partials/translation-manager.php:82
|
| 384 |
msgid "Current User"
|
| 385 |
msgstr ""
|
| 386 |
|
| 387 |
+
#: ../translatepress/partials/translation-manager.php:82
|
| 388 |
msgid "Logged Out"
|
| 389 |
msgstr ""
|
| 390 |
|
| 391 |
+
#: ../translatepress/partials/translation-manager.php:93
|
| 392 |
msgid "Available in our Pro Versions"
|
| 393 |
msgstr ""
|
| 394 |
|
| 395 |
+
#: ../translatepress/partials/translation-manager.php:107
|
| 396 |
msgid "You have unsaved changes!"
|
| 397 |
msgstr ""
|
| 398 |
|
| 399 |
+
#: ../translatepress/partials/translation-manager.php:112
|
| 400 |
msgid "Original String"
|
| 401 |
msgstr ""
|
| 402 |
|
| 403 |
+
#: ../translatepress/partials/translation-manager.php:118, ../translatepress/partials/translation-manager.php:127
|
| 404 |
msgid "To %s"
|
| 405 |
msgstr ""
|
| 406 |
|
| 407 |
+
#: ../translatepress/partials/translation-manager.php:118, ../translatepress/partials/translation-manager.php:119
|
| 408 |
msgid "From %s"
|
| 409 |
msgstr ""
|
| 410 |
|
| 411 |
+
#: ../translatepress/partials/translation-manager.php:122, ../translatepress/partials/translation-manager.php:129
|
| 412 |
msgid "Discard changes"
|
| 413 |
msgstr ""
|
| 414 |
|
| 415 |
+
#: ../translatepress/partials/translation-manager.php:132
|
| 416 |
msgid "Other languages"
|
| 417 |
msgstr ""
|
| 418 |
|
| 419 |
+
#: ../translatepress/partials/translation-manager.php:146
|
| 420 |
msgid "You can add a new language from <a href=\"%s\">Settings->TranslatePress</a>"
|
| 421 |
msgstr ""
|
| 422 |
|
| 423 |
+
#: ../translatepress/partials/translation-manager.php:147
|
| 424 |
msgid "However, you can still use TranslatePress to <strong style=\"background: #f5fb9d;\">modify gettext strings</strong> available in your page."
|
| 425 |
msgstr ""
|
| 426 |
|
| 427 |
+
#: ../translatepress/partials/translation-manager.php:148
|
| 428 |
msgid "Strings that are user created can't be modified, only those from themes and plugins."
|
| 429 |
msgstr ""
|
| 430 |
|
| 431 |
+
#: ../translatepress/partials/translation-manager.php:159
|
| 432 |
msgid "Your Website <br/> Multiple Languages"
|
| 433 |
msgstr ""
|
| 434 |
|
| 435 |
+
#: ../translatepress/partials/translation-manager.php:161
|
| 436 |
msgid "Support for 221 Languages"
|
| 437 |
msgstr ""
|
| 438 |
|
| 439 |
+
#: ../translatepress/partials/translation-manager.php:162
|
| 440 |
msgid "Translate SEO Title, Description, Slug"
|
| 441 |
msgstr ""
|
| 442 |
|
| 443 |
+
#: ../translatepress/partials/translation-manager.php:163
|
| 444 |
msgid "Translate Facebook Tags"
|
| 445 |
msgstr ""
|
| 446 |
|
| 447 |
+
#: ../translatepress/partials/translation-manager.php:164
|
| 448 |
msgid "Create Translator Accounts"
|
| 449 |
msgstr ""
|
| 450 |
|
| 451 |
+
#: ../translatepress/partials/translation-manager.php:165
|
| 452 |
msgid "Publish when the translation is done"
|
| 453 |
msgstr ""
|
| 454 |
|
| 455 |
+
#: ../translatepress/partials/translation-manager.php:167
|
| 456 |
msgid "Supported By Real People"
|
| 457 |
msgstr ""
|
| 458 |
|
| 459 |
+
#: ../translatepress/partials/translation-manager.php:168
|
| 460 |
msgid "Learn More"
|
| 461 |
msgstr ""
|
| 462 |
|
partials/main-settings-language-selector.php
CHANGED
|
@@ -8,28 +8,10 @@
|
|
| 8 |
<th><?php _e( 'Slug', 'translatepress-multilingual' ); ?></th>
|
| 9 |
</tr>
|
| 10 |
</thead>
|
| 11 |
-
<tbody id="trp-sortable-languages">
|
| 12 |
|
| 13 |
<?php
|
| 14 |
-
|
| 15 |
-
// we should always have at least two languages in free version.
|
| 16 |
-
// edge case when enable multiple language addon, delete all languages and then disable multiple language addon. The free version won't be able to have two languages.
|
| 17 |
-
if( count($this->settings['translation-languages']) < 2 )
|
| 18 |
-
$this->settings['translation-languages'][] = '';
|
| 19 |
-
|
| 20 |
-
// we should force only two languages in the free version
|
| 21 |
-
$translation_languages = array();
|
| 22 |
-
foreach ($this->settings['translation-languages'] as $lang ){
|
| 23 |
-
if ( ( count($translation_languages) == 0 ) && ( $lang != $this->settings['default-language'] ) ){
|
| 24 |
-
$translation_languages[] = $lang;
|
| 25 |
-
} elseif( $lang == $this->settings['default-language']) {
|
| 26 |
-
$translation_languages[] = $lang;
|
| 27 |
-
} elseif( in_array($this->settings['default-language'], $translation_languages ) && count($translation_languages) == 1 ){
|
| 28 |
-
$translation_languages[] = $lang;
|
| 29 |
-
}
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
foreach ($translation_languages as $selected_language_code ){
|
| 33 |
$default_language = ( $selected_language_code == $this->settings['default-language'] );?>
|
| 34 |
<tr class="trp-language">
|
| 35 |
<td><span class="trp-sortable-handle"></span></td>
|
|
@@ -51,6 +33,9 @@
|
|
| 51 |
<td>
|
| 52 |
<input class="trp-language-slug" name="trp_settings[url-slugs][<?php echo $selected_language_code ?>]" type="text" style="text-transform: lowercase;" value="<?php echo $this->url_converter->get_url_slug( $selected_language_code, false ); ?>">
|
| 53 |
</td>
|
|
|
|
|
|
|
|
|
|
| 54 |
</tr>
|
| 55 |
<?php }?>
|
| 56 |
</tbody>
|
| 8 |
<th><?php _e( 'Slug', 'translatepress-multilingual' ); ?></th>
|
| 9 |
</tr>
|
| 10 |
</thead>
|
| 11 |
+
<tbody id="trp-sortable-languages" class="trp-language-selector-limited">
|
| 12 |
|
| 13 |
<?php
|
| 14 |
+
foreach ($this->settings['translation-languages'] as $selected_language_code ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
$default_language = ( $selected_language_code == $this->settings['default-language'] );?>
|
| 16 |
<tr class="trp-language">
|
| 17 |
<td><span class="trp-sortable-handle"></span></td>
|
| 33 |
<td>
|
| 34 |
<input class="trp-language-slug" name="trp_settings[url-slugs][<?php echo $selected_language_code ?>]" type="text" style="text-transform: lowercase;" value="<?php echo $this->url_converter->get_url_slug( $selected_language_code, false ); ?>">
|
| 35 |
</td>
|
| 36 |
+
<td>
|
| 37 |
+
<a class="trp-remove-language" style=" <?php echo ( $default_language ) ? 'display:none' : '' ?>" data-confirm-message="<?php _e( 'Are you sure you want to remove this language?', TRP_PLUGIN_SLUG ); ?>"><?php _e( 'Remove', TRP_PLUGIN_SLUG ); ?></a>
|
| 38 |
+
</td>
|
| 39 |
</tr>
|
| 40 |
<?php }?>
|
| 41 |
</tbody>
|
partials/translation-manager.php
CHANGED
|
@@ -38,6 +38,7 @@
|
|
| 38 |
</head>
|
| 39 |
<body>
|
| 40 |
<div id="trp-editor">
|
|
|
|
| 41 |
<div id="trp-controls">
|
| 42 |
<div class="trp-controls-container">
|
| 43 |
<div id="trp-close-save">
|
|
@@ -50,6 +51,7 @@
|
|
| 50 |
<button id="trp-save" type="submit" class="button-primary trp-save-string"><?php _e( 'Save translation', 'translatepress-multilingual' ); ?></button>
|
| 51 |
</div>
|
| 52 |
</div>
|
|
|
|
| 53 |
<div class="trp-controls-section">
|
| 54 |
<div class="trp-controls-section-content">
|
| 55 |
<form id="trp-language-switch-form" action="" method="GET">
|
|
@@ -97,6 +99,9 @@
|
|
| 97 |
<br class="clear">
|
| 98 |
|
| 99 |
</div>
|
|
|
|
|
|
|
|
|
|
| 100 |
<div class="trp-controls-section">
|
| 101 |
<div id="trp-translation-section" class="trp-controls-section-content">
|
| 102 |
<div id="trp-unsaved-changes-warning-message" style="display:none"><?php _e( 'You have unsaved changes!', 'translatepress-multilingual' );?></div>
|
|
@@ -133,6 +138,7 @@
|
|
| 133 |
</div>
|
| 134 |
</div>
|
| 135 |
|
|
|
|
| 136 |
|
| 137 |
<?php if( count( $trp_settings['translation-languages'] ) == 1 ) { ?>
|
| 138 |
<div class="trp-controls-section">
|
|
@@ -169,7 +175,7 @@
|
|
| 169 |
<iframe id="trp-preview-iframe" onload="trpEditor.initialize();" src="<?php echo add_query_arg( 'trp-edit-translation', 'preview', $current_url );?>" width="100%" height="100%"></iframe>
|
| 170 |
</div>
|
| 171 |
</div>
|
| 172 |
-
|
| 173 |
</body>
|
| 174 |
</html>
|
| 175 |
|
| 38 |
</head>
|
| 39 |
<body>
|
| 40 |
<div id="trp-editor">
|
| 41 |
+
<?php do_action( 'trp_translation_manager_before_controls' ); ?>
|
| 42 |
<div id="trp-controls">
|
| 43 |
<div class="trp-controls-container">
|
| 44 |
<div id="trp-close-save">
|
| 51 |
<button id="trp-save" type="submit" class="button-primary trp-save-string"><?php _e( 'Save translation', 'translatepress-multilingual' ); ?></button>
|
| 52 |
</div>
|
| 53 |
</div>
|
| 54 |
+
<?php do_action( 'trp_translation_manager_before_strings' ); ?>
|
| 55 |
<div class="trp-controls-section">
|
| 56 |
<div class="trp-controls-section-content">
|
| 57 |
<form id="trp-language-switch-form" action="" method="GET">
|
| 99 |
<br class="clear">
|
| 100 |
|
| 101 |
</div>
|
| 102 |
+
|
| 103 |
+
<?php do_action( 'trp_translation_manager_before_translations' ); ?>
|
| 104 |
+
|
| 105 |
<div class="trp-controls-section">
|
| 106 |
<div id="trp-translation-section" class="trp-controls-section-content">
|
| 107 |
<div id="trp-unsaved-changes-warning-message" style="display:none"><?php _e( 'You have unsaved changes!', 'translatepress-multilingual' );?></div>
|
| 138 |
</div>
|
| 139 |
</div>
|
| 140 |
|
| 141 |
+
<?php do_action( 'trp_translation_manager_after_translations' ); ?>
|
| 142 |
|
| 143 |
<?php if( count( $trp_settings['translation-languages'] ) == 1 ) { ?>
|
| 144 |
<div class="trp-controls-section">
|
| 175 |
<iframe id="trp-preview-iframe" onload="trpEditor.initialize();" src="<?php echo add_query_arg( 'trp-edit-translation', 'preview', $current_url );?>" width="100%" height="100%"></iframe>
|
| 176 |
</div>
|
| 177 |
</div>
|
| 178 |
+
<?php do_action( 'trp_translation_manager_footer' ); ?>
|
| 179 |
</body>
|
| 180 |
</html>
|
| 181 |
|
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: cozmoslabs, razvan.mo, madalin.ungureanu, cristophor
|
|
| 3 |
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.
|
| 7 |
-
Stable tag: 1.2.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -117,6 +117,15 @@ For more information please check out [TranslatePress documentation](https://tra
|
|
| 117 |
6. Menu Language Switcher
|
| 118 |
|
| 119 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
= 1.2.7 =
|
| 121 |
* Added a warning when changing the default language that it will invalidate their existing translations
|
| 122 |
* Fixed incorrect detection of the form action language parameter
|
| 3 |
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.2.8
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 117 |
6. Menu Language Switcher
|
| 118 |
|
| 119 |
== Changelog ==
|
| 120 |
+
= 1.2.8 =
|
| 121 |
+
* Added a lot of hooks in the translation manager interface so other people can insert new content there.
|
| 122 |
+
* We now take into account the presence of www or lack of it in custom links that might be local
|
| 123 |
+
* We now make sure we're not changing the locale in the backend if the language order is different.
|
| 124 |
+
* Fixed issue with incorrect language adding in the backend that caused notices in the front-end
|
| 125 |
+
* Removed obsolete function add_cookie
|
| 126 |
+
* Fixed trailingslashit over get_permalink in url-converter
|
| 127 |
+
* Removed adding cookie from php. Fixed enqueue_styles on license and add-ons tabs. Removed deprecated function.
|
| 128 |
+
|
| 129 |
= 1.2.7 =
|
| 130 |
* Added a warning when changing the default language that it will invalidate their existing translations
|
| 131 |
* Fixed incorrect detection of the form action language parameter
|
