TranslatePress – Translate Multilingual sites - Version 1.0.9

Version Description

  • We now flush permalinks when saving the settings page to avoid getting 404 and 500 errors
  • Added the current language as a class on the body tag. Ex: translatepress-en_US
  • Small readme changes
Download this release

Release Info

Developer madalin.ungureanu
Plugin Icon 128x128 TranslatePress – Translate Multilingual sites
Version 1.0.9
Comparing to
See all releases

Code changes from version 1.0.8 to 1.0.9

assets/css/trp-back-end-style.css CHANGED
@@ -120,4 +120,10 @@ input.trp-translation-published{
120
 
121
  .trp-ls-select-option{
122
  margin-top: 10px;
 
 
 
 
 
 
123
  }
120
 
121
  .trp-ls-select-option{
122
  margin-top: 10px;
123
+ }
124
+
125
+ .trp-upsell-multiple-languages{
126
+ border: 1px solid #a00;
127
+ padding: 1rem;
128
+ background: #fff;
129
  }
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.0.8' );
43
 
44
  $this->load_dependencies();
45
  $this->initialize_components();
@@ -190,6 +190,9 @@ class TRP_Translate_Press{
190
  * we can't flush the permalinks on every page load so we filter the rewrite_rules option
191
  */
192
  $this->loader->add_filter( "option_rewrite_rules", $this->url_converter, 'woocommerce_filter_permalinks_on_other_languages' );
 
 
 
193
  }
194
 
195
  /**
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.0.9' );
43
 
44
  $this->load_dependencies();
45
  $this->initialize_components();
190
  * we can't flush the permalinks on every page load so we filter the rewrite_rules option
191
  */
192
  $this->loader->add_filter( "option_rewrite_rules", $this->url_converter, 'woocommerce_filter_permalinks_on_other_languages' );
193
+
194
+ /* add to the body class the current language */
195
+ $this->loader->add_filter( "body_class", $this->translation_manager, 'add_language_to_body_class' );
196
  }
197
 
198
  /**
includes/class-translation-manager.php CHANGED
@@ -838,5 +838,18 @@ class TRP_Translation_Manager{
838
  return $j;
839
 
840
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
841
 
842
  }
838
  return $j;
839
 
840
  }
841
+
842
+ /**
843
+ * Add the current language as a class to the body
844
+ * @param $classes
845
+ * @return array
846
+ */
847
+ public function add_language_to_body_class( $classes ){
848
+ global $TRP_LANGUAGE;
849
+ if( !empty( $TRP_LANGUAGE ) ){
850
+ $classes[] = 'translatepress-'.$TRP_LANGUAGE;
851
+ }
852
+ return $classes;
853
+ }
854
 
855
  }
includes/functions.php CHANGED
@@ -108,4 +108,22 @@ function trp_find_translation_location_for_domain( $domain, $language ){
108
  }
109
 
110
  return $path;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  }
108
  }
109
 
110
  return $path;
111
+ }
112
+
113
+ /**
114
+ * Function that appends the affiliate_id to a given url
115
+ * @param $link string the given url to append
116
+ * @return string url with the added affiliate_id
117
+ */
118
+ function trp_add_affiliate_id_to_link( $link ){
119
+
120
+ $affiliate_id = get_option('translatepress_affiliate_id');
121
+
122
+ if ( !empty( $affiliate_id ) ) {
123
+
124
+ return esc_url( add_query_arg( 'ref', $affiliate_id, $link ) );
125
+
126
+ }
127
+
128
+ return esc_url( $link );
129
  }
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.0.8
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  License: GPL2
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.0.9
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  License: GPL2
partials/addons-settings-page.php CHANGED
@@ -13,7 +13,7 @@
13
  <div class="grid">
14
  <div class="grid-cell" style="overflow:hidden;">
15
  <a href="https://translatepress.com/pricing/" target="_blank"><img src="<?php echo plugins_url('../assets/images/seo_icon_translatepress.png', __FILE__) ?>" alt="SEO" style="float: left; margin: 0 1.5rem 1.5rem 0;"></a>
