Version Description
- Added support for word trim when the default language is japanese, chinese or thai.
- Exluded wp_trim_words funtion from our gettext filter to prevent som issues
- Fixed an issue with gettext inside attributes that passed through the wp_kses function.
- Fixed issues with the Customizer
- Added padding to the language switcher image so we don't conflict with themes that add extra padding to images inside links
- We no longer remove \r \n \t from the translation
- Fixed issue with title attribute that contained html
- Added a filter to all href attributes detected on our translation page
- Added a notice to inform admins of the missing mbstring php library
- We now send all error logs to debug.log
- Added cite and blockquote as top_parents for merge rule on Translation blocks
- Fixed nonce accidentally being passed through internationalized function
Download this release
Release Info
Developer | madalin.ungureanu |
Plugin | TranslatePress – Translate Multilingual sites |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.9 to 1.3.0
- assets/css/trp-floater-language-switcher.css +1 -0
- class-translate-press.php +13 -4
- includes/class-language-switcher.php +1 -1
- includes/class-translation-manager.php +61 -7
- includes/class-translation-render.php +2 -8
- includes/functions.php +81 -1
- index.php +1 -1
- languages/translatepress-multilingual.catalog.php +1 -0
- languages/translatepress-multilingual.pot +26 -25
- readme.txt +16 -1
assets/css/trp-floater-language-switcher.css
CHANGED
@@ -83,6 +83,7 @@
|
|
83 |
height: auto;
|
84 |
max-width: 100%;
|
85 |
display: inline;
|
|
|
86 |
}
|
87 |
|
88 |
#trp-floater-ls a {
|
83 |
height: auto;
|
84 |
max-width: 100%;
|
85 |
display: inline;
|
86 |
+
padding: 0;
|
87 |
}
|
88 |
|
89 |
#trp-floater-ls a {
|
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.
|
43 |
|
44 |
$this->load_dependencies();
|
45 |
$this->initialize_components();
|
@@ -176,8 +176,11 @@ class TRP_Translate_Press{
|
|
176 |
/* we need the esc_ functions for html and attributes not to escape our tags so we put them back */
|
177 |
$this->loader->add_filter( 'esc_html', $this->translation_manager, 'handle_esc_functions_for_gettext', 10, 2 );
|
178 |
$this->loader->add_filter( 'attribute_escape', $this->translation_manager, 'handle_esc_functions_for_gettext', 10, 2 );
|
179 |
-
/* we need to allow the trp-gettext tag in
|
180 |
$this->loader->add_filter( 'wp_kses_allowed_html', $this->translation_manager, 'handle_kses_functions_for_gettext', 10 );
|
|
|
|
|
|
|
181 |
/* we need to treat the date_i18n function differently so we remove the gettext wraps */
|
182 |
$this->loader->add_filter( 'date_i18n', $this->translation_manager, 'handle_date_i18n_function_for_gettext', 1, 4 );
|
183 |
|
@@ -191,7 +194,7 @@ class TRP_Translate_Press{
|
|
191 |
$this->loader->add_filter( 'wp_mail', $this->translation_render, 'wp_mail_filter', 200 );
|
192 |
|
193 |
/* hide php ors and notice when we are storing strings in db */
|
194 |
-
$this->loader->add_action( '
|
195 |
|
196 |
/* fix wptexturize to always replace with the default translated strings */
|
197 |
$this->loader->add_action( 'gettext_with_context', $this->translation_render, 'fix_wptexturize_characters', 999, 4 );
|
@@ -217,7 +220,13 @@ class TRP_Translate_Press{
|
|
217 |
* Register hooks to WP.
|
218 |
*/
|
219 |
public function run() {
|
220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
}
|
222 |
|
223 |
/**
|
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.3.0' );
|
43 |
|
44 |
$this->load_dependencies();
|
45 |
$this->initialize_components();
|
176 |
/* we need the esc_ functions for html and attributes not to escape our tags so we put them back */
|
177 |
$this->loader->add_filter( 'esc_html', $this->translation_manager, 'handle_esc_functions_for_gettext', 10, 2 );
|
178 |
$this->loader->add_filter( 'attribute_escape', $this->translation_manager, 'handle_esc_functions_for_gettext', 10, 2 );
|
179 |
+
/* we need to allow the trp-gettext tag in kses functions */
|
180 |
$this->loader->add_filter( 'wp_kses_allowed_html', $this->translation_manager, 'handle_kses_functions_for_gettext', 10 );
|
181 |
+
/* handle trp-gettext tag from attributes of other tags in kses functions*/
|
182 |
+
$this->loader->add_filter( 'pre_kses', $this->translation_manager, 'escape_gettext_from_attributes_kses', 5, 3 );
|
183 |
+
|
184 |
/* we need to treat the date_i18n function differently so we remove the gettext wraps */
|
185 |
$this->loader->add_filter( 'date_i18n', $this->translation_manager, 'handle_date_i18n_function_for_gettext', 1, 4 );
|
186 |
|
194 |
$this->loader->add_filter( 'wp_mail', $this->translation_render, 'wp_mail_filter', 200 );
|
195 |
|
196 |
/* hide php ors and notice when we are storing strings in db */
|
197 |
+
$this->loader->add_action( 'init', $this->translation_render, 'trp_debug_mode_off', 0 );
|
198 |
|
199 |
/* fix wptexturize to always replace with the default translated strings */
|
200 |
$this->loader->add_action( 'gettext_with_context', $this->translation_render, 'fix_wptexturize_characters', 999, 4 );
|
220 |
* Register hooks to WP.
|
221 |
*/
|
222 |
public function run() {
|
223 |
+
/*
|
224 |
+
* Hook that prevents running the hooks. Caution: some TP code like constructors of classes still run!
|
225 |
+
*/
|
226 |
+
$run_tp = apply_filters( 'trp_allow_tp_to_run', true );
|
227 |
+
if ( $run_tp ) {
|
228 |
+
$this->loader->run();
|
229 |
+
}
|
230 |
}
|
231 |
|
232 |
/**
|
includes/class-language-switcher.php
CHANGED
@@ -86,7 +86,7 @@ class TRP_Language_Switcher{
|
|
86 |
* Redirects to language stored in global $TRP_NEEDED_LANGUAGE
|
87 |
*/
|
88 |
public function redirect_to_correct_language(){
|
89 |
-
|
90 |
return;
|
91 |
}
|
92 |
global $TRP_NEEDED_LANGUAGE;
|
86 |
* Redirects to language stored in global $TRP_NEEDED_LANGUAGE
|
87 |
*/
|
88 |
public function redirect_to_correct_language(){
|
89 |
+
if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || is_customize_preview() ) {
|
90 |
return;
|
91 |
}
|
92 |
global $TRP_NEEDED_LANGUAGE;
|
includes/class-translation-manager.php
CHANGED
@@ -67,7 +67,7 @@ class TRP_Translation_Manager{
|
|
67 |
public function get_merge_rules(){
|
68 |
$localized_text = $this->localized_text();
|
69 |
$merge_rules = array (
|
70 |
-
'top_parents' => array( 'p', 'div', 'li', 'ol', 'ul', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7', 'body', 'footer', 'article', 'main', 'iframe', 'section', 'figure', 'figcaption' ),
|
71 |
'self_object_type' => array( 'translate-press' ),
|
72 |
'incompatible_siblings' => array( '[data-trpgettextoriginal]', '[data-trp-node-type="' . $localized_text['dynamicstrings'] . '"]' )
|
73 |
);
|
@@ -84,11 +84,11 @@ class TRP_Translation_Manager{
|
|
84 |
'metainformation' => __( 'Meta Information', 'translatepress-multilingual' ),
|
85 |
'stringlist' => __( 'String List', 'translatepress-multilingual' ),
|
86 |
'dynamicstrings' => __( 'Dynamic Added Strings', 'translatepress-multilingual' ),
|
87 |
-
'gettranslationsnonce' =>
|
88 |
-
'savestringsnonce' =>
|
89 |
-
'splittbnonce' =>
|
90 |
-
'gettextgettranslationsnonce' =>
|
91 |
-
'gettextsavetranslationsnonce' =>
|
92 |
'showdynamiccontentbeforetranslation' => apply_filters( 'trp_show_dynamic_content_before_translation', false )
|
93 |
);
|
94 |
return $text;
|
@@ -923,7 +923,8 @@ class TRP_Translation_Manager{
|
|
923 |
$callstack_function['function'] == 'get_bloginfo' ||
|
924 |
$callstack_function['function'] == 'wp_get_document_title' ||
|
925 |
$callstack_function['function'] == 'wp_title' ||
|
926 |
-
$callstack_function['function'] == 'wptexturize'
|
|
|
927 |
) {
|
928 |
return $translation;
|
929 |
}
|
@@ -1053,6 +1054,59 @@ class TRP_Translation_Manager{
|
|
1053 |
return $tags;
|
1054 |
}
|
1055 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1056 |
/**
|
1057 |
* make sure we remove the trp-gettext wrap from the format the date_i18n receives
|
1058 |
* ideally if in the gettext filter we would know 100% that a string is a valid date format then we would not wrap it but it seems that it is not easy to determine that ( explore further in the future $d = DateTime::createFromFormat('Y', date('y a') method); )
|
67 |
public function get_merge_rules(){
|
68 |
$localized_text = $this->localized_text();
|
69 |
$merge_rules = array (
|
70 |
+
'top_parents' => array( 'p', 'div', 'li', 'ol', 'ul', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7', 'body', 'footer', 'article', 'main', 'iframe', 'section', 'figure', 'figcaption', 'blockquote', 'cite' ),
|
71 |
'self_object_type' => array( 'translate-press' ),
|
72 |
'incompatible_siblings' => array( '[data-trpgettextoriginal]', '[data-trp-node-type="' . $localized_text['dynamicstrings'] . '"]' )
|
73 |
);
|
84 |
'metainformation' => __( 'Meta Information', 'translatepress-multilingual' ),
|
85 |
'stringlist' => __( 'String List', 'translatepress-multilingual' ),
|
86 |
'dynamicstrings' => __( 'Dynamic Added Strings', 'translatepress-multilingual' ),
|
87 |
+
'gettranslationsnonce' => wp_create_nonce('get_translations'), 'translatepress-multilingual',
|
88 |
+
'savestringsnonce' => wp_create_nonce('save_translations'), 'translatepress-multilingual',
|
89 |
+
'splittbnonce' => wp_create_nonce('split_translation_block'), 'translatepress-multilingual',
|
90 |
+
'gettextgettranslationsnonce' => wp_create_nonce('gettext_get_translations'), 'translatepress-multilingual',
|
91 |
+
'gettextsavetranslationsnonce' => wp_create_nonce('gettext_save_translations'), 'translatepress-multilingual',
|
92 |
'showdynamiccontentbeforetranslation' => apply_filters( 'trp_show_dynamic_content_before_translation', false )
|
93 |
);
|
94 |
return $text;
|
923 |
$callstack_function['function'] == 'get_bloginfo' ||
|
924 |
$callstack_function['function'] == 'wp_get_document_title' ||
|
925 |
$callstack_function['function'] == 'wp_title' ||
|
926 |
+
$callstack_function['function'] == 'wptexturize' ||
|
927 |
+
$callstack_function['function'] == 'wp_trim_words'
|
928 |
) {
|
929 |
return $translation;
|
930 |
}
|
1054 |
return $tags;
|
1055 |
}
|
1056 |
|
1057 |
+
/**
|
1058 |
+
* Copy function of esc_attr, unfiltered.
|
1059 |
+
*
|
1060 |
+
* Needed because all esc functions are hooked to handle_esc_functions_for_gettext, which will not escape trp-gettext tags
|
1061 |
+
*
|
1062 |
+
* @param $text string Text to escape
|
1063 |
+
*
|
1064 |
+
* @return string Escaped text
|
1065 |
+
*/
|
1066 |
+
function esc_attr_unfilttered( $text ){
|
1067 |
+
$safe_text = wp_check_invalid_utf8( $text );
|
1068 |
+
$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
|
1069 |
+
return $safe_text;
|
1070 |
+
}
|
1071 |
+
|
1072 |
+
/**
|
1073 |
+
* Escape attributes containing trp-gettext tag before passing to wp_kses.
|
1074 |
+
*
|
1075 |
+
* wp_kses will accidentally escape the parent tag, if another unescaped tag is present withing its attribute
|
1076 |
+
* Ex. <img alt="<trp-gettext>Placeholder</trp-gettext">"/> will be transformed by trp-gettext like this: <img alt="<trp-gettext>Placeholder</trp-gettext">"/>
|
1077 |
+
*
|
1078 |
+
* As a side consequence this function will disable translation of the string contained in the trp-gettext tag because there is no hook available that will allow us to undo the escaping the tags, after wp_kses is finished
|
1079 |
+
*
|
1080 |
+
* @param $string
|
1081 |
+
* @param $allowed_html
|
1082 |
+
* @param $allowed_protocols
|
1083 |
+
*
|
1084 |
+
* @return mixed
|
1085 |
+
*/
|
1086 |
+
function escape_gettext_from_attributes_kses( $string, $allowed_html, $allowed_protocols ){
|
1087 |
+
/* remove trp-gettext tag from attributes of other tags in kses functions*/
|
1088 |
+
$html_modified = false;
|
1089 |
+
if ( !is_admin () && strpos( $string, 'trp-gettext' ) !== false ) {
|
1090 |
+
$html = trp_str_get_html($string, true, true, TRP_DEFAULT_TARGET_CHARSET, false, TRP_DEFAULT_BR_TEXT, TRP_DEFAULT_SPAN_TEXT);
|
1091 |
+
foreach ( $html->find("*[!nuartrebuisaexiteatributulasta]") as $k => $row ) {
|
1092 |
+
$all_attributes = $row->getAllAttributes();
|
1093 |
+
if ( ! empty( $all_attributes ) ) {
|
1094 |
+
foreach ( $all_attributes as $attr_name => $attr_value ) {
|
1095 |
+
if ( strpos( $attr_value, 'trp-gettext' ) !== false ) {
|
1096 |
+
$row->setAttribute($attr_name, $this->esc_attr_unfilttered($attr_value));
|
1097 |
+
$html_modified = true;
|
1098 |
+
}
|
1099 |
+
}
|
1100 |
+
}
|
1101 |
+
}
|
1102 |
+
if ( $html_modified ){
|
1103 |
+
$string = $html->save();
|
1104 |
+
}
|
1105 |
+
}
|
1106 |
+
return $string;
|
1107 |
+
}
|
1108 |
+
|
1109 |
+
|
1110 |
/**
|
1111 |
* make sure we remove the trp-gettext wrap from the format the date_i18n receives
|
1112 |
* ideally if in the gettext filter we would know 100% that a string is a valid date format then we would not wrap it but it seems that it is not easy to determine that ( explore further in the future $d = DateTime::createFromFormat('Y', date('y a') method); )
|
includes/class-translation-render.php
CHANGED
@@ -45,14 +45,6 @@ class TRP_Translation_Render{
|
|
45 |
*/
|
46 |
public function trp_debug_mode_off(){
|
47 |
if ( WP_DEBUG ) {
|
48 |
-
global $TRP_LANGUAGE;
|
49 |
-
if (is_admin() ||
|
50 |
-
($TRP_LANGUAGE == $this->settings['default-language'] && (!isset($_REQUEST['trp-edit-translation']) || (isset($_REQUEST['trp-edit-translation']) && $_REQUEST['trp-edit-translation'] != 'preview'))) ||
|
51 |
-
(isset($_REQUEST['trp-edit-translation']) && $_REQUEST['trp-edit-translation'] == 'true')
|
52 |
-
) {
|
53 |
-
return; //don't do nothing if we are not storing strings
|
54 |
-
}
|
55 |
-
|
56 |
ini_set('display_errors', 0);
|
57 |
ini_set('log_errors', 1);
|
58 |
ini_set('error_log', WP_CONTENT_DIR . '/debug.log');
|
@@ -644,6 +636,8 @@ class TRP_Translation_Render{
|
|
644 |
|
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);
|
45 |
*/
|
46 |
public function trp_debug_mode_off(){
|
47 |
if ( WP_DEBUG ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
ini_set('display_errors', 0);
|
49 |
ini_set('log_errors', 1);
|
50 |
ini_set('error_log', WP_CONTENT_DIR . '/debug.log');
|
636 |
|
637 |
// force custom links to have the correct language
|
638 |
foreach( $html->find('a[href!="#"]') as $a_href) {
|
639 |
+
$a_href->href = apply_filters( 'trp_href_from_translated_page', $a_href->href, $this->settings['default-language'] );
|
640 |
+
|
641 |
$url = $a_href->href;
|
642 |
|
643 |
$url = $this->maybe_is_local_url($url);
|
includes/functions.php
CHANGED
@@ -138,7 +138,8 @@ function trp_add_affiliate_id_to_link( $link ){
|
|
138 |
function trp_sanitize_string( $filtered ){
|
139 |
$filtered = preg_replace( '/<script\b[^>]*>(.*?)<\/script>/is', '', $filtered );
|
140 |
|
141 |
-
|
|
|
142 |
$filtered = trim( $filtered );
|
143 |
|
144 |
$found = false;
|
@@ -174,3 +175,82 @@ function trp_elementor_compatibility( $allow_redirect ){
|
|
174 |
return $allow_redirect;
|
175 |
}
|
176 |
add_filter( 'trp_allow_language_redirect', 'trp_elementor_compatibility' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
function trp_sanitize_string( $filtered ){
|
139 |
$filtered = preg_replace( '/<script\b[^>]*>(.*?)<\/script>/is', '', $filtered );
|
140 |
|
141 |
+
// don't remove \r \n \t. They are part of the translation, they give structure and context to the text.
|
142 |
+
//$filtered = preg_replace( '/[\r\n\t ]+/', ' ', $filtered );
|
143 |
$filtered = trim( $filtered );
|
144 |
|
145 |
$found = false;
|
175 |
return $allow_redirect;
|
176 |
}
|
177 |
add_filter( 'trp_allow_language_redirect', 'trp_elementor_compatibility' );
|
178 |
+
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Mb Strings missing PHP library error notice
|
182 |
+
*/
|
183 |
+
function trp_mbstrings_notification(){
|
184 |
+
echo '<div class="notice notice-error"><p>' . __( '<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' ) . '</p></div>';
|
185 |
+
}
|
186 |
+
|
187 |
+
function trp_missing_mbstrings_library( $allow_to_run ){
|
188 |
+
if ( ! extension_loaded('mbstring') ) {
|
189 |
+
add_action( 'admin_menu', 'trp_mbstrings_notification' );
|
190 |
+
return false;
|
191 |
+
}
|
192 |
+
return $allow_to_run;
|
193 |
+
}
|
194 |
+
add_filter( 'trp_allow_tp_to_run', 'trp_missing_mbstrings_library' );
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Don't have html inside menu title tags. Some themes just put in the title the content of the link without striping HTML
|
198 |
+
*/
|
199 |
+
add_filter( 'nav_menu_link_attributes', 'trp_remove_html_from_menu_title', 10, 3);
|
200 |
+
function trp_remove_html_from_menu_title( $atts, $item, $args ){
|
201 |
+
$atts['title'] = wp_strip_all_tags($atts['title']);
|
202 |
+
return $atts;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Rework wp_trim_words so we can trim Chinese, Japanese and Thai words since they are based on characters as words.
|
207 |
+
*
|
208 |
+
* @since 1.3.0
|
209 |
+
*
|
210 |
+
* @param string $text Text to trim.
|
211 |
+
* @param int $num_words Number of words. Default 55.
|
212 |
+
* @param string $more Optional. What to append if $text needs to be trimmed. Default '…'.
|
213 |
+
* @return string Trimmed text.
|
214 |
+
*/
|
215 |
+
function trp_wp_trim_words( $text, $num_words = 55, $more = null, $original_text ) {
|
216 |
+
if ( null === $more ) {
|
217 |
+
$more = __( '…' );
|
218 |
+
}
|
219 |
+
// what we receive is the short text in the filter
|
220 |
+
$text = $original_text;
|
221 |
+
$text = wp_strip_all_tags( $text );
|
222 |
+
|
223 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
224 |
+
$trp_settings = $trp->get_component( 'settings' );
|
225 |
+
$settings = $trp_settings->get_settings();
|
226 |
+
|
227 |
+
$default_language= $settings["default-language"];
|
228 |
+
|
229 |
+
$char_is_word = false;
|
230 |
+
foreach (array('ch', 'ja', 'tw') as $lang){
|
231 |
+
if (strpos($default_language, $lang) !== false){
|
232 |
+
$char_is_word = true;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
if ( $char_is_word && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
|
237 |
+
$text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
|
238 |
+
preg_match_all( '/./u', $text, $words_array );
|
239 |
+
$words_array = array_slice( $words_array[0], 0, $num_words + 1 );
|
240 |
+
$sep = '';
|
241 |
+
} else {
|
242 |
+
$words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
|
243 |
+
$sep = ' ';
|
244 |
+
}
|
245 |
+
|
246 |
+
if ( count( $words_array ) > $num_words ) {
|
247 |
+
array_pop( $words_array );
|
248 |
+
$text = implode( $sep, $words_array );
|
249 |
+
$text = $text . $more;
|
250 |
+
} else {
|
251 |
+
$text = implode( $sep, $words_array );
|
252 |
+
}
|
253 |
+
|
254 |
+
return $text;
|
255 |
+
}
|
256 |
+
add_filter('wp_trim_words', 'trp_wp_trim_words', 100, 4);
|
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.
|
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.3.0
|
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
@@ -55,6 +55,7 @@
|
|
55 |
<?php __("Twitter Description", "translatepress-multilingual"); ?>
|
56 |
<?php __("Post Slug", "translatepress-multilingual"); ?>
|
57 |
<?php __("Page Title", "translatepress-multilingual"); ?>
|
|
|
58 |
<?php __("All Languages", "translatepress-multilingual"); ?>
|
59 |
<?php __("Select the language you wish to make your website available in.", "translatepress-multilingual"); ?>
|
60 |
<?php __("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>", "translatepress-multilingual"); ?>
|
55 |
<?php __("Twitter Description", "translatepress-multilingual"); ?>
|
56 |
<?php __("Post Slug", "translatepress-multilingual"); ?>
|
57 |
<?php __("Page Title", "translatepress-multilingual"); ?>
|
58 |
+
<?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"); ?>
|
59 |
<?php __("All Languages", "translatepress-multilingual"); ?>
|
60 |
<?php __("Select the language you wish to make your website available in.", "translatepress-multilingual"); ?>
|
61 |
<?php __("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>", "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,51 +25,51 @@ 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 |
|
@@ -193,9 +193,6 @@ msgstr ""
|
|
193 |
msgid "Dynamic Added Strings"
|
194 |
msgstr ""
|
195 |
|
196 |
-
#: ../translatepress/includes/class-translation-manager.php:87, ../translatepress/includes/class-translation-manager.php:88, ../translatepress/includes/class-translation-manager.php:89, ../translatepress/includes/class-translation-manager.php:90, ../translatepress/includes/class-translation-manager.php:91
|
197 |
-
msgstr ""
|
198 |
-
|
199 |
#: ../translatepress/includes/class-translation-manager.php:638
|
200 |
msgid "Translate Page"
|
201 |
msgstr ""
|
@@ -204,42 +201,46 @@ msgstr ""
|
|
204 |
msgid "Settings"
|
205 |
msgstr ""
|
206 |
|
207 |
-
#: ../translatepress/includes/class-translation-manager.php:
|
208 |
msgid "Security check"
|
209 |
msgstr ""
|
210 |
|
211 |
-
#: ../translatepress/includes/class-translation-render.php:
|
212 |
msgid "Description"
|
213 |
msgstr ""
|
214 |
|
215 |
-
#: ../translatepress/includes/class-translation-render.php:
|
216 |
msgid "OG Title"
|
217 |
msgstr ""
|
218 |
|
219 |
-
#: ../translatepress/includes/class-translation-render.php:
|
220 |
msgid "OG Site Name"
|
221 |
msgstr ""
|
222 |
|
223 |
-
#: ../translatepress/includes/class-translation-render.php:
|
224 |
msgid "OG Description"
|
225 |
msgstr ""
|
226 |
|
227 |
-
#: ../translatepress/includes/class-translation-render.php:
|
228 |
msgid "Twitter Title"
|
229 |
msgstr ""
|
230 |
|
231 |
-
#: ../translatepress/includes/class-translation-render.php:
|
232 |
msgid "Twitter Description"
|
233 |
msgstr ""
|
234 |
|
235 |
-
#: ../translatepress/includes/class-translation-render.php:
|
236 |
msgid "Post Slug"
|
237 |
msgstr ""
|
238 |
|
239 |
-
#: ../translatepress/includes/class-translation-render.php:
|
240 |
msgid "Page Title"
|
241 |
msgstr ""
|
242 |
|
|
|
|
|
|
|
|
|
243 |
#: ../translatepress/partials/main-settings-language-selector.php:2
|
244 |
msgid "All Languages"
|
245 |
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:17, ../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 |
|
193 |
msgid "Dynamic Added Strings"
|
194 |
msgstr ""
|
195 |
|
|
|
|
|
|
|
196 |
#: ../translatepress/includes/class-translation-manager.php:638
|
197 |
msgid "Translate Page"
|
198 |
msgstr ""
|
201 |
msgid "Settings"
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: ../translatepress/includes/class-translation-manager.php:1197
|
205 |
msgid "Security check"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: ../translatepress/includes/class-translation-render.php:159
|
209 |
msgid "Description"
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: ../translatepress/includes/class-translation-render.php:165
|
213 |
msgid "OG Title"
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: ../translatepress/includes/class-translation-render.php:171
|
217 |
msgid "OG Site Name"
|
218 |
msgstr ""
|
219 |
|
220 |
+
#: ../translatepress/includes/class-translation-render.php:177
|
221 |
msgid "OG Description"
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: ../translatepress/includes/class-translation-render.php:183
|
225 |
msgid "Twitter Title"
|
226 |
msgstr ""
|
227 |
|
228 |
+
#: ../translatepress/includes/class-translation-render.php:189
|
229 |
msgid "Twitter Description"
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: ../translatepress/includes/class-translation-render.php:195
|
233 |
msgid "Post Slug"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: ../translatepress/includes/class-translation-render.php:199
|
237 |
msgid "Page Title"
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: ../translatepress/includes/functions.php:184
|
241 |
+
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."
|
242 |
+
msgstr ""
|
243 |
+
|
244 |
#: ../translatepress/partials/main-settings-language-selector.php:2
|
245 |
msgid "All Languages"
|
246 |
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -57,6 +57,7 @@ TranslatePress - Multilingual has a range of premium [Add-ons](https://translate
|
|
57 |
* [Translator Accounts](https://translatepress.com/docs/addons/translator-accounts/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - create or allow existing users to translate the site without admin rights
|
58 |
* [Browse as User Role](https://translatepress.com/docs/addons/browse-as-role/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - view and translate content that is visible only to a particular user role
|
59 |
* [Navigation Based on Language](https://translatepress.com/docs/addons/navigate-based-language/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - configure and display different menu items for different languages
|
|
|
60 |
|
61 |
**Free Add-ons**
|
62 |
|
@@ -117,6 +118,20 @@ For more information please check out [TranslatePress documentation](https://tra
|
|
117 |
6. Menu Language Switcher
|
118 |
|
119 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
= 1.2.9 =
|
121 |
* Rearranged and renamed some languages in the options dropdown
|
122 |
* Fixed flag of Khmer language
|
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.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
57 |
* [Translator Accounts](https://translatepress.com/docs/addons/translator-accounts/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - create or allow existing users to translate the site without admin rights
|
58 |
* [Browse as User Role](https://translatepress.com/docs/addons/browse-as-role/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - view and translate content that is visible only to a particular user role
|
59 |
* [Navigation Based on Language](https://translatepress.com/docs/addons/navigate-based-language/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - configure and display different menu items for different languages
|
60 |
+
* [Automatic User Language Detection](https://translatepress.com/docs/addons/automatic-user-language-detection/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - redirect first time visitors to their preferred language based on their browser settings or IP address
|
61 |
|
62 |
**Free Add-ons**
|
63 |
|
118 |
6. Menu Language Switcher
|
119 |
|
120 |
== Changelog ==
|
121 |
+
= 1.3.0 =
|
122 |
+
* Added support for word trim when the default language is japanese, chinese or thai.
|
123 |
+
* Exluded wp_trim_words funtion from our gettext filter to prevent som issues
|
124 |
+
* Fixed an issue with gettext inside attributes that passed through the wp_kses function.
|
125 |
+
* Fixed issues with the Customizer
|
126 |
+
* Added padding to the language switcher image so we don't conflict with themes that add extra padding to images inside links
|
127 |
+
* We no longer remove \r \n \t from the translation
|
128 |
+
* Fixed issue with title attribute that contained html
|
129 |
+
* Added a filter to all href attributes detected on our translation page
|
130 |
+
* Added a notice to inform admins of the missing mbstring php library
|
131 |
+
* We now send all error logs to debug.log
|
132 |
+
* Added cite and blockquote as top_parents for merge rule on Translation blocks
|
133 |
+
* Fixed nonce accidentally being passed through internationalized function
|
134 |
+
|
135 |
= 1.2.9 =
|
136 |
* Rearranged and renamed some languages in the options dropdown
|
137 |
* Fixed flag of Khmer language
|