16
- <h3><a href="https://translatepress.com/pricing/" target="_blank">SEO Pack</a></h3>
17
  <p>SEO support for page slug, page title, description and facebook and twitter social graph information. The HTML lang attribute is properly set.</p>
18
  </div>
19
  </div>
@@ -21,7 +21,7 @@
21
  <div class="grid">
22
  <div class="grid-cell" style="overflow:hidden;">
23
  <a href="https://translatepress.com/pricing/" target="_blank"><img src="<?php echo plugins_url('../assets/images/multiple_lang_icon.png', __FILE__) ?>" alt="Multiple Languages" style="float: left; margin: 0 1.5rem 1.5rem 0;"></a>
24
- <h3><a href="https://translatepress.com/pricing/" target="_blank">Multiple Languages</a></h3>
25
  <p>Add as many languages as you need for your project to go global.<br>
26
  Publish your language only when all your translations are done. </p>
27
  </div>
@@ -30,7 +30,7 @@
30
  <div class="grid">
31
  <div class="grid-cell" style="overflow:hidden;">
32
  <a href="https://translatepress.com/pricing/" target="_blank"><img src="<?php echo plugins_url('../assets/images/translator-accounts-addon.png', __FILE__) ?>" alt="Translator Account" style="float: left; margin: 0 1.5rem 1.5rem 0;"></a>
33
- <h3><a href="https://translatepress.com/pricing/" target="_blank">Translator Accounts</a></h3>
34
  <p>Create translator accounts for new users or allow existing users <br/>that are not administrators to translate your website.</p>
35
  </div>
36
  </div>
13
  <div class="grid">
14
  <div class="grid-cell" style="overflow:hidden;">
15
  <a href="https://translatepress.com/pricing/" target="_blank"><img src="<?php echo plugins_url('../assets/images/seo_icon_translatepress.png', __FILE__) ?>" alt="SEO" style="float: left; margin: 0 1.5rem 1.5rem 0;"></a>
16
+ <h3><a href=" <?php echo trp_add_affiliate_id_to_link('https://translatepress.com/pricing/?utm_source=wpbackend&utm_medium=clientsite&utm_content=addons_tab&utm_campaign=tpfree') ?> " target="_blank"> SEO Pack</a></h3>
17
  <p>SEO support for page slug, page title, description and facebook and twitter social graph information. The HTML lang attribute is properly set.</p>
18
  </div>
19
  </div>
21
  <div class="grid">
22
  <div class="grid-cell" style="overflow:hidden;">
23
  <a href="https://translatepress.com/pricing/" target="_blank"><img src="<?php echo plugins_url('../assets/images/multiple_lang_icon.png', __FILE__) ?>" alt="Multiple Languages" style="float: left; margin: 0 1.5rem 1.5rem 0;"></a>
24
+ <h3><a href=" <?php echo trp_add_affiliate_id_to_link('https://translatepress.com/pricing/?utm_source=wpbackend&utm_medium=clientsite&utm_content=addons_tab&utm_campaign=tpfree') ?> " target="_blank"> Multiple Languages</a></h3>
25
  <p>Add as many languages as you need for your project to go global.<br>
26
  Publish your language only when all your translations are done. </p>
27
  </div>
30
  <div class="grid">
31
  <div class="grid-cell" style="overflow:hidden;">
32
  <a href="https://translatepress.com/pricing/" target="_blank"><img src="<?php echo plugins_url('../assets/images/translator-accounts-addon.png', __FILE__) ?>" alt="Translator Account" style="float: left; margin: 0 1.5rem 1.5rem 0;"></a>
33
+ <h3><a href=" <?php echo trp_add_affiliate_id_to_link('https://translatepress.com/pricing/?utm_source=wpbackend&utm_medium=clientsite&utm_content=addons_tab&utm_campaign=tpfree') ?> " target="_blank"> Translator Accounts</a></h3>
34
  <p>Create translator accounts for new users or allow existing users <br/>that are not administrators to translate your website.</p>
35
  </div>
36
  </div>
partials/translation-manager.php CHANGED
@@ -139,7 +139,7 @@
139
  <li><?php _e('Publish when the translation is done', 'translatepress-multilingual' ); ?></li>
140
  </ul>
141
  <p><span style="background: #f5fb9d;"><?php _e('Supported By Real People', 'translatepress-multilingual' ); ?></span></p>
142
- <p><a class="button-primary" target="_blank" href="https://translatepress.com/pricing/?utm_source=wpbackend&utm_medium=clientsite&utm_content=tpeditor&utm_campaign=tpfree"><?php _e('Learn More', 'translatepress-multilingual' ); ?></a></p>
143
  </div>
144
  </div>
145
  <?php endif; ?>
139
  <li><?php _e('Publish when the translation is done', 'translatepress-multilingual' ); ?></li>
140
  </ul>
141
  <p><span style="background: #f5fb9d;"><?php _e('Supported By Real People', 'translatepress-multilingual' ); ?></span></p>
142
+ <p><a class="button-primary" target="_blank" href=" <?php echo trp_add_affiliate_id_to_link('https://translatepress.com/pricing/?utm_source=wpbackend&utm_medium=clientsite&utm_content=tpeditor&utm_campaign=tpfree')?> "><?php _e('Learn More', 'translatepress-multilingual' ); ?></a></p>
143
  </div>
144
  </div>
145
  <?php endif; ?>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.cozmoslabs.com/
4
  Tags: translate, translation, multilingual, automatic translation, front-end translation, google translate, bilingual
5
  Requires at least: 3.1.0
6
  Tested up to: 4.9.0
7
- Stable tag: 1.0.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -28,7 +28,7 @@ Built the WordPress way, TranslatePress - Multilingual is a GPL and self hosted
28
  * Integrates with Google Translate, allowing you to set up Automatic Translation using your own Google API key.
29
  * Place language switchers anywhere using shortcode **[language-switcher]**, WP menu item or as a floating dropdown.
30
  * Editorial control allowing you to publish your language only when all your translations are done
31
- * Conditional display content shortcode based on language [trp_language language="en_EN"] English content only [/trp_language]
32
  * Possibility to edit gettext strings from themes and plugins from english to english, without adding another language. Basically a string-replace functionality.
33
 
34
  Note: this plugin uses the Google Translation API to translate the strings on your site. This feature can be enabled or disabled according to your preferences.
@@ -107,6 +107,11 @@ For more information please check out [TranslatePress documentation](https://tra
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
110
  = 1.0.8 =
111
  * We now allow HTML in normal strings translations.
112
  * Changed the way we get the default language permalinks in Woocommerce rewrites
4
  Tags: translate, translation, multilingual, automatic translation, front-end translation, google translate, bilingual
5
  Requires at least: 3.1.0
6
  Tested up to: 4.9.0
7
+ Stable tag: 1.0.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
28
  * Integrates with Google Translate, allowing you to set up Automatic Translation using your own Google API key.
29
  * Place language switchers anywhere using shortcode **[language-switcher]**, WP menu item or as a floating dropdown.
30
  * Editorial control allowing you to publish your language only when all your translations are done
31
+ * Conditional display content shortcode based on language [trp_language language="en_US"] English content only [/trp_language]
32
  * Possibility to edit gettext strings from themes and plugins from english to english, without adding another language. Basically a string-replace functionality.
33
 
34
  Note: this plugin uses the Google Translation API to translate the strings on your site. This feature can be enabled or disabled according to your preferences.
107
 
108
  == Changelog ==
109
 
110
+ = 1.0.9 =
111
+ * We now flush permalinks when saving the settings page to avoid getting 404 and 500 errors
112
+ * Added the current language as a class on the body tag. Ex: translatepress-en_US
113
+ * Small readme changes
114
+
115
  = 1.0.8 =
116
  * We now allow HTML in normal strings translations.
117
  * Changed the way we get the default language permalinks in Woocommerce rewrites