Version Description
- Added machine translation limit
- Added setting for translation memory limit
- Fixed encoding for the "Fix broken html feature"
- Fixed CSS for translate button in TP Editor
- Fixed disabling dynamic translation in translation editor when it is disabled from Advanced option
Download this release
Release Info
Developer | madalin.ungureanu |
Plugin | TranslatePress – Translate Multilingual sites |
Version | 1.5.8 |
Comparing to | |
See all releases |
Code changes from version 1.5.7 to 1.5.8
- assets/css/trp-preview-iframe-style.css +4 -0
- class-translate-press.php +337 -333
- includes/advanced-settings/disable-dynamic-translation.php +9 -0
- includes/advanced-settings/machine-translation-limits.php +78 -0
- includes/class-advanced-tab.php +102 -8
- includes/class-machine-translator-logger.php +142 -0
- includes/class-machine-translator.php +19 -2
- includes/class-plugin-notices.php +35 -1
- includes/class-query.php +41 -1
- includes/class-settings.php +23 -5
- includes/class-translation-render.php +3 -1
- index.php +63 -63
- languages/translatepress-multilingual.catalog.php +7 -0
- languages/translatepress-multilingual.pot +48 -20
- readme.txt +561 -554
assets/css/trp-preview-iframe-style.css
CHANGED
@@ -33,6 +33,10 @@
|
|
33 |
background: #008ec2!important;
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
36 |
.trp-icon svg {
|
37 |
fill: #fff;
|
38 |
min-width: 20px;
|
33 |
background: #008ec2!important;
|
34 |
}
|
35 |
|
36 |
+
.trp-icon:before{
|
37 |
+
display:block !important;
|
38 |
+
}
|
39 |
+
|
40 |
.trp-icon svg {
|
41 |
fill: #fff;
|
42 |
min-width: 20px;
|
class-translate-press.php
CHANGED
@@ -1,333 +1,337 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class TRP_Translate_Press
|
5 |
-
*
|
6 |
-
* Singleton. Loads required files, initializes components and hooks methods.
|
7 |
-
*
|
8 |
-
*/
|
9 |
-
class TRP_Translate_Press{
|
10 |
-
protected $loader;
|
11 |
-
protected $settings;
|
12 |
-
protected $translation_render;
|
13 |
-
protected $machine_translator;
|
14 |
-
protected $
|
15 |
-
protected $
|
16 |
-
protected $
|
17 |
-
protected $
|
18 |
-
protected $
|
19 |
-
protected $
|
20 |
-
protected $
|
21 |
-
protected $
|
22 |
-
protected $
|
23 |
-
protected $
|
24 |
-
protected $
|
25 |
-
protected $
|
26 |
-
protected $
|
27 |
-
|
28 |
-
|
29 |
-
public
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
*
|
34 |
-
*
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
define( '
|
50 |
-
define( '
|
51 |
-
define( '
|
52 |
-
define( '
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
$this->
|
58 |
-
$this->
|
59 |
-
$this->
|
60 |
-
$this->
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
*
|
66 |
-
*
|
67 |
-
*
|
68 |
-
* '
|
69 |
-
*
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
81 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
82 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-
|
83 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
84 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
85 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
86 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
87 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
88 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
89 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
90 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
91 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
92 |
-
|
93 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
94 |
-
|
95 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-
|
96 |
-
require_once TRP_PLUGIN_DIR . 'includes/
|
97 |
-
require_once TRP_PLUGIN_DIR . 'includes/
|
98 |
-
require_once TRP_PLUGIN_DIR . '
|
99 |
-
require_once TRP_PLUGIN_DIR . 'includes/
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
$this->
|
110 |
-
$this->
|
111 |
-
|
112 |
-
$this->
|
113 |
-
$this->
|
114 |
-
|
115 |
-
$this->
|
116 |
-
$this->
|
117 |
-
$this->
|
118 |
-
$this->
|
119 |
-
$this->
|
120 |
-
$this->
|
121 |
-
$this->
|
122 |
-
$this->
|
123 |
-
$this->
|
124 |
-
$this->
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
//
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
"tp-add-on-
|
143 |
-
"tp-add-on-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
$this->loader->
|
164 |
-
$this->loader->add_action( '
|
165 |
-
$this->loader->add_action( '
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
$this->loader->add_action( '
|
172 |
-
|
173 |
-
|
174 |
-
$this->loader->add_action( '
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
$this->loader->
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
$this->loader->
|
229 |
-
$this->loader->
|
230 |
-
$this->loader->
|
231 |
-
|
232 |
-
$this->loader->add_filter(
|
233 |
-
$this->loader->
|
234 |
-
$this->loader->
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
$this->loader->add_action( '
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
$this->loader->add_action( '
|
252 |
-
$this->loader->add_filter( '
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
$this->loader->add_filter( '
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
$this->loader->
|
262 |
-
$this->loader->add_filter( '
|
263 |
-
|
264 |
-
|
265 |
-
$this->loader->add_filter( '
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
$this->loader->
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
$this->loader->
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
$this->loader->add_filter( '
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
$this->loader->add_filter( "
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class TRP_Translate_Press
|
5 |
+
*
|
6 |
+
* Singleton. Loads required files, initializes components and hooks methods.
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
class TRP_Translate_Press{
|
10 |
+
protected $loader;
|
11 |
+
protected $settings;
|
12 |
+
protected $translation_render;
|
13 |
+
protected $machine_translator;
|
14 |
+
protected $machine_translator_logger;
|
15 |
+
protected $query;
|
16 |
+
protected $language_switcher;
|
17 |
+
protected $translation_manager;
|
18 |
+
protected $editor_api_regular_strings;
|
19 |
+
protected $editor_api_gettext_strings;
|
20 |
+
protected $url_converter;
|
21 |
+
protected $languages;
|
22 |
+
protected $slug_manager;
|
23 |
+
protected $upgrade;
|
24 |
+
protected $plugin_updater;
|
25 |
+
protected $license_page;
|
26 |
+
protected $advanced_tab;
|
27 |
+
protected $translation_memory;
|
28 |
+
|
29 |
+
public $active_pro_addons = array();
|
30 |
+
public static $translate_press = null;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Get singleton object.
|
34 |
+
*
|
35 |
+
* @return TRP_Translate_Press Singleton object.
|
36 |
+
*/
|
37 |
+
public static function get_trp_instance(){
|
38 |
+
if ( self::$translate_press == null ){
|
39 |
+
self::$translate_press = new TRP_Translate_Press();
|
40 |
+
}
|
41 |
+
|
42 |
+
return self::$translate_press;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* TRP_Translate_Press constructor.
|
47 |
+
*/
|
48 |
+
public function __construct() {
|
49 |
+
define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
50 |
+
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
51 |
+
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
52 |
+
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
53 |
+
define( 'TRP_PLUGIN_VERSION', '1.5.8' );
|
54 |
+
|
55 |
+
wp_cache_add_non_persistent_groups(array('trp'));
|
56 |
+
|
57 |
+
$this->load_dependencies();
|
58 |
+
$this->initialize_components();
|
59 |
+
$this->get_active_pro_addons();
|
60 |
+
$this->define_admin_hooks();
|
61 |
+
$this->define_frontend_hooks();
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Returns particular component by name.
|
66 |
+
*
|
67 |
+
* @param string $component 'loader' | 'settings' | 'translation_render' |
|
68 |
+
* 'machine_translator' | 'query' | 'language_switcher' |
|
69 |
+
* 'translation_manager' | 'url_converter' | 'languages'
|
70 |
+
* @return mixed
|
71 |
+
*/
|
72 |
+
public function get_component( $component ){
|
73 |
+
return $this->$component;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Includes necessary files.
|
78 |
+
*/
|
79 |
+
protected function load_dependencies() {
|
80 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-settings.php';
|
81 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-translation-manager.php';
|
82 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-regular-strings.php';
|
83 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-gettext-strings.php';
|
84 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-translation-manager.php';
|
85 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-hooks-loader.php';
|
86 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-languages.php';
|
87 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-translation-render.php';
|
88 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-language-switcher.php';
|
89 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-machine-translator.php';
|
90 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-machine-translator-logger.php';
|
91 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-query.php';
|
92 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-url-converter.php';
|
93 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-uri.php';
|
94 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-upgrade.php';
|
95 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-plugin-notices.php';
|
96 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-advanced-tab.php';
|
97 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-translation-memory.php';
|
98 |
+
require_once TRP_PLUGIN_DIR . 'includes/external-functions.php';
|
99 |
+
require_once TRP_PLUGIN_DIR . 'includes/functions.php';
|
100 |
+
require_once TRP_PLUGIN_DIR . 'assets/lib/simplehtmldom/simple_html_dom.php';
|
101 |
+
require_once TRP_PLUGIN_DIR . 'includes/shortcodes.php';
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Instantiates components.
|
106 |
+
*/
|
107 |
+
protected function initialize_components() {
|
108 |
+
$this->loader = new TRP_Hooks_Loader();
|
109 |
+
$this->languages = new TRP_Languages();
|
110 |
+
$this->settings = new TRP_Settings();
|
111 |
+
|
112 |
+
$this->advanced_tab = new TRP_Advanced_Tab($this->settings->get_settings());
|
113 |
+
$this->advanced_tab->include_custom_codes();
|
114 |
+
|
115 |
+
$this->translation_render = new TRP_Translation_Render( $this->settings->get_settings() );
|
116 |
+
$this->url_converter = new TRP_Url_Converter( $this->settings->get_settings() );
|
117 |
+
$this->language_switcher = new TRP_Language_Switcher( $this->settings->get_settings(), $this );
|
118 |
+
$this->query = new TRP_Query( $this->settings->get_settings() );
|
119 |
+
$this->machine_translator = new TRP_Machine_Translator( $this->settings->get_settings() );
|
120 |
+
$this->machine_translator_logger = new TRP_Machine_Translator_Logger( $this->settings->get_settings() );
|
121 |
+
$this->translation_manager = new TRP_Translation_Manager( $this->settings->get_settings() );
|
122 |
+
$this->editor_api_regular_strings = new TRP_Editor_Api_Regular_Strings( $this->settings->get_settings() );
|
123 |
+
$this->editor_api_gettext_strings = new TRP_Editor_Api_Gettext_Strings( $this->settings->get_settings() );
|
124 |
+
$this->notifications = new TRP_Trigger_Plugin_Notifications( $this->settings->get_settings() );
|
125 |
+
$this->upgrade = new TRP_Upgrade( $this->settings->get_settings() );
|
126 |
+
$this->plugin_updater = new TRP_Plugin_Updater();
|
127 |
+
$this->license_page = new TRP_LICENSE_PAGE();
|
128 |
+
$this->translation_memory = new TRP_Translation_Memory( $this->settings->get_settings() );
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* We use this function to detect if we have any addons that require a license
|
133 |
+
*/
|
134 |
+
public function get_active_pro_addons(){
|
135 |
+
|
136 |
+
//don't do nothing in frontend
|
137 |
+
if( !is_admin() )
|
138 |
+
return;
|
139 |
+
|
140 |
+
// the names of your product should match the download names in EDD exactly
|
141 |
+
$trp_all_pro_addons = array(
|
142 |
+
"tp-add-on-automatic-language-detection" => "Automatic User Language Detection",
|
143 |
+
"tp-add-on-browse-as-other-roles" => "Browse as other Role",
|
144 |
+
"tp-add-on-extra-languages" => "Multiple Languages",
|
145 |
+
"tp-add-on-navigation-based-on-language" => "Navigation Based on Language",
|
146 |
+
"tp-add-on-seo-pack" => "SEO Pack",
|
147 |
+
"tp-add-on-translator-accounts" => "Translator Accounts",
|
148 |
+
);
|
149 |
+
$active_plugins = get_option('active_plugins');
|
150 |
+
foreach ( $trp_all_pro_addons as $trp_pro_addon_folder => $trp_pro_addon_name ){
|
151 |
+
foreach( $active_plugins as $active_plugin ){
|
152 |
+
if( strpos( $active_plugin, $trp_pro_addon_folder.'/' ) === 0 ){
|
153 |
+
$this->active_pro_addons[$trp_pro_addon_folder] = $trp_pro_addon_name;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Hooks methods used in admin area.
|
161 |
+
*/
|
162 |
+
protected function define_admin_hooks() {
|
163 |
+
$this->loader->add_action( 'admin_menu', $this->settings, 'register_menu_page' );
|
164 |
+
$this->loader->add_action( 'admin_init', $this->settings, 'register_setting' );
|
165 |
+
$this->loader->add_action( 'admin_notices', $this->settings, 'admin_notices' );
|
166 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $this->settings, 'enqueue_scripts_and_styles', 10, 1 );
|
167 |
+
$this->loader->add_filter( 'plugin_action_links_' . TRP_PLUGIN_BASE , $this->settings, 'plugin_action_links', 10, 1 );
|
168 |
+
$this->loader->add_action( 'trp_settings_navigation_tabs', $this->settings, 'add_navigation_tabs' );
|
169 |
+
$this->loader->add_action( 'trp_language_selector', $this->settings, 'languages_selector', 10, 1 );
|
170 |
+
|
171 |
+
$this->loader->add_action( 'trp_settings_tabs', $this->advanced_tab, 'add_advanced_tab_to_settings', 10, 1 );
|
172 |
+
$this->loader->add_action( 'admin_menu', $this->advanced_tab, 'add_submenu_page_advanced' );
|
173 |
+
$this->loader->add_action( 'trp_output_advanced_settings_options', $this->advanced_tab, 'output_advanced_options' );
|
174 |
+
$this->loader->add_action( 'admin_init', $this->advanced_tab, 'register_setting' );
|
175 |
+
$this->loader->add_action( 'admin_notices', $this->advanced_tab, 'admin_notices' );
|
176 |
+
|
177 |
+
|
178 |
+
$this->loader->add_action( 'wp_ajax_nopriv_trp_get_translations', $this->editor_api_regular_strings, 'get_translations' );
|
179 |
+
|
180 |
+
$this->loader->add_action( 'wp_ajax_trp_get_translations_regular', $this->editor_api_regular_strings, 'get_translations' );
|
181 |
+
$this->loader->add_action( 'wp_ajax_trp_save_translations_regular', $this->editor_api_regular_strings, 'save_translations' );
|
182 |
+
$this->loader->add_action( 'wp_ajax_trp_split_translation_block', $this->editor_api_regular_strings, 'split_translation_block' );
|
183 |
+
$this->loader->add_action( 'wp_ajax_trp_create_translation_block', $this->editor_api_regular_strings, 'create_translation_block' );
|
184 |
+
|
185 |
+
$this->loader->add_action( 'wp_ajax_trp_get_translations_gettext', $this->editor_api_gettext_strings, 'gettext_get_translations' );
|
186 |
+
$this->loader->add_action( 'wp_ajax_trp_save_translations_gettext', $this->editor_api_gettext_strings, 'gettext_save_translations' );
|
187 |
+
|
188 |
+
$this->loader->add_action( 'wp_ajax_trp_get_similar_string_translation', $this->translation_memory, 'ajax_get_similar_string_translation' );
|
189 |
+
|
190 |
+
$this->loader->add_filter( 'trp_get_existing_translations', $this->translation_manager, 'display_possible_db_errors', 20, 3 );
|
191 |
+
|
192 |
+
|
193 |
+
$this->loader->add_action( 'wp_ajax_trp_process_js_strings_in_translation_editor', $this->translation_render, 'process_js_strings_in_translation_editor' );
|
194 |
+
$this->loader->add_filter( 'trp_skip_selectors_from_dynamic_translation', $this->translation_render, 'skip_base_attributes_from_dynamic_translation', 10, 1 );
|
195 |
+
|
196 |
+
|
197 |
+
$this->loader->add_action( 'admin_menu', $this->upgrade, 'register_menu_page' );
|
198 |
+
$this->loader->add_action( 'admin_init', $this->upgrade, 'show_admin_notice' );
|
199 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $this->upgrade, 'enqueue_update_script', 10, 1 );
|
200 |
+
$this->loader->add_action( 'wp_ajax_trp_update_database', $this->upgrade, 'trp_update_database' );
|
201 |
+
|
202 |
+
/* add hooks for license operations */
|
203 |
+
if( !empty( $this->active_pro_addons ) ) {
|
204 |
+
$this->loader->add_action('admin_init', $this->plugin_updater, 'activate_license');
|
205 |
+
$this->loader->add_filter('pre_set_site_transient_update_plugins', $this->plugin_updater, 'check_license');
|
206 |
+
$this->loader->add_action('admin_init', $this->plugin_updater, 'deactivate_license');
|
207 |
+
$this->loader->add_action('admin_notices', $this->plugin_updater, 'admin_activation_notices');
|
208 |
+
}
|
209 |
+
|
210 |
+
/* add license page */
|
211 |
+
global $trp_license_page;//this global was used in the addons, so we need to use it here also so we don't initialize the license page multiple times (backward compatibility)
|
212 |
+
if( !isset( $trp_license_page ) ) {
|
213 |
+
$trp_license_page = $this->license_page;
|
214 |
+
$this->loader->add_action('admin_menu', $this->license_page, 'license_menu');
|
215 |
+
}
|
216 |
+
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Hooks methods used in front-end
|
221 |
+
*/
|
222 |
+
protected function define_frontend_hooks(){
|
223 |
+
|
224 |
+
//we do not need the plugin in cron requests ?
|
225 |
+
if( isset( $_REQUEST['doing_wp_cron'] ) )
|
226 |
+
return;
|
227 |
+
|
228 |
+
$this->loader->add_action( 'init', $this->translation_render, 'start_output_buffer', 0 );
|
229 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_render, 'enqueue_scripts', 10 );
|
230 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_render, 'enqueue_dynamic_translation', 1 );
|
231 |
+
$this->loader->add_filter( 'wp_redirect', $this->translation_render, 'force_preview_on_url_redirect', 99, 2 );
|
232 |
+
$this->loader->add_filter( 'wp_redirect', $this->translation_render, 'force_language_on_form_url_redirect', 99, 2 );
|
233 |
+
$this->loader->add_filter( 'trp_before_translate_content', $this->translation_render, 'force_preview_on_url_in_ajax', 10 );
|
234 |
+
$this->loader->add_filter( 'trp_before_translate_content', $this->translation_render, 'force_form_language_on_url_in_ajax', 20 );
|
235 |
+
/* handle CDATA str replacement from the content as it is messing up the renderer */
|
236 |
+
$this->loader->add_filter( "trp_before_translate_content", $this->translation_render, 'handle_cdata', 1000 );
|
237 |
+
$this->loader->add_action( "trp_set_translation_for_attribute", $this->translation_render, 'translate_image_srcset_attributes', 10, 3 );
|
238 |
+
$this->loader->add_action( "trp_allow_machine_translation_for_string", $this->translation_render, 'allow_machine_translation_for_string', 10, 4 );
|
239 |
+
$this->loader->add_action( "init", $this->translation_render, 'add_callbacks_for_translating_rest_api', 10, 4 );
|
240 |
+
|
241 |
+
|
242 |
+
|
243 |
+
|
244 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $this->language_switcher, 'enqueue_language_switcher_scripts' );
|
245 |
+
$this->loader->add_action( 'wp_footer', $this->language_switcher, 'add_floater_language_switcher' );
|
246 |
+
$this->loader->add_filter( 'init', $this->language_switcher, 'register_ls_menu_switcher' );
|
247 |
+
$this->loader->add_action( 'wp_get_nav_menu_items', $this->language_switcher, 'ls_menu_permalinks', 10, 3 );
|
248 |
+
add_shortcode( 'language-switcher', array( $this->language_switcher, 'language_switcher' ) );
|
249 |
+
|
250 |
+
|
251 |
+
$this->loader->add_action( 'trp_translation_manager_footer', $this->translation_manager, 'enqueue_scripts_and_styles' );
|
252 |
+
$this->loader->add_filter( 'template_include', $this->translation_manager, 'translation_editor', 99999 );
|
253 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_manager, 'enqueue_preview_scripts_and_styles' );
|
254 |
+
$this->loader->add_action( 'admin_bar_menu', $this->translation_manager, 'add_shortcut_to_translation_editor', 90, 1 );
|
255 |
+
$this->loader->add_action( 'admin_head', $this->translation_manager, 'add_styling_to_admin_bar_button', 10 );
|
256 |
+
$this->loader->add_filter( 'show_admin_bar', $this->translation_manager, 'hide_admin_bar_when_in_editor', 90 );
|
257 |
+
|
258 |
+
|
259 |
+
|
260 |
+
$this->loader->add_filter( 'home_url', $this->url_converter, 'add_language_to_home_url', 1, 4 );
|
261 |
+
$this->loader->add_action( 'wp_head', $this->url_converter, 'add_hreflang_to_head' );
|
262 |
+
$this->loader->add_filter( 'language_attributes', $this->url_converter, 'change_lang_attr_in_html_tag', 10, 1 );
|
263 |
+
|
264 |
+
|
265 |
+
$this->loader->add_filter( 'widget_text', null, 'do_shortcode', 11 );
|
266 |
+
$this->loader->add_filter( 'widget_text', null, 'shortcode_unautop', 11 );
|
267 |
+
|
268 |
+
/* handle dynamic texts with gettext */
|
269 |
+
$this->loader->add_filter( 'locale', $this->languages, 'change_locale' );
|
270 |
+
|
271 |
+
$this->loader->add_action( 'init', $this->translation_manager, 'create_gettext_translated_global' );
|
272 |
+
$this->loader->add_action( 'init', $this->translation_manager, 'initialize_gettext_processing' );
|
273 |
+
$this->loader->add_action( 'shutdown', $this->translation_manager, 'machine_translate_gettext', 100 );
|
274 |
+
|
275 |
+
|
276 |
+
/* we need to treat the date_i18n function differently so we remove the gettext wraps */
|
277 |
+
$this->loader->add_filter( 'date_i18n', $this->translation_manager, 'handle_date_i18n_function_for_gettext', 1, 4 );
|
278 |
+
/* strip esc_url() from gettext wraps */
|
279 |
+
$this->loader->add_filter( 'clean_url', $this->translation_manager, 'trp_strip_gettext_tags_from_esc_url', 1, 3 );
|
280 |
+
/* strip sanitize_title() from gettext wraps and apply custom trp_remove_accents */
|
281 |
+
$this->loader->add_filter( 'sanitize_title', $this->translation_manager, 'trp_sanitize_title', 1, 3 );
|
282 |
+
|
283 |
+
/* define an update hook here */
|
284 |
+
$this->loader->add_action( 'plugins_loaded', $this->upgrade, 'check_for_necessary_updates', 10 );
|
285 |
+
|
286 |
+
$this->loader->add_filter( 'trp_language_name', $this->languages, 'beautify_language_name', 10, 4 );
|
287 |
+
$this->loader->add_filter( 'trp_languages', $this->languages, 'reorder_languages', 10, 2 );
|
288 |
+
|
289 |
+
/* set up wp_mail hooks */
|
290 |
+
$this->loader->add_filter( 'wp_mail', $this->translation_render, 'wp_mail_filter', 1 );
|
291 |
+
|
292 |
+
/* hide php ors and notice when we are storing strings in db */
|
293 |
+
$this->loader->add_action( 'init', $this->translation_render, 'trp_debug_mode_off', 0 );
|
294 |
+
|
295 |
+
/* fix wptexturize to always replace with the default translated strings */
|
296 |
+
$this->loader->add_action( 'gettext_with_context', $this->translation_render, 'fix_wptexturize_characters', 999, 4 );
|
297 |
+
|
298 |
+
/* ?or init ? hook here where you can change the $current_user global */
|
299 |
+
$this->loader->add_action( 'init', $this->translation_manager, 'trp_view_as_user' );
|
300 |
+
|
301 |
+
/**
|
302 |
+
* we need to modify the permalinks structure for woocommerce when we switch languages
|
303 |
+
* when woo registers post_types and taxonomies in the rewrite parameter of the function they change the slugs of the items (they are localized with _x )
|
304 |
+
* we can't flush the permalinks on every page load so we filter the rewrite_rules option
|
305 |
+
*/
|
306 |
+
$this->loader->add_filter( "option_rewrite_rules", $this->url_converter, 'woocommerce_filter_permalinks_on_other_languages' );
|
307 |
+
$this->loader->add_filter( "option_woocommerce_permalinks", $this->url_converter, 'woocommerce_filter_permalink_option' );
|
308 |
+
$this->loader->add_filter( "pre_update_option_woocommerce_permalinks", $this->url_converter, 'woocommerce_handle_permalink_option_on_frontend', 10, 2 );
|
309 |
+
|
310 |
+
/* add to the body class the current language */
|
311 |
+
$this->loader->add_filter( "body_class", $this->translation_manager, 'add_language_to_body_class' );
|
312 |
+
|
313 |
+
/* load textdomain */
|
314 |
+
$this->loader->add_action( "init", $this, 'init_translation', 8 );
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Register hooks to WP.
|
319 |
+
*/
|
320 |
+
public function run() {
|
321 |
+
/*
|
322 |
+
* Hook that prevents running the hooks. Caution: some TP code like constructors of classes still run!
|
323 |
+
*/
|
324 |
+
$run_tp = apply_filters( 'trp_allow_tp_to_run', true );
|
325 |
+
if ( $run_tp ) {
|
326 |
+
$this->loader->run();
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Load plugin textdomain
|
332 |
+
*/
|
333 |
+
public function init_translation(){
|
334 |
+
load_plugin_textdomain( 'translatepress-multilingual', false, basename(dirname(__FILE__)) . '/languages/' );
|
335 |
+
}
|
336 |
+
|
337 |
+
}
|
includes/advanced-settings/disable-dynamic-translation.php
CHANGED
@@ -19,3 +19,12 @@ function trp_adst_disable_dynamic( $enable ){
|
|
19 |
}
|
20 |
return $enable;
|
21 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
return $enable;
|
21 |
}
|
22 |
+
|
23 |
+
add_filter( 'trp_editor_missing_scripts_and_styles', 'trp_adst_disable_dynamic2' );
|
24 |
+
function trp_adst_disable_dynamic2( $scripts ){
|
25 |
+
$option = get_option( 'trp_advanced_settings', true );
|
26 |
+
if ( isset( $option['disable_dynamic_translation'] ) && $option['disable_dynamic_translation'] === 'yes' ){
|
27 |
+
unset($scripts['trp-translate-dom-changes.js']);
|
28 |
+
}
|
29 |
+
return $scripts;
|
30 |
+
}
|
includes/advanced-settings/machine-translation-limits.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_machine_translation_limit', 10 );
|
4 |
+
function trp_register_machine_translation_limit( $settings_array ){
|
5 |
+
$settings_array[] = array(
|
6 |
+
'name' => 'machine_translation_limit',
|
7 |
+
'type' => 'number',
|
8 |
+
'default' => '1000000',
|
9 |
+
'label' => esc_html__( 'Limit machine translation / characters per day', 'translatepress-multilingual' ),
|
10 |
+
'description' => wp_kses( __( 'Add a limit to the number of automatically translated characters so you can better budget your project.</a>. ', 'translatepress-multilingual' ), array( 'br' => array(), 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ) ) ),
|
11 |
+
);
|
12 |
+
return $settings_array;
|
13 |
+
}
|
14 |
+
|
15 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_machine_translation_counter', 10 );
|
16 |
+
function trp_register_machine_translation_counter( $settings_array ){
|
17 |
+
$settings_array[] = array(
|
18 |
+
'name' => 'machine_translation_counter',
|
19 |
+
'type' => 'machine_translation_counter',
|
20 |
+
'data_model' => 'not_updatable_by_user',
|
21 |
+
'label' => esc_html__( 'Today\'s character count:', 'translatepress-multilingual' ),
|
22 |
+
);
|
23 |
+
return $settings_array;
|
24 |
+
}
|
25 |
+
|
26 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_machine_translation_counter_date', 10 );
|
27 |
+
function trp_register_machine_translation_counter_date( $settings_array ){
|
28 |
+
$settings_array[] = array(
|
29 |
+
'name' => 'machine_translation_counter_date',
|
30 |
+
'type' => 'machine_translation_counter_date',
|
31 |
+
'data_model' => 'not_updatable_by_user',
|
32 |
+
'label' => esc_html__( 'Today: ', 'translatepress-multilingual' ),
|
33 |
+
);
|
34 |
+
return $settings_array;
|
35 |
+
}
|
36 |
+
|
37 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_machine_translation_log', 10 );
|
38 |
+
function trp_register_machine_translation_log( $settings_array ){
|
39 |
+
$settings_array[] = array(
|
40 |
+
'name' => 'machine_translation_log',
|
41 |
+
'type' => 'checkbox',
|
42 |
+
'label' => esc_html__( 'Log machine translation queries.', 'translatepress-multilingual' ),
|
43 |
+
'description' => wp_kses( __( 'Only enable for testing purposes. Can impact performance<br>All records are stored in the wp_trp_machine_translation_log database table. Use a plugin like <a href="https://wordpress.org/plugins/wp-data-access/">WP Data Access</a> to browse the logs or directly from your database manager (PHPMyAdmin, etc.)', 'translatepress-multilingual' ), array( 'br' => array(), 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ) ) ),
|
44 |
+
);
|
45 |
+
return $settings_array;
|
46 |
+
}
|
47 |
+
|
48 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_machine_translation_separator', 10 );
|
49 |
+
function trp_register_machine_translation_separator( $settings_array ){
|
50 |
+
$settings_array[] = array(
|
51 |
+
'name' => 'machine_translation_separator',
|
52 |
+
'type' => 'separator',
|
53 |
+
);
|
54 |
+
return $settings_array;
|
55 |
+
}
|
56 |
+
|
57 |
+
add_action('plugins_loaded','trp_machine_translation_limit_default');
|
58 |
+
function trp_machine_translation_limit_default(){
|
59 |
+
$adv_options = get_option('trp_advanced_settings', array());
|
60 |
+
|
61 |
+
if (!isset($adv_options['machine_translation_limit']))
|
62 |
+
{
|
63 |
+
$adv_options['machine_translation_limit'] = '1000000';
|
64 |
+
update_option('trp_advanced_settings', $adv_options);
|
65 |
+
}
|
66 |
+
|
67 |
+
if (!isset($adv_options['machine_translation_counter_date']))
|
68 |
+
{
|
69 |
+
$adv_options['machine_translation_counter_date'] = date('Y-m-d');
|
70 |
+
update_option('trp_advanced_settings', $adv_options);
|
71 |
+
}
|
72 |
+
|
73 |
+
if (!isset($adv_options['machine_translation_counter']))
|
74 |
+
{
|
75 |
+
$adv_options['machine_translation_counter'] = 0;
|
76 |
+
update_option('trp_advanced_settings', $adv_options);
|
77 |
+
}
|
78 |
+
}
|
includes/class-advanced-tab.php
CHANGED
@@ -2,6 +2,13 @@
|
|
2 |
|
3 |
class TRP_Advanced_Tab {
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
/*
|
6 |
* Add new tab to TP settings
|
7 |
*
|
@@ -49,11 +56,13 @@ class TRP_Advanced_Tab {
|
|
49 |
*/
|
50 |
public function sanitize_settings( $submitted_settings ){
|
51 |
$registered_settings = $this->get_settings();
|
52 |
-
$
|
|
|
|
|
53 |
foreach ( $registered_settings as $registered_setting ){
|
54 |
|
55 |
// checkboxes are not set so we're setting them up as false
|
56 |
-
if(!isset( $submitted_settings[$registered_setting['name']] )){
|
57 |
$submitted_settings[$registered_setting['name']] = false;
|
58 |
}
|
59 |
|
@@ -66,6 +75,10 @@ class TRP_Advanced_Tab {
|
|
66 |
case 'input': {
|
67 |
$settings[ $registered_setting['name'] ] = sanitize_text_field($submitted_settings[ $registered_setting['name'] ]);
|
68 |
break;
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
case 'list': {
|
71 |
$settings[ $registered_setting['name'] ] = array();
|
@@ -99,8 +112,19 @@ class TRP_Advanced_Tab {
|
|
99 |
break;
|
100 |
}
|
101 |
}
|
102 |
-
}
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
add_settings_error( 'trp_advanced_settings', 'settings_updated', __( 'Settings saved.' ), 'updated' );
|
105 |
|
106 |
return apply_filters( 'trp_extra_sanitize_advanced_settings', $settings, $submitted_settings );
|
@@ -127,6 +151,7 @@ class TRP_Advanced_Tab {
|
|
127 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/show-dynamic-content-before-translation.php');
|
128 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/strip-gettext-post-content.php');
|
129 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/strip-gettext-post-meta.php');
|
|
|
130 |
}
|
131 |
|
132 |
/*
|
@@ -140,6 +165,14 @@ class TRP_Advanced_Tab {
|
|
140 |
* Hooked to trp_settings_navigation_tabs
|
141 |
*/
|
142 |
public function output_advanced_options(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
$advanced_settings_array = $this->get_settings();
|
144 |
foreach( $advanced_settings_array as $setting ){
|
145 |
switch( $setting['type'] ){
|
@@ -152,12 +185,24 @@ class TRP_Advanced_Tab {
|
|
152 |
case 'input':
|
153 |
echo $this->input_setting( $setting );
|
154 |
break;
|
|
|
|
|
|
|
155 |
case 'separator':
|
156 |
echo $this->separator_setting( $setting );
|
157 |
break;
|
158 |
case 'list':
|
159 |
echo $this->add_to_list_setting( $setting );
|
160 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
}
|
162 |
}
|
163 |
}
|
@@ -224,11 +269,12 @@ class TRP_Advanced_Tab {
|
|
224 |
/**
|
225 |
* Return HTML of a input type setting
|
226 |
*
|
227 |
-
* @param $setting
|
|
|
228 |
*
|
229 |
* @return 'string'
|
230 |
*/
|
231 |
-
public function input_setting( $setting ){
|
232 |
$option = get_option( 'trp_advanced_settings', true );
|
233 |
$default = ( isset( $setting['default'] )) ? $setting['default'] : '';
|
234 |
$value = ( isset( $option[ $setting['name'] ] ) ) ? $option[ $setting['name'] ] : $default;
|
@@ -237,10 +283,10 @@ class TRP_Advanced_Tab {
|
|
237 |
<th scope='row'>" . $setting['label'] . "</th>
|
238 |
<td>
|
239 |
<label>
|
240 |
-
<input type='
|
241 |
</label>
|
242 |
<p class='description'>
|
243 |
-
|
244 |
</p>
|
245 |
</td>
|
246 |
</tr>";
|
@@ -320,4 +366,52 @@ class TRP_Advanced_Tab {
|
|
320 |
return apply_filters( 'trp_advanced_setting_list', $html );
|
321 |
}
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
}
|
2 |
|
3 |
class TRP_Advanced_Tab {
|
4 |
|
5 |
+
private $settings;
|
6 |
+
|
7 |
+
public function __construct($settings)
|
8 |
+
{
|
9 |
+
$this->settings = $settings;
|
10 |
+
}
|
11 |
+
|
12 |
/*
|
13 |
* Add new tab to TP settings
|
14 |
*
|
56 |
*/
|
57 |
public function sanitize_settings( $submitted_settings ){
|
58 |
$registered_settings = $this->get_settings();
|
59 |
+
$prev_settings = get_option('trp_advanced_settings', array());
|
60 |
+
|
61 |
+
$settings = array();
|
62 |
foreach ( $registered_settings as $registered_setting ){
|
63 |
|
64 |
// checkboxes are not set so we're setting them up as false
|
65 |
+
if( !isset( $submitted_settings[$registered_setting['name']] ) ){
|
66 |
$submitted_settings[$registered_setting['name']] = false;
|
67 |
}
|
68 |
|
75 |
case 'input': {
|
76 |
$settings[ $registered_setting['name'] ] = sanitize_text_field($submitted_settings[ $registered_setting['name'] ]);
|
77 |
break;
|
78 |
+
}
|
79 |
+
case 'number': {
|
80 |
+
$settings[ $registered_setting['name'] ] = sanitize_text_field(intval($submitted_settings[ $registered_setting['name'] ] ) );
|
81 |
+
break;
|
82 |
}
|
83 |
case 'list': {
|
84 |
$settings[ $registered_setting['name'] ] = array();
|
112 |
break;
|
113 |
}
|
114 |
}
|
115 |
+
} //endif
|
116 |
+
|
117 |
+
// not all settings are updated by the user. Some are modified by the program and used as storage.
|
118 |
+
// This is somewhat bad from a data model kind of way, but it's easy to pass the $settings variable around between classes.
|
119 |
+
if( isset($registered_setting['data_model'])
|
120 |
+
&& $registered_setting['data_model'] == 'not_updatable_by_user'
|
121 |
+
&& isset($prev_settings[$registered_setting['name']])
|
122 |
+
)
|
123 |
+
{
|
124 |
+
$settings[ $registered_setting['name'] ] = $prev_settings[$registered_setting['name']];
|
125 |
+
}
|
126 |
+
|
127 |
+
} //endforeach
|
128 |
add_settings_error( 'trp_advanced_settings', 'settings_updated', __( 'Settings saved.' ), 'updated' );
|
129 |
|
130 |
return apply_filters( 'trp_extra_sanitize_advanced_settings', $settings, $submitted_settings );
|
151 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/show-dynamic-content-before-translation.php');
|
152 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/strip-gettext-post-content.php');
|
153 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/strip-gettext-post-meta.php');
|
154 |
+
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/machine-translation-limits.php');
|
155 |
}
|
156 |
|
157 |
/*
|
165 |
* Hooked to trp_settings_navigation_tabs
|
166 |
*/
|
167 |
public function output_advanced_options(){
|
168 |
+
if ( ! $this->machine_translator_logger ) {
|
169 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
170 |
+
$this->machine_translator_logger = $trp->get_component('machine_translator_logger');
|
171 |
+
}
|
172 |
+
|
173 |
+
$this->machine_translator_logger->maybe_reset_counter_date();
|
174 |
+
|
175 |
+
|
176 |
$advanced_settings_array = $this->get_settings();
|
177 |
foreach( $advanced_settings_array as $setting ){
|
178 |
switch( $setting['type'] ){
|
185 |
case 'input':
|
186 |
echo $this->input_setting( $setting );
|
187 |
break;
|
188 |
+
case 'number':
|
189 |
+
echo $this->input_setting( $setting, 'number' );
|
190 |
+
break;
|
191 |
case 'separator':
|
192 |
echo $this->separator_setting( $setting );
|
193 |
break;
|
194 |
case 'list':
|
195 |
echo $this->add_to_list_setting( $setting );
|
196 |
break;
|
197 |
+
case 'machine_translation_counter':
|
198 |
+
echo $this->machine_translation_counter( $setting );
|
199 |
+
break;
|
200 |
+
case 'machine_translation_counter_date':
|
201 |
+
echo $this->machine_translation_counter_date( $setting );
|
202 |
+
break;
|
203 |
+
case 'machine_translation_trigger_quota_notification':
|
204 |
+
echo $this->storage( $setting );
|
205 |
+
break;
|
206 |
}
|
207 |
}
|
208 |
}
|
269 |
/**
|
270 |
* Return HTML of a input type setting
|
271 |
*
|
272 |
+
* @param array $setting
|
273 |
+
* @param string $type
|
274 |
*
|
275 |
* @return 'string'
|
276 |
*/
|
277 |
+
public function input_setting( $setting, $type = 'text'){
|
278 |
$option = get_option( 'trp_advanced_settings', true );
|
279 |
$default = ( isset( $setting['default'] )) ? $setting['default'] : '';
|
280 |
$value = ( isset( $option[ $setting['name'] ] ) ) ? $option[ $setting['name'] ] : $default;
|
283 |
<th scope='row'>" . $setting['label'] . "</th>
|
284 |
<td>
|
285 |
<label>
|
286 |
+
<input type='{$type}' id='{$setting['name']}' name='trp_advanced_settings[{$setting['name']}]' value='{$value}'>
|
287 |
</label>
|
288 |
<p class='description'>
|
289 |
+
{$setting['description']}
|
290 |
</p>
|
291 |
</td>
|
292 |
</tr>";
|
366 |
return apply_filters( 'trp_advanced_setting_list', $html );
|
367 |
}
|
368 |
|
369 |
+
/**
|
370 |
+
* Return HTML of a machine_translation_counter type setting
|
371 |
+
*
|
372 |
+
* @param $setting
|
373 |
+
*
|
374 |
+
* @return 'string'
|
375 |
+
*/
|
376 |
+
public function machine_translation_counter( $setting ){
|
377 |
+
$option = get_option( 'trp_advanced_settings', true );
|
378 |
+
if(isset($option['machine_translation_counter'])){
|
379 |
+
$counter = $option['machine_translation_counter'];
|
380 |
+
} else {
|
381 |
+
$counter = '0';
|
382 |
+
}
|
383 |
+
|
384 |
+
$html = "
|
385 |
+
<tr>
|
386 |
+
<th scope='row'>{$setting['label']}</th>
|
387 |
+
<td>{$counter}</td>
|
388 |
+
</tr>";
|
389 |
+
|
390 |
+
return apply_filters( 'trp_advanced_setting_machine_translation_counter', $html );
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Return HTML of a machine_translation_counter_date type setting
|
395 |
+
*
|
396 |
+
* @param $setting
|
397 |
+
*
|
398 |
+
* @return 'string'
|
399 |
+
*/
|
400 |
+
public function machine_translation_counter_date( $setting ){
|
401 |
+
$option = get_option( 'trp_advanced_settings', true );
|
402 |
+
|
403 |
+
if(isset($option['machine_translation_counter_date'])){
|
404 |
+
$date = $option['machine_translation_counter_date'];
|
405 |
+
} else {
|
406 |
+
$date = date('Y-m-d');
|
407 |
+
}
|
408 |
+
|
409 |
+
$html = "
|
410 |
+
<tr>
|
411 |
+
<th scope='row'>{$setting['label']}</th>
|
412 |
+
<td>{$date}</td>
|
413 |
+
</tr>";
|
414 |
+
|
415 |
+
return apply_filters( 'trp_advanced_setting_list', $html );
|
416 |
+
}
|
417 |
}
|
includes/class-machine-translator-logger.php
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class TRP_Machine_Translator_Logger
|
3 |
+
{
|
4 |
+
protected $settings;
|
5 |
+
protected $query;
|
6 |
+
protected $url_converter;
|
7 |
+
protected $counter;
|
8 |
+
protected $counter_date;
|
9 |
+
protected $limit;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* TRP_Machine_Translator_Logger constructor.
|
13 |
+
*
|
14 |
+
* @param array $settings Settings option.
|
15 |
+
*/
|
16 |
+
public function __construct( $settings ){
|
17 |
+
$this->settings = $settings;
|
18 |
+
$this->counter = intval($this->get_advanced_sub_option('machine_translation_counter', 0));
|
19 |
+
$this->counter_date = $this->get_advanced_sub_option('machine_translation_counter_date', date ("Y-m-d" ));
|
20 |
+
$this->limit = intval($this->get_advanced_sub_option('machine_translation_limit', 1000000));
|
21 |
+
// if a new day has passed, update the counter and date
|
22 |
+
$this->maybe_reset_counter_date();
|
23 |
+
}
|
24 |
+
|
25 |
+
public function log($args = array()){
|
26 |
+
|
27 |
+
if ( ! $this->query ) {
|
28 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
29 |
+
$this->query = $trp->get_component('query');
|
30 |
+
}
|
31 |
+
|
32 |
+
if ( ! $this->url_converter ) {
|
33 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
34 |
+
$this->url_converter = $trp->get_component('url_converter');
|
35 |
+
}
|
36 |
+
|
37 |
+
if(empty($args)){
|
38 |
+
return false;
|
39 |
+
}
|
40 |
+
|
41 |
+
if( $this->get_advanced_sub_option('machine_translation_log', false) !== 'yes' ){
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
|
45 |
+
if( !$this->query->check_machine_translation_log_table() ){
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
|
49 |
+
// expected structure.
|
50 |
+
$log = array(
|
51 |
+
'url' => $this->url_converter->cur_page_url(),
|
52 |
+
'strings' => $args['strings'],
|
53 |
+
'characters' => $this->count(unserialize($args['strings'])),
|
54 |
+
'response' => $args['response'],
|
55 |
+
'lang_source' => $args['lang_source'],
|
56 |
+
'lang_target' => $args['lang_target'],
|
57 |
+
'timestamp' => date ("Y-m-d H:i:s" )
|
58 |
+
);
|
59 |
+
|
60 |
+
$table_name = $this->query->db->prefix . 'trp_machine_translation_log';
|
61 |
+
|
62 |
+
$query = "INSERT INTO `$table_name` ( `url`, `strings`, `characters`, `response`, `lang_source`, `lang_target`, `timestamp` ) VALUES (%s, %s, %s, %s, %s, %s, %s)";
|
63 |
+
|
64 |
+
$prepared_query = $this->query->db->prepare( $query, $log );
|
65 |
+
$this->query->db->get_results( $prepared_query, OBJECT_K );
|
66 |
+
|
67 |
+
if ($this->query->db->last_error !== '') {
|
68 |
+
return false;
|
69 |
+
}
|
70 |
+
return true;
|
71 |
+
}
|
72 |
+
|
73 |
+
private function count($strings){
|
74 |
+
if(!is_array($strings)){
|
75 |
+
return 0;
|
76 |
+
}
|
77 |
+
|
78 |
+
$char_number = 0;
|
79 |
+
foreach($strings as $string){
|
80 |
+
$char_number += strlen($string);
|
81 |
+
}
|
82 |
+
|
83 |
+
return $char_number;
|
84 |
+
}
|
85 |
+
|
86 |
+
public function count_towards_quota($strings){
|
87 |
+
$this->counter += $this->count($strings);
|
88 |
+
$this->update_advanced_sub_option('machine_translation_counter', $this->counter);
|
89 |
+
|
90 |
+
return $this->counter;
|
91 |
+
}
|
92 |
+
|
93 |
+
public function quota_exceeded(){
|
94 |
+
if ( $this->limit >= $this->counter )
|
95 |
+
{
|
96 |
+
// quota NOT exceeded
|
97 |
+
// for some reason this condition is hard to comprehend by my brain
|
98 |
+
// thus the unneeded comment.
|
99 |
+
return false;
|
100 |
+
}
|
101 |
+
|
102 |
+
// we've exceeded our daily quota
|
103 |
+
$this->update_advanced_sub_option('machine_translation_trigger_quota_notification' , true );
|
104 |
+
return true;
|
105 |
+
}
|
106 |
+
|
107 |
+
public function maybe_reset_counter_date(){
|
108 |
+
$some = 'else';
|
109 |
+
|
110 |
+
if ($this->counter_date === date ("Y-m-d" ))
|
111 |
+
{
|
112 |
+
// the day has not passed
|
113 |
+
return false;
|
114 |
+
} else {
|
115 |
+
// there is a new day
|
116 |
+
$this->update_advanced_sub_option('machine_translation_counter_date' , date ("Y-m-d" ) );
|
117 |
+
// clear the counter
|
118 |
+
$this->update_advanced_sub_option('machine_translation_counter' , 0 );
|
119 |
+
// clear the notification
|
120 |
+
$this->update_advanced_sub_option('machine_translation_trigger_quota_notification' , false );
|
121 |
+
|
122 |
+
return true;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
private function get_advanced_sub_option($option_name, $default){
|
127 |
+
|
128 |
+
if( isset($this->settings['advanced_settings'][$option_name]) )
|
129 |
+
{
|
130 |
+
return $this->settings['advanced_settings'][$option_name];
|
131 |
+
} else {
|
132 |
+
return $default;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
private function update_advanced_sub_option($option_name, $value){
|
137 |
+
// update TP settings instance
|
138 |
+
$this->settings['advanced_settings'][$option_name] = $value;
|
139 |
+
// update in the database as well
|
140 |
+
update_option('trp_advanced_settings', $this->settings['advanced_settings']);
|
141 |
+
}
|
142 |
+
}
|
includes/class-machine-translator.php
CHANGED
@@ -9,6 +9,7 @@ class TRP_Machine_Translator{
|
|
9 |
protected $settings;
|
10 |
protected $referer;
|
11 |
protected $url_converter;
|
|
|
12 |
/**
|
13 |
* TRP_Machine_Translator constructor.
|
14 |
*
|
@@ -94,16 +95,32 @@ class TRP_Machine_Translator{
|
|
94 |
|
95 |
$translated_strings = array();
|
96 |
|
97 |
-
if( !
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
/* split our strings that need translation in chunks of maximum 128 strings because Google Translate has a limit of 128 strings */
|
99 |
$new_strings_chunks = array_chunk( $new_strings, 128, true );
|
100 |
/* if there are more than 128 strings we make multiple requests */
|
101 |
foreach( $new_strings_chunks as $new_strings_chunk ){
|
|
|
102 |
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
/* analyze the response */
|
106 |
if ( is_array( $response ) && ! is_wp_error( $response ) ) {
|
|
|
|
|
|
|
107 |
/* decode it */
|
108 |
$translation_response = json_decode( $response['body'] );
|
109 |
if( !empty( $translation_response->error ) ){
|
9 |
protected $settings;
|
10 |
protected $referer;
|
11 |
protected $url_converter;
|
12 |
+
protected $machine_translator_logger;
|
13 |
/**
|
14 |
* TRP_Machine_Translator constructor.
|
15 |
*
|
95 |
|
96 |
$translated_strings = array();
|
97 |
|
98 |
+
if ( ! $this->machine_translator_logger ) {
|
99 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
100 |
+
$this->machine_translator_logger = $trp->get_component('machine_translator_logger');
|
101 |
+
}
|
102 |
+
|
103 |
+
// if character quote expired we don't send strings for automatic translation.
|
104 |
+
if( !empty( $new_strings ) && !$this->machine_translator_logger->quota_exceeded() ){
|
105 |
/* split our strings that need translation in chunks of maximum 128 strings because Google Translate has a limit of 128 strings */
|
106 |
$new_strings_chunks = array_chunk( $new_strings, 128, true );
|
107 |
/* if there are more than 128 strings we make multiple requests */
|
108 |
foreach( $new_strings_chunks as $new_strings_chunk ){
|
109 |
+
$response = $this->send_request( $source_language, $language_code, $new_strings_chunk );
|
110 |
|
111 |
+
// this is run only if "Log machine translation queries." is set to Yes.
|
112 |
+
$this->machine_translator_logger->log(array(
|
113 |
+
'strings' => serialize( $new_strings_chunk),
|
114 |
+
'response' => serialize( $response ),
|
115 |
+
'lang_source' => $source_language,
|
116 |
+
'lang_target' => $language_code,
|
117 |
+
));
|
118 |
|
119 |
/* analyze the response */
|
120 |
if ( is_array( $response ) && ! is_wp_error( $response ) ) {
|
121 |
+
|
122 |
+
$this->machine_translator_logger->count_towards_quota( $new_strings_chunk );
|
123 |
+
|
124 |
/* decode it */
|
125 |
$translation_response = json_decode( $response['body'] );
|
126 |
if( !empty( $translation_response->error ) ){
|
includes/class-plugin-notices.php
CHANGED
@@ -308,7 +308,13 @@ Class TRP_Plugin_Notifications {
|
|
308 |
|
309 |
class TRP_Trigger_Plugin_Notifications{
|
310 |
|
311 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
add_action( 'admin_init', array( $this, 'add_plugin_notifications' ) );
|
313 |
}
|
314 |
|
@@ -387,6 +393,34 @@ class TRP_Trigger_Plugin_Notifications{
|
|
387 |
|
388 |
$notifications->add_notification($notification_id, $message, 'trp-notice trp-narrow notice notice-info', true, array('translate-press'));
|
389 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
}
|
391 |
|
392 |
}
|
308 |
|
309 |
class TRP_Trigger_Plugin_Notifications{
|
310 |
|
311 |
+
private $settings;
|
312 |
+
private $settings_obj;
|
313 |
+
private $machine_translator_logger;
|
314 |
+
|
315 |
+
function __construct($settings) {
|
316 |
+
$this->settings = $settings;
|
317 |
+
|
318 |
add_action( 'admin_init', array( $this, 'add_plugin_notifications' ) );
|
319 |
}
|
320 |
|
393 |
|
394 |
$notifications->add_notification($notification_id, $message, 'trp-notice trp-narrow notice notice-info', true, array('translate-press'));
|
395 |
|
396 |
+
/*
|
397 |
+
*
|
398 |
+
* Machine translation enabled and quota is met.
|
399 |
+
*
|
400 |
+
*/
|
401 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
402 |
+
if ( ! $this->settings_obj ){
|
403 |
+
$this->settings_obj = $trp->get_component( 'settings' );
|
404 |
+
}
|
405 |
+
|
406 |
+
if ( ! $this->machine_translator_logger ){
|
407 |
+
$this->machine_translator_logger = $trp->get_component( 'machine_translator_logger' );
|
408 |
+
}
|
409 |
+
|
410 |
+
$gtranslate = $this->settings_obj->get_setting('g-translate', 'no');
|
411 |
+
|
412 |
+
if( 'yes' === $gtranslate && $this->machine_translator_logger->quota_exceeded() ) {
|
413 |
+
/* this must be unique */
|
414 |
+
$notification_id = 'trp_machine_translation_quota_exceeded_'. date('Ymd');
|
415 |
+
|
416 |
+
$message = '<img style="float: left; margin: 10px 12px 10px 0; max-width: 80px;" src="' . TRP_PLUGIN_URL . 'assets/images/get_param_addon.jpg" />';
|
417 |
+
$message .= '<p style="margin-top: 16px;padding-right:30px;">' . esc_html__('The daily quota for machine translation characters exceeded. Please check the TranslatePress -> Settings -> Advanced Settings for more information.', 'translatepress-multilingual') . '</p>';
|
418 |
+
//make sure to use the trp_dismiss_admin_notification arg
|
419 |
+
$message .= '<a href="' . add_query_arg(array('trp_dismiss_admin_notification' => $notification_id)) . '" type="button" class="notice-dismiss"><span class="screen-reader-text">' . __('Dismiss this notice.', 'translatepress-multilingual') . '</span></a>';
|
420 |
+
|
421 |
+
$notifications->add_notification($notification_id, $message, 'trp-notice trp-narrow notice notice-info', true, array('translate-press'));
|
422 |
+
}
|
423 |
+
|
424 |
}
|
425 |
|
426 |
}
|
includes/class-query.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
class TRP_Query{
|
10 |
|
11 |
protected $table_name;
|
12 |
-
|
13 |
protected $settings;
|
14 |
protected $translation_render;
|
15 |
|
@@ -174,6 +174,46 @@ class TRP_Query{
|
|
174 |
}
|
175 |
}
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
public function copy_all_translation_blocks_into_table( $default_language, $language_code ){
|
178 |
$all_table_names = $this->get_all_table_names( $default_language, array( $language_code ) );
|
179 |
if ( count( $all_table_names ) > 0 ){
|
9 |
class TRP_Query{
|
10 |
|
11 |
protected $table_name;
|
12 |
+
public $db;
|
13 |
protected $settings;
|
14 |
protected $translation_render;
|
15 |
|
174 |
}
|
175 |
}
|
176 |
|
177 |
+
/**
|
178 |
+
* Check if table for machine translation logs exists.
|
179 |
+
*
|
180 |
+
* If the table does not exists it is created.
|
181 |
+
*
|
182 |
+
* @param string $language_code
|
183 |
+
*/
|
184 |
+
public function check_machine_translation_log_table(){
|
185 |
+
$table_name = $this->db->prefix . 'trp_machine_translation_log';
|
186 |
+
if ( $this->db->get_var( "SHOW TABLES LIKE '$table_name'" ) != $table_name )
|
187 |
+
{
|
188 |
+
// table not in database. Create new table
|
189 |
+
$charset_collate = $this->db->get_charset_collate();
|
190 |
+
|
191 |
+
$sql = "CREATE TABLE `{$table_name}`(
|
192 |
+
id bigint(20) AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
193 |
+
url text,
|
194 |
+
timestamp datetime DEFAULT '0000-00-00 00:00:00',
|
195 |
+
strings longtext,
|
196 |
+
characters text,
|
197 |
+
response longtext,
|
198 |
+
lang_source text,
|
199 |
+
lang_target text,
|
200 |
+
UNIQUE KEY id (id) )
|
201 |
+
{$charset_collate};";
|
202 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
203 |
+
dbDelta( $sql );
|
204 |
+
|
205 |
+
if ( $this->db->get_var( "SHOW TABLES LIKE '$table_name'" ) != $table_name )
|
206 |
+
{
|
207 |
+
// something failed. Table still doesn't exist.
|
208 |
+
return false;
|
209 |
+
}
|
210 |
+
// table exists
|
211 |
+
return true;
|
212 |
+
}
|
213 |
+
//table exists
|
214 |
+
return true;
|
215 |
+
}
|
216 |
+
|
217 |
public function copy_all_translation_blocks_into_table( $default_language, $language_code ){
|
218 |
$all_table_names = $this->get_all_table_names( $default_language, array( $language_code ) );
|
219 |
if ( count( $all_table_names ) > 0 ){
|
includes/class-settings.php
CHANGED
@@ -76,10 +76,10 @@ class TRP_Settings{
|
|
76 |
}
|
77 |
|
78 |
/**
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
public function get_settings(){
|
84 |
if ( $this->settings == null ){
|
85 |
$this->set_options();
|
@@ -87,6 +87,24 @@ class TRP_Settings{
|
|
87 |
return $this->settings;
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
/**
|
91 |
* Register Settings subpage for TranslatePress
|
92 |
*/
|
@@ -297,7 +315,7 @@ class TRP_Settings{
|
|
297 |
'floater-options' => 'flags-full-names',
|
298 |
'floater-position' => 'bottom-right',
|
299 |
'url-slugs' => array( 'en_US' => 'en', '' ),
|
300 |
-
'advanced_settings' =>
|
301 |
);
|
302 |
if ( 'not_set' == $settings_option ){
|
303 |
update_option ( 'trp_settings', $default_settings );
|
76 |
}
|
77 |
|
78 |
/**
|
79 |
+
* Returns settings_option.
|
80 |
+
*
|
81 |
+
* @return array Settings option.
|
82 |
+
*/
|
83 |
public function get_settings(){
|
84 |
if ( $this->settings == null ){
|
85 |
$this->set_options();
|
87 |
return $this->settings;
|
88 |
}
|
89 |
|
90 |
+
/**
|
91 |
+
* Returns the value of an individual setting or the default provided.
|
92 |
+
*
|
93 |
+
* @param string $name
|
94 |
+
* @param default mixed
|
95 |
+
*
|
96 |
+
* @return mixed Setting Value
|
97 |
+
*/
|
98 |
+
public function get_setting($name, $default = null){
|
99 |
+
$settings = $this->settings;
|
100 |
+
if( array_key_exists($name, $this->settings ) )
|
101 |
+
{
|
102 |
+
return maybe_unserialize($this->settings[$name]);
|
103 |
+
} else {
|
104 |
+
return $default;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
/**
|
109 |
* Register Settings subpage for TranslatePress
|
110 |
*/
|
315 |
'floater-options' => 'flags-full-names',
|
316 |
'floater-position' => 'bottom-right',
|
317 |
'url-slugs' => array( 'en_US' => 'en', '' ),
|
318 |
+
'advanced_settings' => get_option('trp_advanced_settings', array() ),
|
319 |
);
|
320 |
if ( 'not_set' == $settings_option ){
|
321 |
update_option ( 'trp_settings', $default_settings );
|
includes/class-translation-render.php
CHANGED
@@ -369,8 +369,10 @@ class TRP_Translation_Render{
|
|
369 |
if( apply_filters( 'trp_try_fixing_invalid_html', false ) ) {
|
370 |
if( class_exists('DOMDocument') ) {
|
371 |
$dom = new DOMDocument();
|
|
|
|
|
372 |
libxml_use_internal_errors(true);//so no warnings will show up for invalid html
|
373 |
-
$dom->loadHTML($output, LIBXML_NOWARNING);
|
374 |
$output = $dom->saveHTML();
|
375 |
}
|
376 |
}
|
369 |
if( apply_filters( 'trp_try_fixing_invalid_html', false ) ) {
|
370 |
if( class_exists('DOMDocument') ) {
|
371 |
$dom = new DOMDocument();
|
372 |
+
$dom->encoding = 'utf-8';
|
373 |
+
|
374 |
libxml_use_internal_errors(true);//so no warnings will show up for invalid html
|
375 |
+
$dom->loadHTML(utf8_decode($output), LIBXML_NOWARNING | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD );
|
376 |
$output = $dom->saveHTML();
|
377 |
}
|
378 |
}
|
index.php
CHANGED
@@ -1,63 +1,63 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: TranslatePress - Multilingual
|
4 |
-
Plugin URI: https://translatepress.com/
|
5 |
-
Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
|
6 |
-
Version: 1.5.
|
7 |
-
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
8 |
-
Author URI: https://cozmoslabs.com/
|
9 |
-
Text Domain: translatepress-multilingual
|
10 |
-
Domain Path: /languages
|
11 |
-
License: GPL2
|
12 |
-
WC requires at least: 2.5.0
|
13 |
-
WC tested up to: 3.5
|
14 |
-
|
15 |
-
== Copyright ==
|
16 |
-
Copyright 2017 Cozmoslabs (www.cozmoslabs.com)
|
17 |
-
|
18 |
-
This program is free software; you can redistribute it and/or modify
|
19 |
-
it under the terms of the GNU General Public License as published by
|
20 |
-
the Free Software Foundation; either version 2 of the License, or
|
21 |
-
(at your option) any later version.
|
22 |
-
This program is distributed in the hope that it will be useful,
|
23 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25 |
-
GNU General Public License for more details.
|
26 |
-
You should have received a copy of the GNU General Public License
|
27 |
-
along with this program; if not, write to the Free Software
|
28 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
29 |
-
*/
|
30 |
-
|
31 |
-
function trp_enable_translatepress(){
|
32 |
-
$enable_translatepress = true;
|
33 |
-
$current_php_version = apply_filters( 'trp_php_version', phpversion() );
|
34 |
-
|
35 |
-
// 5.6.20 is the minimum version supported by WordPress
|
36 |
-
if ( $current_php_version !== false && version_compare( $current_php_version, '5.6.20', '<' ) ){
|
37 |
-
$enable_translatepress = false;
|
38 |
-
add_action( 'admin_menu', 'trp_translatepress_disabled_notice' );
|
39 |
-
}
|
40 |
-
|
41 |
-
return apply_filters( 'trp_enable_translatepress', $enable_translatepress );
|
42 |
-
}
|
43 |
-
|
44 |
-
if ( trp_enable_translatepress() ) {
|
45 |
-
require_once plugin_dir_path( __FILE__ ) . 'class-translate-press.php';
|
46 |
-
|
47 |
-
/** License classes includes here
|
48 |
-
* Since version 1.4.6
|
49 |
-
* It need to be outside of a hook so it load before the classes that are in the addons, that we are trying to phase out
|
50 |
-
*/
|
51 |
-
require_once plugin_dir_path( __FILE__ ) . 'includes/class-edd-sl-plugin-updater.php';
|
52 |
-
|
53 |
-
/* make sure we execute our plugin before other plugins so the changes we make apply across the board */
|
54 |
-
add_action( 'plugins_loaded', 'trp_run_translatepress_hooks', 1 );
|
55 |
-
}
|
56 |
-
function trp_run_translatepress_hooks(){
|
57 |
-
$trp = TRP_Translate_Press::get_trp_instance();
|
58 |
-
$trp->run();
|
59 |
-
}
|
60 |
-
|
61 |
-
function trp_translatepress_disabled_notice(){
|
62 |
-
echo '<div class="notice notice-error"><p>' . wp_kses( sprintf( __( '<strong>TranslatePress</strong> requires at least PHP version 5.6.20+ to run. It is the <a href="%s">minimum requirement of the latest WordPress version</a>. Please contact your server administrator to update your PHP version.','translatepress-multilingual' ), 'https://wordpress.org/about/requirements/' ), array( 'a' => array( 'href' => array() ), 'strong' => array() ) ) . '</p></div>';
|
63 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: TranslatePress - Multilingual
|
4 |
+
Plugin URI: https://translatepress.com/
|
5 |
+
Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
|
6 |
+
Version: 1.5.8
|
7 |
+
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
8 |
+
Author URI: https://cozmoslabs.com/
|
9 |
+
Text Domain: translatepress-multilingual
|
10 |
+
Domain Path: /languages
|
11 |
+
License: GPL2
|
12 |
+
WC requires at least: 2.5.0
|
13 |
+
WC tested up to: 3.5
|
14 |
+
|
15 |
+
== Copyright ==
|
16 |
+
Copyright 2017 Cozmoslabs (www.cozmoslabs.com)
|
17 |
+
|
18 |
+
This program is free software; you can redistribute it and/or modify
|
19 |
+
it under the terms of the GNU General Public License as published by
|
20 |
+
the Free Software Foundation; either version 2 of the License, or
|
21 |
+
(at your option) any later version.
|
22 |
+
This program is distributed in the hope that it will be useful,
|
23 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25 |
+
GNU General Public License for more details.
|
26 |
+
You should have received a copy of the GNU General Public License
|
27 |
+
along with this program; if not, write to the Free Software
|
28 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
29 |
+
*/
|
30 |
+
|
31 |
+
function trp_enable_translatepress(){
|
32 |
+
$enable_translatepress = true;
|
33 |
+
$current_php_version = apply_filters( 'trp_php_version', phpversion() );
|
34 |
+
|
35 |
+
// 5.6.20 is the minimum version supported by WordPress
|
36 |
+
if ( $current_php_version !== false && version_compare( $current_php_version, '5.6.20', '<' ) ){
|
37 |
+
$enable_translatepress = false;
|
38 |
+
add_action( 'admin_menu', 'trp_translatepress_disabled_notice' );
|
39 |
+
}
|
40 |
+
|
41 |
+
return apply_filters( 'trp_enable_translatepress', $enable_translatepress );
|
42 |
+
}
|
43 |
+
|
44 |
+
if ( trp_enable_translatepress() ) {
|
45 |
+
require_once plugin_dir_path( __FILE__ ) . 'class-translate-press.php';
|
46 |
+
|
47 |
+
/** License classes includes here
|
48 |
+
* Since version 1.4.6
|
49 |
+
* It need to be outside of a hook so it load before the classes that are in the addons, that we are trying to phase out
|
50 |
+
*/
|
51 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/class-edd-sl-plugin-updater.php';
|
52 |
+
|
53 |
+
/* make sure we execute our plugin before other plugins so the changes we make apply across the board */
|
54 |
+
add_action( 'plugins_loaded', 'trp_run_translatepress_hooks', 1 );
|
55 |
+
}
|
56 |
+
function trp_run_translatepress_hooks(){
|
57 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
58 |
+
$trp->run();
|
59 |
+
}
|
60 |
+
|
61 |
+
function trp_translatepress_disabled_notice(){
|
62 |
+
echo '<div class="notice notice-error"><p>' . wp_kses( sprintf( __( '<strong>TranslatePress</strong> requires at least PHP version 5.6.20+ to run. It is the <a href="%s">minimum requirement of the latest WordPress version</a>. Please contact your server administrator to update your PHP version.','translatepress-multilingual' ), 'https://wordpress.org/about/requirements/' ), array( 'a' => array( 'href' => array() ), 'strong' => array() ) ) . '</p></div>';
|
63 |
+
}
|
languages/translatepress-multilingual.catalog.php
CHANGED
@@ -42,6 +42,12 @@
|
|
42 |
<?php __("General attempt to fix broken or missing HTML on translated pages.<br/><strong>Only try this if the \"Fix spaces between html attribute\" did not solve the issue.</strong>", "translatepress-multilingual"); ?>
|
43 |
<?php __("Fix spaces between HTML attributes", "translatepress-multilingual"); ?>
|
44 |
<?php __("Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages.", "translatepress-multilingual"); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
<?php __("Fix missing dynamic content", "translatepress-multilingual"); ?>
|
46 |
<?php __("May help fix missing content inserted using JavaScript. <br> It shows dynamically inserted content in original language for a moment before the translation request is finished.", "translatepress-multilingual"); ?>
|
47 |
<?php __("Filter Gettext wrapping from post content and title", "translatepress-multilingual"); ?>
|
@@ -66,6 +72,7 @@
|
|
66 |
<?php __("Your <strong>TranslatePress</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s", "translatepress-multilingual"); ?>
|
67 |
<?php __("Your <strong>TranslatePress</strong> license will expire on %1$s. Please %2$sRenew Your Licence%3$s to continue receiving access to product downloads, automatic updates and support.", "translatepress-multilingual"); ?>
|
68 |
<?php __("NEW: Display different images based on language. Find out <a href=\"https://translatepress.com/docs/image-translation/\" >how to translate images, sliders and more</a> from the TranslatePress editor.", "translatepress-multilingual"); ?>
|
|
|
69 |
<?php __("Full Language Names", "translatepress-multilingual"); ?>
|
70 |
<?php __("Short Language Names", "translatepress-multilingual"); ?>
|
71 |
<?php __("Flags with Full Language Names", "translatepress-multilingual"); ?>
|
42 |
<?php __("General attempt to fix broken or missing HTML on translated pages.<br/><strong>Only try this if the \"Fix spaces between html attribute\" did not solve the issue.</strong>", "translatepress-multilingual"); ?>
|
43 |
<?php __("Fix spaces between HTML attributes", "translatepress-multilingual"); ?>
|
44 |
<?php __("Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages.", "translatepress-multilingual"); ?>
|
45 |
+
<?php __("Limit machine translation / characters per day", "translatepress-multilingual"); ?>
|
46 |
+
<?php __("Add a limit to the number of automatically translated characters so you can better budget your project.</a>. ", "translatepress-multilingual"); ?>
|
47 |
+
<?php __("Today's character count:", "translatepress-multilingual"); ?>
|
48 |
+
<?php __("Today: ", "translatepress-multilingual"); ?>
|
49 |
+
<?php __("Log machine translation queries.", "translatepress-multilingual"); ?>
|
50 |
+
<?php __("Only enable for testing purposes. Can impact performance<br>All records are stored in the wp_trp_machine_translation_log database table. Use a plugin like <a href=\"https://wordpress.org/plugins/wp-data-access/\">WP Data Access</a> to browse the logs or directly from your database manager (PHPMyAdmin, etc.)", "translatepress-multilingual"); ?>
|
51 |
<?php __("Fix missing dynamic content", "translatepress-multilingual"); ?>
|
52 |
<?php __("May help fix missing content inserted using JavaScript. <br> It shows dynamically inserted content in original language for a moment before the translation request is finished.", "translatepress-multilingual"); ?>
|
53 |
<?php __("Filter Gettext wrapping from post content and title", "translatepress-multilingual"); ?>
|
72 |
<?php __("Your <strong>TranslatePress</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s", "translatepress-multilingual"); ?>
|
73 |
<?php __("Your <strong>TranslatePress</strong> license will expire on %1$s. Please %2$sRenew Your Licence%3$s to continue receiving access to product downloads, automatic updates and support.", "translatepress-multilingual"); ?>
|
74 |
<?php __("NEW: Display different images based on language. Find out <a href=\"https://translatepress.com/docs/image-translation/\" >how to translate images, sliders and more</a> from the TranslatePress editor.", "translatepress-multilingual"); ?>
|
75 |
+
<?php __("The daily quota for machine translation characters exceeded. Please check the TranslatePress -> Settings -> Advanced Settings for more information.", "translatepress-multilingual"); ?>
|
76 |
<?php __("Full Language Names", "translatepress-multilingual"); ?>
|
77 |
<?php __("Short Language Names", "translatepress-multilingual"); ?>
|
78 |
<?php __("Flags with Full Language Names", "translatepress-multilingual"); ?>
|
languages/translatepress-multilingual.pot
CHANGED
@@ -61,7 +61,7 @@ msgstr ""
|
|
61 |
msgid "Select how the language should be detected for first time visitors.<br>The visitor's last displayed language will be remembered through cookies."
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: ../tp-add-on-extra-languages/class-extra-languages.php:57, ../translatepress/includes/class-settings.php:
|
65 |
msgid "Error! Duplicate URL slug values."
|
66 |
msgstr ""
|
67 |
|
@@ -89,7 +89,7 @@ msgstr ""
|
|
89 |
msgid "Are you sure you want to remove this language?"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:43, ../translatepress/includes/class-advanced-tab.php:
|
93 |
msgid "Remove"
|
94 |
msgstr ""
|
95 |
|
@@ -97,7 +97,7 @@ msgstr ""
|
|
97 |
msgid "Choose..."
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:58, ../translatepress/includes/class-advanced-tab.php:
|
101 |
msgid "Add"
|
102 |
msgstr ""
|
103 |
|
@@ -109,7 +109,7 @@ msgstr ""
|
|
109 |
msgid "Limit this menu item to the following languages"
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: ../tp-add-on-seo-pack/class-seo-pack.php:
|
113 |
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 submitting the sitemap to Google."
|
114 |
msgstr ""
|
115 |
|
@@ -185,6 +185,30 @@ msgstr ""
|
|
185 |
msgid "Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages."
|
186 |
msgstr ""
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
#: ../translatepress/includes/advanced-settings/show-dynamic-content-before-translation.php:8
|
189 |
msgid "Fix missing dynamic content"
|
190 |
msgstr ""
|
@@ -209,15 +233,15 @@ msgstr ""
|
|
209 |
msgid "Filters gettext wrapping such as #!trpst#trp-gettext from all updated post meta. Does not affect previous post meta. <br/><strong>Database backup is recommended before switching on.</strong>"
|
210 |
msgstr ""
|
211 |
|
212 |
-
#: ../translatepress/includes/class-advanced-tab.php:
|
213 |
msgid "Advanced"
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: ../translatepress/includes/class-advanced-tab.php:
|
217 |
msgid "Yes"
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: ../translatepress/includes/class-advanced-tab.php:
|
221 |
msgid "Are you sure you want to remove this item?"
|
222 |
msgstr ""
|
223 |
|
@@ -257,30 +281,34 @@ msgstr ""
|
|
257 |
msgid "Others"
|
258 |
msgstr ""
|
259 |
|
260 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
261 |
msgid "You are not using a permalink structure! Please <a href=\"%s\">enable</a> one or install our <a href=\"%s\">\"Language by GET parameter\"</a> addon, so that TranslatePress can function properly."
|
262 |
msgstr ""
|
263 |
|
264 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
265 |
msgid "Dismiss this notice."
|
266 |
msgstr ""
|
267 |
|
268 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
269 |
msgid "Your <strong>TranslatePress</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s"
|
270 |
msgstr ""
|
271 |
|
272 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
273 |
msgid "Your <strong>TranslatePress</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s"
|
274 |
msgstr ""
|
275 |
|
276 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
277 |
msgid "Your <strong>TranslatePress</strong> license will expire on %1$s. Please %2$sRenew Your Licence%3$s to continue receiving access to product downloads, automatic updates and support."
|
278 |
msgstr ""
|
279 |
|
280 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
281 |
msgid "NEW: Display different images based on language. Find out <a href=\"https://translatepress.com/docs/image-translation/\" >how to translate images, sliders and more</a> from the TranslatePress editor."
|
282 |
msgstr ""
|
283 |
|
|
|
|
|
|
|
|
|
284 |
#: ../translatepress/includes/class-settings.php:26
|
285 |
msgid "Full Language Names"
|
286 |
msgstr ""
|
@@ -317,31 +345,31 @@ msgstr ""
|
|
317 |
msgid "Top Left"
|
318 |
msgstr ""
|
319 |
|
320 |
-
#: ../translatepress/includes/class-settings.php:
|
321 |
msgid "Current Language"
|
322 |
msgstr ""
|
323 |
|
324 |
-
#: ../translatepress/includes/class-settings.php:
|
325 |
msgid "General"
|
326 |
msgstr ""
|
327 |
|
328 |
-
#: ../translatepress/includes/class-settings.php:
|
329 |
msgid "Translate Site"
|
330 |
msgstr ""
|
331 |
|
332 |
-
#: ../translatepress/includes/class-settings.php:
|
333 |
msgid "Addons"
|
334 |
msgstr ""
|
335 |
|
336 |
-
#: ../translatepress/includes/class-settings.php:
|
337 |
msgid "License"
|
338 |
msgstr ""
|
339 |
|
340 |
-
#: ../translatepress/includes/class-settings.php:
|
341 |
msgid "Settings"
|
342 |
msgstr ""
|
343 |
|
344 |
-
#: ../translatepress/includes/class-settings.php:
|
345 |
msgid "Pro Features"
|
346 |
msgstr ""
|
347 |
|
61 |
msgid "Select how the language should be detected for first time visitors.<br>The visitor's last displayed language will be remembered through cookies."
|
62 |
msgstr ""
|
63 |
|
64 |
+
#: ../tp-add-on-extra-languages/class-extra-languages.php:57, ../translatepress/includes/class-settings.php:356
|
65 |
msgid "Error! Duplicate URL slug values."
|
66 |
msgstr ""
|
67 |
|
89 |
msgid "Are you sure you want to remove this language?"
|
90 |
msgstr ""
|
91 |
|
92 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:43, ../translatepress/includes/class-advanced-tab.php:348, ../translatepress/includes/class-advanced-tab.php:358, ../translatepress/partials/main-settings-language-selector.php:40
|
93 |
msgid "Remove"
|
94 |
msgstr ""
|
95 |
|
97 |
msgid "Choose..."
|
98 |
msgstr ""
|
99 |
|
100 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:58, ../translatepress/includes/class-advanced-tab.php:358, ../translatepress/partials/main-settings-language-selector.php:55
|
101 |
msgid "Add"
|
102 |
msgstr ""
|
103 |
|
109 |
msgid "Limit this menu item to the following languages"
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: ../tp-add-on-seo-pack/class-seo-pack.php:146
|
113 |
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 submitting the sitemap to Google."
|
114 |
msgstr ""
|
115 |
|
185 |
msgid "Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages."
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: ../translatepress/includes/advanced-settings/machine-translation-limits.php:9
|
189 |
+
msgid "Limit machine translation / characters per day"
|
190 |
+
msgstr ""
|
191 |
+
|
192 |
+
#: ../translatepress/includes/advanced-settings/machine-translation-limits.php:10
|
193 |
+
msgid "Add a limit to the number of automatically translated characters so you can better budget your project.</a>. "
|
194 |
+
msgstr ""
|
195 |
+
|
196 |
+
#: ../translatepress/includes/advanced-settings/machine-translation-limits.php:21
|
197 |
+
msgid "Today's character count:"
|
198 |
+
msgstr ""
|
199 |
+
|
200 |
+
#: ../translatepress/includes/advanced-settings/machine-translation-limits.php:32
|
201 |
+
msgid "Today: "
|
202 |
+
msgstr ""
|
203 |
+
|
204 |
+
#: ../translatepress/includes/advanced-settings/machine-translation-limits.php:42
|
205 |
+
msgid "Log machine translation queries."
|
206 |
+
msgstr ""
|
207 |
+
|
208 |
+
#: ../translatepress/includes/advanced-settings/machine-translation-limits.php:43
|
209 |
+
msgid "Only enable for testing purposes. Can impact performance<br>All records are stored in the wp_trp_machine_translation_log database table. Use a plugin like <a href=\"https://wordpress.org/plugins/wp-data-access/\">WP Data Access</a> to browse the logs or directly from your database manager (PHPMyAdmin, etc.)"
|
210 |
+
msgstr ""
|
211 |
+
|
212 |
#: ../translatepress/includes/advanced-settings/show-dynamic-content-before-translation.php:8
|
213 |
msgid "Fix missing dynamic content"
|
214 |
msgstr ""
|
233 |
msgid "Filters gettext wrapping such as #!trpst#trp-gettext from all updated post meta. Does not affect previous post meta. <br/><strong>Database backup is recommended before switching on.</strong>"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: ../translatepress/includes/class-advanced-tab.php:19
|
237 |
msgid "Advanced"
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: ../translatepress/includes/class-advanced-tab.php:226, ../translatepress/partials/main-settings-page.php:41, ../translatepress/partials/main-settings-page.php:54, ../translatepress/partials/main-settings-page.php:67, ../translatepress/partials/main-settings-page.php:80
|
241 |
msgid "Yes"
|
242 |
msgstr ""
|
243 |
|
244 |
+
#: ../translatepress/includes/class-advanced-tab.php:348, ../translatepress/includes/class-advanced-tab.php:358
|
245 |
msgid "Are you sure you want to remove this item?"
|
246 |
msgstr ""
|
247 |
|
281 |
msgid "Others"
|
282 |
msgstr ""
|
283 |
|
284 |
+
#: ../translatepress/includes/class-plugin-notices.php:331
|
285 |
msgid "You are not using a permalink structure! Please <a href=\"%s\">enable</a> one or install our <a href=\"%s\">\"Language by GET parameter\"</a> addon, so that TranslatePress can function properly."
|
286 |
msgstr ""
|
287 |
|
288 |
+
#: ../translatepress/includes/class-plugin-notices.php:333, ../translatepress/includes/class-plugin-notices.php:359, ../translatepress/includes/class-plugin-notices.php:378, ../translatepress/includes/class-plugin-notices.php:392, ../translatepress/includes/class-plugin-notices.php:419
|
289 |
msgid "Dismiss this notice."
|
290 |
msgstr ""
|
291 |
|
292 |
+
#: ../translatepress/includes/class-plugin-notices.php:352
|
293 |
msgid "Your <strong>TranslatePress</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s"
|
294 |
msgstr ""
|
295 |
|
296 |
+
#: ../translatepress/includes/class-plugin-notices.php:354
|
297 |
msgid "Your <strong>TranslatePress</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s"
|
298 |
msgstr ""
|
299 |
|
300 |
+
#: ../translatepress/includes/class-plugin-notices.php:374
|
301 |
msgid "Your <strong>TranslatePress</strong> license will expire on %1$s. Please %2$sRenew Your Licence%3$s to continue receiving access to product downloads, automatic updates and support."
|
302 |
msgstr ""
|
303 |
|
304 |
+
#: ../translatepress/includes/class-plugin-notices.php:390
|
305 |
msgid "NEW: Display different images based on language. Find out <a href=\"https://translatepress.com/docs/image-translation/\" >how to translate images, sliders and more</a> from the TranslatePress editor."
|
306 |
msgstr ""
|
307 |
|
308 |
+
#: ../translatepress/includes/class-plugin-notices.php:417
|
309 |
+
msgid "The daily quota for machine translation characters exceeded. Please check the TranslatePress -> Settings -> Advanced Settings for more information."
|
310 |
+
msgstr ""
|
311 |
+
|
312 |
#: ../translatepress/includes/class-settings.php:26
|
313 |
msgid "Full Language Names"
|
314 |
msgstr ""
|
345 |
msgid "Top Left"
|
346 |
msgstr ""
|
347 |
|
348 |
+
#: ../translatepress/includes/class-settings.php:392
|
349 |
msgid "Current Language"
|
350 |
msgstr ""
|
351 |
|
352 |
+
#: ../translatepress/includes/class-settings.php:433
|
353 |
msgid "General"
|
354 |
msgstr ""
|
355 |
|
356 |
+
#: ../translatepress/includes/class-settings.php:438, ../translatepress/includes/class-translation-manager.php:242
|
357 |
msgid "Translate Site"
|
358 |
msgstr ""
|
359 |
|
360 |
+
#: ../translatepress/includes/class-settings.php:443
|
361 |
msgid "Addons"
|
362 |
msgstr ""
|
363 |
|
364 |
+
#: ../translatepress/includes/class-settings.php:451
|
365 |
msgid "License"
|
366 |
msgstr ""
|
367 |
|
368 |
+
#: ../translatepress/includes/class-settings.php:479, ../translatepress/includes/class-translation-manager.php:274
|
369 |
msgid "Settings"
|
370 |
msgstr ""
|
371 |
|
372 |
+
#: ../translatepress/includes/class-settings.php:483
|
373 |
msgid "Pro Features"
|
374 |
msgstr ""
|
375 |
|
readme.txt
CHANGED
@@ -1,554 +1,561 @@
|
|
1 |
-
=== TranslatePress - Translate Multilingual sites ===
|
2 |
-
Contributors: cozmoslabs, razvan.mo, madalin.ungureanu, cristophor
|
3 |
-
Donate link: https://www.translatepress.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: 5.2.3
|
7 |
-
Requires PHP: 5.6.20
|
8 |
-
Stable tag: 1.5.
|
9 |
-
License: GPLv2 or later
|
10 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
-
|
12 |
-
Easily translate your entire site directly from the front-end and go multilingual, with full support for WooCommerce, complex themes and site builders. Integrates with Google Translate.
|
13 |
-
|
14 |
-
== Description ==
|
15 |
-
|
16 |
-
**Experience a better way to translate your WordPress site and go multilingual, directly from the front-end using a friendly user interface.**
|
17 |
-
|
18 |
-
TranslatePress is a [WordPress translation plugin](https://translatepress.com/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) that anyone can use.
|
19 |
-
|
20 |
-
The interface allows you to easily translate the entire page at once, including output from shortcodes, forms and page builders. It also works out of the box with WooCommerce.
|
21 |
-
|
22 |
-
Built the WordPress way, TranslatePress - Multilingual is a GPL and self hosted translation plugin, meaning you'll own all your translations, forever. It's the fastest way to create a bilingual or multilingual site.
|
23 |
-
|
24 |
-
https://www.youtube.com/watch?v=pUlYisvBm8g
|
25 |
-
|
26 |
-
== Multilingual & Translation Features ==
|
27 |
-
|
28 |
-
* Translate all your website content directly from the front-end, in a friendly user interface (translation displayed in real-time).
|
29 |
-
* Fully compatible with all themes and plugins
|
30 |
-
* Live preview of your translated pages, as you edit your translations.
|
31 |
-
* [Image translation](https://translatepress.com/docs/image-translation/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) support, allowing you to [translate images, sliders and other media](https://translatepress.com/translate-images-in-wordpress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree).
|
32 |
-
* Support for both manual and automatic translation (via Google Translate)
|
33 |
-
* Ability to [translate dynamic strings](https://translatepress.com/translate-dynamic-strings-wordpress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) (gettext) added by WordPress, plugins and themes.
|
34 |
-
* Integrates with Google Translate, allowing you to set up Automatic Translation using your own Google API key.
|
35 |
-
* Translate larger html blocks by merging strings into translation blocks.
|
36 |
-
* Select specific html blocks for translation using the css class **translation-block**. `<p class="translation-block">Translate <em>everything</em> inside</p>`
|
37 |
-
* Place language switchers anywhere using shortcode **[language-switcher]**, WP menu item or as a floating dropdown.
|
38 |
-
* Editorial control allowing you to publish your language only when all your translations are done
|
39 |
-
* Conditional display content shortcode based on language [trp_language language="en_US"] English content only [/trp_language]
|
40 |
-
* Possibility to [edit gettext strings](https://translatepress.com/edit-plugin-strings/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) from themes and plugins from english to english, without adding another language. Basically a string-replace functionality.
|
41 |
-
* Translation Block feature in which you can translate multiple html elements together
|
42 |
-
* Native **Gutenberg** support, so you can easily [translate Gutenberg blocks](https://translatepress.com/translate-gutenberg-blocks-in-wordpress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree)
|
43 |
-
* Out of the box [WooCommerce](https://translatepress.com/translate-woocommerce-products-translatepress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) compatibility
|
44 |
-
|
45 |
-
Note: this WordPress translation plugin uses the Google Translation API to translate the strings on your site. This feature can be enabled or disabled according to your preferences.
|
46 |
-
|
47 |
-
Users with administrator rights have access to the following translate settings:
|
48 |
-
|
49 |
-
* select default language of the website and one translation language, for bilingual sites
|
50 |
-
* choose whether language switcher should display languages in their native names or English name
|
51 |
-
* force custom links to open in current language
|
52 |
-
* enable or disable url subdirectory for the default language
|
53 |
-
* enable automatic translation via Google Translate
|
54 |
-
|
55 |
-
== Powerful Translation Add-ons ==
|
56 |
-
|
57 |
-
TranslatePress - Multilingual has a range of [premium Add-ons](https://translatepress.com/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) that allow you to extend the power of the WordPress translation plugin:
|
58 |
-
|
59 |
-
**Pro Add-ons** (available in the [premium versions](https://translatepress.com/pricing/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) only)
|
60 |
-
|
61 |
-
* [Extra Languages](https://translatepress.com/docs/addons/seo-pack/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - allows you to add an unlimited number of translation languages, with the possibility to publish languages later after you complete the translation
|
62 |
-
* [SEO Pack](https://translatepress.com/docs/addons/multiple-languages/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - allows you to translate meta information (like page title, description, url slug, image alt tag, Twitter and Facebook Social Graph tags & more) for boosting your multilingual SEO and increase traffic
|
63 |
-
* [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
|
64 |
-
* [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
|
65 |
-
* [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
|
66 |
-
* [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
|
67 |
-
|
68 |
-
**Free Add-ons**
|
69 |
-
|
70 |
-
* [Language by GET parameter](https://translatepress.com/docs/addons/language-get-parameter/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - enables the language in the URL to be encoded as a GET Parameter
|
71 |
-
|
72 |
-
**Keyboard Shortcuts**
|
73 |
-
|
74 |
-
* **CTRL ( ⌘ ) + S** – Save translation for the currently editing strings
|
75 |
-
* **CTRL ( ⌘ ) + ALT + Z** – Discard all changes for the currently editing strings
|
76 |
-
* **CTRL ( ⌘ ) + ALT + →** (Right Arrow) – Navigate to next string to translate
|
77 |
-
* **CTRL ( ⌘ ) + ALT + ←** (Left Arrow) – Navigate to previous string to translate
|
78 |
-
|
79 |
-
= Website =
|
80 |
-
|
81 |
-
[translatepress.com](https://translatepress.com/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree)
|
82 |
-
|
83 |
-
= Documentation =
|
84 |
-
|
85 |
-
[Visit TranslatePress WordPress Translation plugin documentation page](https://translatepress.com/docs/translatepress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree)
|
86 |
-
|
87 |
-
= Add-ons =
|
88 |
-
|
89 |
-
[Add-ons](https://translatepress.com/docs/translatepress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree)
|
90 |
-
|
91 |
-
= Demo Site =
|
92 |
-
|
93 |
-
You can test out TranslatePress - Multilingual plugin by [visiting our demo site](https://demo.translatepress.com/)
|
94 |
-
|
95 |
-
== Installation ==
|
96 |
-
|
97 |
-
1. Upload the translatepress folder to the '/wp-content/plugins/' directory
|
98 |
-
2. Activate the plugin through the 'Plugins' menu in WordPress
|
99 |
-
3. Go to Settings -> TranslatePress and choose a translation language.
|
100 |
-
4. Open the front-end translation editor from the admin bar to translate your site.
|
101 |
-
|
102 |
-
== Frequently Asked Questions ==
|
103 |
-
|
104 |
-
= Where are my translations stored? =
|
105 |
-
|
106 |
-
All the translation are stored locally in your server's database.
|
107 |
-
|
108 |
-
= What types of content can I translate? =
|
109 |
-
|
110 |
-
TranslatePress - Multilingual plugin works out of the box with WooCommerce, custom post types, complex themes and site builders, so you'll be able to translate any type of content.
|
111 |
-
|
112 |
-
= How is it different from other multilingual & translation plugins like WPML or Polylang? =
|
113 |
-
|
114 |
-
TranslatePress is easier to use and more intuitive altogether. No more switching between the editor, string translation interfaces or badly translated plugins. You can now translate the full page content directly from the front-end. This makes TranslatePress a great alternative to plugins like Polylang and WPML.
|
115 |
-
|
116 |
-
= How do I start to translate my WordPress site? =
|
117 |
-
|
118 |
-
After installing the plugin, select your secondary language and click "Translate Site" to start translating your entire site exactly as it looks in the front-end.
|
119 |
-
|
120 |
-
= Will it slow down my website? =
|
121 |
-
|
122 |
-
TranslatePress will have little impact on your site speed. For more details see [Top WordPress Translation Plugins Compared Based on Page Load Time](https://translatepress.com/top-wordpress-translation-plugins-compared-based-on-page-load-time/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree)
|
123 |
-
|
124 |
-
= Does it work with WooCommerce? =
|
125 |
-
|
126 |
-
Yes, TranslatePress works out of the box with WooCommerce. You can use it to [translate WooCommerce products](https://translatepress.com/translate-woocommerce-products-translatepress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) and build a multilingual store.
|
127 |
-
|
128 |
-
= Where can I find out more information? =
|
129 |
-
|
130 |
-
For more information please check out [TranslatePress - Multilingual plugin documentation](https://translatepress.com/docs/translatepress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree).
|
131 |
-
|
132 |
-
|
133 |
-
== Screenshots ==
|
134 |
-
1. TranslatePress front-end visual translation editor in action
|
135 |
-
2. Front-end translation editor used to translate the entire page content
|
136 |
-
3. How to translate a Dynamic String (gettext) using TranslatePress - Multilingual
|
137 |
-
4. Translate WooCommerce Products using TranslatePress - Multilingual
|
138 |
-
5. Translate Images and Image Sliders
|
139 |
-
6. Settings Page for TranslatePress - Multilingual
|
140 |
-
7. Floating Language Switcher added by TranslatePress - Multilingual
|
141 |
-
8. Menu Language Switcher
|
142 |
-
|
143 |
-
|
144 |
-
== Changelog ==
|
145 |
-
= 1.5.
|
146 |
-
*
|
147 |
-
|
148 |
-
|
149 |
-
*
|
150 |
-
*
|
151 |
-
|
152 |
-
|
153 |
-
*
|
154 |
-
|
155 |
-
|
156 |
-
*
|
157 |
-
*
|
158 |
-
*
|
159 |
-
*
|
160 |
-
*
|
161 |
-
*
|
162 |
-
*
|
163 |
-
*
|
164 |
-
*
|
165 |
-
|
166 |
-
|
167 |
-
* Fixed
|
168 |
-
|
169 |
-
|
170 |
-
*
|
171 |
-
*
|
172 |
-
|
173 |
-
|
174 |
-
*
|
175 |
-
|
176 |
-
= 1.5.
|
177 |
-
*
|
178 |
-
|
179 |
-
|
180 |
-
*
|
181 |
-
* Added
|
182 |
-
|
183 |
-
= 1.5.
|
184 |
-
*
|
185 |
-
|
186 |
-
|
187 |
-
*
|
188 |
-
* Added
|
189 |
-
|
190 |
-
|
191 |
-
*
|
192 |
-
*
|
193 |
-
*
|
194 |
-
*
|
195 |
-
*
|
196 |
-
* Fixed
|
197 |
-
* Fixed
|
198 |
-
|
199 |
-
|
200 |
-
* Fixed
|
201 |
-
|
202 |
-
|
203 |
-
* Fixed
|
204 |
-
* Fixed
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
*
|
211 |
-
*
|
212 |
-
*
|
213 |
-
|
214 |
-
|
215 |
-
*
|
216 |
-
* Added
|
217 |
-
*
|
218 |
-
*
|
219 |
-
|
220 |
-
|
221 |
-
*
|
222 |
-
|
223 |
-
|
224 |
-
* Fixed
|
225 |
-
*
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
* Fixed
|
232 |
-
*
|
233 |
-
*
|
234 |
-
*
|
235 |
-
|
236 |
-
|
237 |
-
*
|
238 |
-
* Fixed
|
239 |
-
*
|
240 |
-
*
|
241 |
-
|
242 |
-
|
243 |
-
*
|
244 |
-
*
|
245 |
-
*
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
* Added
|
251 |
-
*
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
* Fixed an issue with
|
256 |
-
*
|
257 |
-
*
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
*
|
262 |
-
|
263 |
-
|
264 |
-
*
|
265 |
-
|
266 |
-
|
267 |
-
* Added
|
268 |
-
*
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
*
|
275 |
-
*
|
276 |
-
*
|
277 |
-
*
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
*
|
282 |
-
*
|
283 |
-
*
|
284 |
-
*
|
285 |
-
|
286 |
-
|
287 |
-
*
|
288 |
-
*
|
289 |
-
* Fixed
|
290 |
-
|
291 |
-
|
292 |
-
*
|
293 |
-
*
|
294 |
-
*
|
295 |
-
*
|
296 |
-
*
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
*
|
301 |
-
*
|
302 |
-
*
|
303 |
-
*
|
304 |
-
*
|
305 |
-
|
306 |
-
|
307 |
-
*
|
308 |
-
*
|
309 |
-
* Fixed
|
310 |
-
|
311 |
-
|
312 |
-
*
|
313 |
-
* Added
|
314 |
-
|
315 |
-
|
316 |
-
* Fixed
|
317 |
-
|
318 |
-
|
319 |
-
*
|
320 |
-
*
|
321 |
-
|
322 |
-
= 1.3.
|
323 |
-
* Fixed issue with
|
324 |
-
*
|
325 |
-
|
326 |
-
|
327 |
-
*
|
328 |
-
|
329 |
-
|
330 |
-
* Fixed
|
331 |
-
*
|
332 |
-
|
333 |
-
|
334 |
-
*
|
335 |
-
*
|
336 |
-
|
337 |
-
|
338 |
-
*
|
339 |
-
*
|
340 |
-
* Added
|
341 |
-
*
|
342 |
-
* Added
|
343 |
-
|
344 |
-
|
345 |
-
* Fixed
|
346 |
-
|
347 |
-
|
348 |
-
* Added
|
349 |
-
*
|
350 |
-
* Fixed
|
351 |
-
*
|
352 |
-
*
|
353 |
-
|
354 |
-
|
355 |
-
* Added
|
356 |
-
*
|
357 |
-
*
|
358 |
-
*
|
359 |
-
*
|
360 |
-
|
361 |
-
|
362 |
-
*
|
363 |
-
*
|
364 |
-
*
|
365 |
-
*
|
366 |
-
* Fixed
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
*
|
371 |
-
*
|
372 |
-
*
|
373 |
-
* Fixed
|
374 |
-
*
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
*
|
380 |
-
* Fixed incorrect
|
381 |
-
*
|
382 |
-
* Fixed
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
*
|
387 |
-
* Fixed
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
*
|
394 |
-
*
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
*
|
401 |
-
*
|
402 |
-
* Fixed
|
403 |
-
*
|
404 |
-
|
405 |
-
|
406 |
-
* Fixed
|
407 |
-
|
408 |
-
|
409 |
-
*
|
410 |
-
*
|
411 |
-
*
|
412 |
-
*
|
413 |
-
*
|
414 |
-
|
415 |
-
= 1.2.
|
416 |
-
*
|
417 |
-
*
|
418 |
-
* Fix:
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
*
|
424 |
-
*
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
*
|
431 |
-
*
|
432 |
-
|
433 |
-
|
434 |
-
*
|
435 |
-
|
436 |
-
|
437 |
-
*
|
438 |
-
|
439 |
-
|
440 |
-
*
|
441 |
-
*
|
442 |
-
*
|
443 |
-
*
|
444 |
-
*
|
445 |
-
|
446 |
-
= 1.1.
|
447 |
-
*
|
448 |
-
*
|
449 |
-
*
|
450 |
-
* Fixed
|
451 |
-
*
|
452 |
-
|
453 |
-
= 1.1.
|
454 |
-
* Added support for
|
455 |
-
*
|
456 |
-
*
|
457 |
-
* Fixed issue with
|
458 |
-
* Added
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
*
|
464 |
-
* Fixed issue with
|
465 |
-
*
|
466 |
-
*
|
467 |
-
*
|
468 |
-
|
469 |
-
= 1.1.
|
470 |
-
*
|
471 |
-
* Fixed issue with
|
472 |
-
*
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
*
|
478 |
-
* Fixed
|
479 |
-
*
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
* Fixed
|
484 |
-
*
|
485 |
-
*
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
* Fixed
|
491 |
-
*
|
492 |
-
*
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
*
|
497 |
-
*
|
498 |
-
*
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
*
|
504 |
-
*
|
505 |
-
*
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
* Fixed
|
511 |
-
* Fixed
|
512 |
-
* Fixed
|
513 |
-
*
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
*
|
518 |
-
* Fixed
|
519 |
-
*
|
520 |
-
*
|
521 |
-
|
522 |
-
= 1.0.
|
523 |
-
* Added
|
524 |
-
*
|
525 |
-
*
|
526 |
-
*
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
*
|
531 |
-
*
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
*
|
537 |
-
* Fixed
|
538 |
-
*
|
539 |
-
|
540 |
-
= 1.0.
|
541 |
-
*
|
542 |
-
*
|
543 |
-
*
|
544 |
-
* Fixed
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
*
|
549 |
-
*
|
550 |
-
*
|
551 |
-
* Fixed
|
552 |
-
|
553 |
-
= 1.0.
|
554 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== TranslatePress - Translate Multilingual sites ===
|
2 |
+
Contributors: cozmoslabs, razvan.mo, madalin.ungureanu, cristophor
|
3 |
+
Donate link: https://www.translatepress.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: 5.2.3
|
7 |
+
Requires PHP: 5.6.20
|
8 |
+
Stable tag: 1.5.8
|
9 |
+
License: GPLv2 or later
|
10 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
+
|
12 |
+
Easily translate your entire site directly from the front-end and go multilingual, with full support for WooCommerce, complex themes and site builders. Integrates with Google Translate.
|
13 |
+
|
14 |
+
== Description ==
|
15 |
+
|
16 |
+
**Experience a better way to translate your WordPress site and go multilingual, directly from the front-end using a friendly user interface.**
|
17 |
+
|
18 |
+
TranslatePress is a [WordPress translation plugin](https://translatepress.com/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) that anyone can use.
|
19 |
+
|
20 |
+
The interface allows you to easily translate the entire page at once, including output from shortcodes, forms and page builders. It also works out of the box with WooCommerce.
|
21 |
+
|
22 |
+
Built the WordPress way, TranslatePress - Multilingual is a GPL and self hosted translation plugin, meaning you'll own all your translations, forever. It's the fastest way to create a bilingual or [multilingual site](https://translatepress.com/how-to-create-a-multilingual-wordpress-site/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree).
|
23 |
+
|
24 |
+
https://www.youtube.com/watch?v=pUlYisvBm8g
|
25 |
+
|
26 |
+
== Multilingual & Translation Features ==
|
27 |
+
|
28 |
+
* Translate all your website content directly from the front-end, in a friendly user interface (translation displayed in real-time).
|
29 |
+
* Fully compatible with all themes and plugins
|
30 |
+
* Live preview of your translated pages, as you edit your translations.
|
31 |
+
* [Image translation](https://translatepress.com/docs/image-translation/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) support, allowing you to [translate images, sliders and other media](https://translatepress.com/translate-images-in-wordpress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree).
|
32 |
+
* Support for both manual and automatic translation (via Google Translate)
|
33 |
+
* Ability to [translate dynamic strings](https://translatepress.com/translate-dynamic-strings-wordpress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) (gettext) added by WordPress, plugins and themes.
|
34 |
+
* Integrates with Google Translate, allowing you to set up Automatic Translation using your own Google API key.
|
35 |
+
* Translate larger html blocks by merging strings into translation blocks.
|
36 |
+
* Select specific html blocks for translation using the css class **translation-block**. `<p class="translation-block">Translate <em>everything</em> inside</p>`
|
37 |
+
* Place language switchers anywhere using shortcode **[language-switcher]**, WP menu item or as a floating dropdown.
|
38 |
+
* Editorial control allowing you to publish your language only when all your translations are done
|
39 |
+
* Conditional display content shortcode based on language [trp_language language="en_US"] English content only [/trp_language]
|
40 |
+
* Possibility to [edit gettext strings](https://translatepress.com/edit-plugin-strings/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) from themes and plugins from english to english, without adding another language. Basically a string-replace functionality.
|
41 |
+
* Translation Block feature in which you can translate multiple html elements together
|
42 |
+
* Native **Gutenberg** support, so you can easily [translate Gutenberg blocks](https://translatepress.com/translate-gutenberg-blocks-in-wordpress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree)
|
43 |
+
* Out of the box [WooCommerce](https://translatepress.com/translate-woocommerce-products-translatepress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) compatibility
|
44 |
+
|
45 |
+
Note: this WordPress translation plugin uses the Google Translation API to translate the strings on your site. This feature can be enabled or disabled according to your preferences.
|
46 |
+
|
47 |
+
Users with administrator rights have access to the following translate settings:
|
48 |
+
|
49 |
+
* select default language of the website and one translation language, for bilingual sites
|
50 |
+
* choose whether language switcher should display languages in their native names or English name
|
51 |
+
* force custom links to open in current language
|
52 |
+
* enable or disable url subdirectory for the default language
|
53 |
+
* enable automatic translation via Google Translate
|
54 |
+
|
55 |
+
== Powerful Translation Add-ons ==
|
56 |
+
|
57 |
+
TranslatePress - Multilingual has a range of [premium Add-ons](https://translatepress.com/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) that allow you to extend the power of the WordPress translation plugin:
|
58 |
+
|
59 |
+
**Pro Add-ons** (available in the [premium versions](https://translatepress.com/pricing/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) only)
|
60 |
+
|
61 |
+
* [Extra Languages](https://translatepress.com/docs/addons/seo-pack/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - allows you to add an unlimited number of translation languages, with the possibility to publish languages later after you complete the translation
|
62 |
+
* [SEO Pack](https://translatepress.com/docs/addons/multiple-languages/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - allows you to translate meta information (like page title, description, url slug, image alt tag, Twitter and Facebook Social Graph tags & more) for boosting your multilingual SEO and increase traffic
|
63 |
+
* [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
|
64 |
+
* [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
|
65 |
+
* [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
|
66 |
+
* [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
|
67 |
+
|
68 |
+
**Free Add-ons**
|
69 |
+
|
70 |
+
* [Language by GET parameter](https://translatepress.com/docs/addons/language-get-parameter/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) - enables the language in the URL to be encoded as a GET Parameter
|
71 |
+
|
72 |
+
**Keyboard Shortcuts**
|
73 |
+
|
74 |
+
* **CTRL ( ⌘ ) + S** – Save translation for the currently editing strings
|
75 |
+
* **CTRL ( ⌘ ) + ALT + Z** – Discard all changes for the currently editing strings
|
76 |
+
* **CTRL ( ⌘ ) + ALT + →** (Right Arrow) – Navigate to next string to translate
|
77 |
+
* **CTRL ( ⌘ ) + ALT + ←** (Left Arrow) – Navigate to previous string to translate
|
78 |
+
|
79 |
+
= Website =
|
80 |
+
|
81 |
+
[translatepress.com](https://translatepress.com/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree)
|
82 |
+
|
83 |
+
= Documentation =
|
84 |
+
|
85 |
+
[Visit TranslatePress WordPress Translation plugin documentation page](https://translatepress.com/docs/translatepress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree)
|
86 |
+
|
87 |
+
= Add-ons =
|
88 |
+
|
89 |
+
[Add-ons](https://translatepress.com/docs/translatepress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree)
|
90 |
+
|
91 |
+
= Demo Site =
|
92 |
+
|
93 |
+
You can test out TranslatePress - Multilingual plugin by [visiting our demo site](https://demo.translatepress.com/)
|
94 |
+
|
95 |
+
== Installation ==
|
96 |
+
|
97 |
+
1. Upload the translatepress folder to the '/wp-content/plugins/' directory
|
98 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
99 |
+
3. Go to Settings -> TranslatePress and choose a translation language.
|
100 |
+
4. Open the front-end translation editor from the admin bar to translate your site.
|
101 |
+
|
102 |
+
== Frequently Asked Questions ==
|
103 |
+
|
104 |
+
= Where are my translations stored? =
|
105 |
+
|
106 |
+
All the translation are stored locally in your server's database.
|
107 |
+
|
108 |
+
= What types of content can I translate? =
|
109 |
+
|
110 |
+
TranslatePress - Multilingual plugin works out of the box with WooCommerce, custom post types, complex themes and site builders, so you'll be able to translate any type of content.
|
111 |
+
|
112 |
+
= How is it different from other multilingual & translation plugins like WPML or Polylang? =
|
113 |
+
|
114 |
+
TranslatePress is easier to use and more intuitive altogether. No more switching between the editor, string translation interfaces or badly translated plugins. You can now translate the full page content directly from the front-end. This makes TranslatePress a great alternative to plugins like Polylang and WPML.
|
115 |
+
|
116 |
+
= How do I start to translate my WordPress site? =
|
117 |
+
|
118 |
+
After installing the plugin, select your secondary language and click "Translate Site" to start translating your entire site exactly as it looks in the front-end.
|
119 |
+
|
120 |
+
= Will it slow down my website? =
|
121 |
+
|
122 |
+
TranslatePress will have little impact on your site speed. For more details see [Top WordPress Translation Plugins Compared Based on Page Load Time](https://translatepress.com/top-wordpress-translation-plugins-compared-based-on-page-load-time/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree)
|
123 |
+
|
124 |
+
= Does it work with WooCommerce? =
|
125 |
+
|
126 |
+
Yes, TranslatePress works out of the box with WooCommerce. You can use it to [translate WooCommerce products](https://translatepress.com/translate-woocommerce-products-translatepress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree) and build a multilingual store.
|
127 |
+
|
128 |
+
= Where can I find out more information? =
|
129 |
+
|
130 |
+
For more information please check out [TranslatePress - Multilingual plugin documentation](https://translatepress.com/docs/translatepress/?utm_source=wp.org&utm_medium=tp-description-page&utm_campaign=TPFree).
|
131 |
+
|
132 |
+
|
133 |
+
== Screenshots ==
|
134 |
+
1. TranslatePress front-end visual translation editor in action
|
135 |
+
2. Front-end translation editor used to translate the entire page content
|
136 |
+
3. How to translate a Dynamic String (gettext) using TranslatePress - Multilingual
|
137 |
+
4. Translate WooCommerce Products using TranslatePress - Multilingual
|
138 |
+
5. Translate Images and Image Sliders
|
139 |
+
6. Settings Page for TranslatePress - Multilingual
|
140 |
+
7. Floating Language Switcher added by TranslatePress - Multilingual
|
141 |
+
8. Menu Language Switcher
|
142 |
+
|
143 |
+
|
144 |
+
== Changelog ==
|
145 |
+
= 1.5.8 =
|
146 |
+
* Added machine translation limit
|
147 |
+
* Added setting for translation memory limit
|
148 |
+
* Fixed encoding for the "Fix broken html feature"
|
149 |
+
* Fixed CSS for translate button in TP Editor
|
150 |
+
* Fixed disabling dynamic translation in translation editor when it is disabled from Advanced option
|
151 |
+
|
152 |
+
= 1.5.7 =
|
153 |
+
* Modified an autoloader to prevent errors when manually updating the plugin
|
154 |
+
|
155 |
+
= 1.5.6 =
|
156 |
+
* Improved speed on Gettext exclusion
|
157 |
+
* Make Gettext exclusion work without a domain in Advanced Settings
|
158 |
+
* Allow po/mo localization files to translate excluded Gettext strings
|
159 |
+
* Added Advanced setting to Exclude selectors from translation
|
160 |
+
* Added option to change floating language switcher position
|
161 |
+
* Added compatibility with CartFlows plugin
|
162 |
+
* Added compatibility with NextGen plugin
|
163 |
+
* Added compatibility with Ninja Popups plugin mails
|
164 |
+
* Added compatibility with Woo Tours plugin
|
165 |
+
* Fixed issue with trp-gettext wrappings in WooCommerce REST API
|
166 |
+
* Fixed issue with translating images run through JetPack CDN
|
167 |
+
* Fixed edge case where gettext inside script tag attributes was breaking html
|
168 |
+
* Translated title of product in WooCommerce "Product has been added to cart" message
|
169 |
+
* Better handling of string overdetection in dynamic string translation
|
170 |
+
* Better handling of sql errors and machine translation
|
171 |
+
* Fixed WooCommerce Product Translation on Cart Page for products with hyphen in their names
|
172 |
+
|
173 |
+
= 1.5.5 =
|
174 |
+
* Fixed warnings regarding settings that appeared on fresh installs
|
175 |
+
|
176 |
+
= 1.5.4 =
|
177 |
+
* Added Translation Memory feature
|
178 |
+
* Beaver Builder compatibility
|
179 |
+
* Fixed isseu with gettext special characters inside attributes breaking html sometimes
|
180 |
+
* Fixed an issue with urls slugs not being translated in site-map for secondary languages if "Use subdirectory on default language" was on
|
181 |
+
* Added support for display attribute for language-switcher shortcode
|
182 |
+
|
183 |
+
= 1.5.3 =
|
184 |
+
* Fixed blank page when opening Translation Editor in some localized languages
|
185 |
+
|
186 |
+
= 1.5.2 =
|
187 |
+
* Added -Advanced- tab with various custom settings
|
188 |
+
* Added compatibility to allow translating SeedProd plugin Coming Soon page
|
189 |
+
|
190 |
+
= 1.5.1 =
|
191 |
+
* Added maximum possible size to srcset for translated images
|
192 |
+
* Added compatibility with Query Monitor plugin
|
193 |
+
* Better handling of licenses when pro addons are active
|
194 |
+
* Improved descriptions in settings page and other places
|
195 |
+
* Added filter to allow translation of href as an exception
|
196 |
+
* Fixed translation blocks not working on live in some edge cases
|
197 |
+
* Fixed translation block created in secondary language not working when strings were already translated
|
198 |
+
* Fixed JS error when dynamic translation is disabled by filter
|
199 |
+
* Fixed translating dynamic strings in Editor when viewing as Logged out
|
200 |
+
* Fixed page titles containing special characters not being translated
|
201 |
+
* Fixed title attribute not being translated
|
202 |
+
* Fixed certain custom WooCommerce permalinks not working on translated products
|
203 |
+
* Fixed pencil icon not showing for WooCommerce product images in Shop page on certain themes
|
204 |
+
* Fixed modifying wp_mail headers when we didn't have to
|
205 |
+
|
206 |
+
= 1.5.0 =
|
207 |
+
* Fixed some dynamic images not showing up in translated pages.
|
208 |
+
|
209 |
+
= 1.4.9 =
|
210 |
+
* Fixed incompatibility with custom code for changing flags
|
211 |
+
* Fixed some pages not being translated due to incorrectly encoded character
|
212 |
+
* Fixed some images missing when automatic translation is on
|
213 |
+
|
214 |
+
= 1.4.8 =
|
215 |
+
* Added support for translating images
|
216 |
+
* Added support for translating title attribute
|
217 |
+
* Added support for translating href pointing to internal files and href pointing to any external links
|
218 |
+
* Added support for translating attributes modified dynamically through JS
|
219 |
+
* Added support for translating multiple attributes on the same node
|
220 |
+
* Added support for translating nodes containing mixt of gettext and user-inputted strings
|
221 |
+
* Added notification and disabled TP for servers not running minimum PHP version 5.6.20
|
222 |
+
* Refactored and improved Translation Editor user interface
|
223 |
+
* Added Keyboard shortcuts: CTRL + S (save), CTRL + ALT + Z (discard all changes), CTRL + ALT + LEFT (previous string), CTRL + ALT + RIGHT (next string)
|
224 |
+
* Fixed issues with translation blocks not working on some instances
|
225 |
+
* Security improvements
|
226 |
+
|
227 |
+
= 1.4.7 =
|
228 |
+
* Fixed a php error in previous commit
|
229 |
+
|
230 |
+
= 1.4.6 =
|
231 |
+
* Fixed a js compatibility error with mootools.js
|
232 |
+
* Modified how the license page works and added plugin notifications
|
233 |
+
* Allow compatibility fix for Translation Editor on certain environments
|
234 |
+
* Fixed Safari bug with links when WooCommerce active
|
235 |
+
|
236 |
+
= 1.4.5 =
|
237 |
+
* Performance improvements
|
238 |
+
* Fixed an issue that was causing empty strings to get inserted in the database
|
239 |
+
* Improvements to detecting dynamic js strings earlier
|
240 |
+
* Fixes some urls for sitemap
|
241 |
+
* We now check if str_get_html is successful to avoid fatal error
|
242 |
+
* Fixed regular string loaded by ajax not detected in translation editor
|
243 |
+
* We now allow translating WooCommerce product base name separately from selected variations
|
244 |
+
* Fixed WooCommerce cart details not being translated when changing language
|
245 |
+
* Fixed Automatic Google Translation on languages not published yet
|
246 |
+
* Fixed Translation Editor not working in default language when no translation language is published yet
|
247 |
+
* Fixed gettext wrapping characters showing up in WooCommerce Shipping taxes metabox on Order pages
|
248 |
+
|
249 |
+
= 1.4.4 =
|
250 |
+
* Added more filters
|
251 |
+
* Make sure we do not insert empty strings in the gettext translation table
|
252 |
+
* Added support for Affiliate tracking
|
253 |
+
|
254 |
+
= 1.4.3 =
|
255 |
+
* Fixed an issue with the Language by Get Parameter add-on
|
256 |
+
* Added compatibility with WooCommerce PDF invoice and WooCommerce's order notes.
|
257 |
+
* Added stop_translating_page and before_running_hooks hooks.
|
258 |
+
* Refactored hooks-loader to easily remove hook
|
259 |
+
|
260 |
+
= 1.4.2 =
|
261 |
+
* Fixes the issue with not being able to publish pages when Use subdirectory for default language is set to yes and Gutenberg is installed
|
262 |
+
* Fixed an issue with Elementor and Use subdirectory for default language set to yes
|
263 |
+
* Fixed an issue with Yoast Premium and Use subdirectory for default language set to yes
|
264 |
+
* Fixed missing spaces in translations for original gettext strings with untrimmed spaces
|
265 |
+
|
266 |
+
= 1.4.1 =
|
267 |
+
* Added PHP 7.3 support
|
268 |
+
* Performance improvements
|
269 |
+
|
270 |
+
= 1.4.0 =
|
271 |
+
* Added Enfold compatibility by increasing the template_include hook priority
|
272 |
+
* Add the costa rica flag
|
273 |
+
* Speed improvements by optimizing the full_trim function
|
274 |
+
* Added compatibility for WooCommerce Invoices plugins
|
275 |
+
* Fixed querying for dynamic strings in Translation Editor not bringing up translations for all languages
|
276 |
+
* Fixed notice when gettext table is empty
|
277 |
+
* Added function to display strings with bad encoding in Translation Editor
|
278 |
+
|
279 |
+
|
280 |
+
= 1.3.9 =
|
281 |
+
* Fixed some issues with url translations
|
282 |
+
* Speed improvements
|
283 |
+
* Add Javanese flag
|
284 |
+
* Fixed issue with trimming dynamic strings in our own ajax calls
|
285 |
+
|
286 |
+
= 1.3.8 =
|
287 |
+
* Speed improvements
|
288 |
+
* Remove notices from Editor when we don't have translation languages
|
289 |
+
* Fixed notices with referrer in translator machine
|
290 |
+
* Fixed issues with urls in other languages
|
291 |
+
* Fix issue of nested gettext resulting in unwanted characters
|
292 |
+
* Strip gettext tags from urls run through sanitize_title and esc_url
|
293 |
+
* Set caching calls non-persistent. Doesn't work with object caching otherwise
|
294 |
+
* Set lang attribute in html tag all the time including when on default language
|
295 |
+
* Refactored the way we translate json
|
296 |
+
* Fixed issue with Woocommerce ajax calls
|
297 |
+
|
298 |
+
= 1.3.7 =
|
299 |
+
* Fixed an issue with Woocommerce and redirects when the default language is not English
|
300 |
+
* Speed improvements
|
301 |
+
* Fix relative url without a trailingslash not getting a proper link back
|
302 |
+
* Add ?trp=edit-translation=preview to ajax loaded content. Also add it to all dynamic content.
|
303 |
+
* Added language code column in settings
|
304 |
+
* Removed async false from JS translate-dom-changes
|
305 |
+
|
306 |
+
= 1.3.6 =
|
307 |
+
* Refactored the get_url_for_language() function which should fix a lot of problems with links
|
308 |
+
* Speed improvements
|
309 |
+
* Fixed translation block icon when creating a new block
|
310 |
+
* Fixed issues with trp tags leftovers in html
|
311 |
+
* Fixed issues with gettext strings that weren't detected correctly
|
312 |
+
* Add support for relative url's
|
313 |
+
* Added warning in settings about controlling costs of Google API
|
314 |
+
* Changed API key field description. Added feature to show/hide API key field based on Google Translate Active Yes/No
|
315 |
+
* Fixed Translated-dom-changes string not translated through trp-ajax.
|
316 |
+
* Fixed 400 errors in google translate API
|
317 |
+
|
318 |
+
= 1.3.5 =
|
319 |
+
* Fixed translation problems introduced in the last two versions
|
320 |
+
* Added a console message when trp-ajax request uses fall back to admin ajax for debugging purposes.
|
321 |
+
|
322 |
+
= 1.3.4 =
|
323 |
+
* Fixed issue with options in select tag that couldn't be translated
|
324 |
+
* Fixed force language in custom links
|
325 |
+
* Fixed Woocommerce links fpr products or categories that were added by the user manually in a page
|
326 |
+
* Added Settings link to the list of links displayed on Plugins page
|
327 |
+
* Fixed issue with Kazakhstan flag
|
328 |
+
|
329 |
+
= 1.3.3 =
|
330 |
+
* Fixed issue with Woocommerce ajax strings that were broken in editor on default language in some cases
|
331 |
+
* Speed improvements
|
332 |
+
|
333 |
+
= 1.3.2 =
|
334 |
+
* Speed improvements
|
335 |
+
* Add support for the Ginger – EU Cookie Law plugin
|
336 |
+
* Add support for data-no-dynamic-translation attribute that skips dynamic strings from being translated by dom changes detector
|
337 |
+
* Fixed Edit Pencil icon css in Translation Editor for some sites
|
338 |
+
* Refactored the way we add trp-gettext tag. This should have a lot of benefits in compatibility with other plugins
|
339 |
+
* Optimized block translation detection
|
340 |
+
* Added caching to trp_x function when reading external .mo files
|
341 |
+
* Fixed issue with translatepress icon css that was broken on wpforms forms
|
342 |
+
* Added secret page for removing duplicate rows from database: wp-admin/admin.php?page=trp_remove_duplicate_rows
|
343 |
+
|
344 |
+
= 1.3.1 =
|
345 |
+
* Fixed Woocommerce translation of permalinks
|
346 |
+
* Added support for remove_accents to be based on default language when called from the sanitize_title function
|
347 |
+
* Added support for translating JSON found in custom ajax request
|
348 |
+
* Added better REST compatibility
|
349 |
+
* Added compatibility for Peepso plugin
|
350 |
+
* Fixed TranslatePress roken link to google translate set up api key on settings page
|
351 |
+
* Corrected flags for Arabic and Bengali languages
|
352 |
+
* Fixed issue with multiple slashes being added when the URL had extra get parameters
|
353 |
+
|
354 |
+
= 1.3.0 =
|
355 |
+
* Added support for word trim when the default language is japanese, chinese or thai.
|
356 |
+
* Exluded wp_trim_words funtion from our gettext filter to prevent som issues
|
357 |
+
* Fixed an issue with gettext inside attributes that passed through the wp_kses function.
|
358 |
+
* Fixed issues with the Customizer
|
359 |
+
* Added padding to the language switcher image so we don't conflict with themes that add extra padding to images inside links
|
360 |
+
* We no longer remove \r \n \t from the translation
|
361 |
+
* Fixed issue with title attribute that contained html
|
362 |
+
* Added a filter to all href attributes detected on our translation page
|
363 |
+
* Added a notice to inform admins of the missing mbstring php library
|
364 |
+
* We now send all error logs to debug.log
|
365 |
+
* Added cite and blockquote as top_parents for merge rule on Translation blocks
|
366 |
+
* Fixed nonce accidentally being passed through internationalized function
|
367 |
+
|
368 |
+
= 1.2.9 =
|
369 |
+
* Rearranged and renamed some languages in the options dropdown
|
370 |
+
* Fixed flag of Khmer language
|
371 |
+
* Added Automatic Language Detection notice and included it on add-ons page
|
372 |
+
* Fixed an issue with WooCommerce checkout and Stripe Gateway
|
373 |
+
* Fixed issues with some improper responses from the WP Remote API functions
|
374 |
+
* Fixed minor issues with ajax
|
375 |
+
|
376 |
+
= 1.2.8 =
|
377 |
+
* Added a lot of hooks in the translation manager interface so other people can insert new content there.
|
378 |
+
* We now take into account the presence of www or lack of it in custom links that might be local
|
379 |
+
* We now make sure we're not changing the locale in the backend if the language order is different.
|
380 |
+
* Fixed issue with incorrect language adding in the backend that caused notices in the front-end
|
381 |
+
* Removed obsolete function add_cookie
|
382 |
+
* Fixed trailingslashit over get_permalink in url-converter
|
383 |
+
* Removed adding cookie from php. Fixed enqueue_styles on license and add-ons tabs. Removed deprecated function.
|
384 |
+
|
385 |
+
= 1.2.7 =
|
386 |
+
* Added a warning when changing the default language that it will invalidate their existing translations
|
387 |
+
* Fixed incorrect detection of the form action language parameter
|
388 |
+
* Improved compatibility with themes and plugins that use object buffering
|
389 |
+
* Fixed some issues with image urls
|
390 |
+
|
391 |
+
= 1.2.6 =
|
392 |
+
* Refactored determining language, redirecting and cookie adding
|
393 |
+
* Removed leftover trp-gettext tags when WooCommerce is active on some pages
|
394 |
+
* Fixed get_url_for_language function that was having problems in some cases.
|
395 |
+
|
396 |
+
= 1.2.5 =
|
397 |
+
* Fixed DOM changes script not being enqueued anymore
|
398 |
+
|
399 |
+
= 1.2.4 =
|
400 |
+
* Refactor the shortcode language switcher so it's now HTML similar to the floater
|
401 |
+
* Added link to Appearance -> menus in TranslatePress settings page
|
402 |
+
* Fixed language redirect with permalinks so custom parameters are passed correctly back to the url
|
403 |
+
* Do not load dynamic string translation for IE11 and older
|
404 |
+
|
405 |
+
= 1.2.3 =
|
406 |
+
* Fixed back-end css style not being targeted only for TranslatePress Settings page
|
407 |
+
* Add filter to not remove detected dynamic strings until the ajax is finished
|
408 |
+
* Fixed data-no-translation not taken into account in some cases of Dynamic strings
|
409 |
+
* Fixed translated slug not being included in url sometimes
|
410 |
+
* Fixed issue with gettext string on non visible html attr that prevented other attr from being translated
|
411 |
+
* Fixed bug with translating dom changes not working for complex HTML hierarchy
|
412 |
+
* Corrected flag for Afrikaans.
|
413 |
+
* Fixed compatibility issues with older jQuery versions
|
414 |
+
|
415 |
+
= 1.2.2 =
|
416 |
+
* Added Translation Block feature in which you can translate multiple html elements together
|
417 |
+
* Improvement: make it possible for the SEO Addon to automatically translate page slugs using Google Translate
|
418 |
+
* Fix: using the shortcode language switcher added #trpprocessurl to the end of the url
|
419 |
+
* Fix: changing languages from a secondary language gave 404 page when the page slug was translated
|
420 |
+
* Fix: submitting a form from one page to another directed the user to the default language. Now if Force Custom Language Links is enabled the user gets directed to the correct url
|
421 |
+
|
422 |
+
= 1.2.1 =
|
423 |
+
* Extra css for the floater images so they don't brake the line in certain themes
|
424 |
+
* Fixed compatibility issue with Woocommerce cart widget
|
425 |
+
* Fix: use the siteurl when the homeurl is empty to detect the language
|
426 |
+
|
427 |
+
= 1.2.0 =
|
428 |
+
* Fix wptexturize changing characters in secondary languages
|
429 |
+
* Mini refactoring of the url_is_file() function
|
430 |
+
* Refactor get_url_for_language() to not use the global var
|
431 |
+
* We no longer add the language path to links to actual files on the server
|
432 |
+
|
433 |
+
= 1.1.9 =
|
434 |
+
* Fix widget language switcher to take into account the new hreflang
|
435 |
+
|
436 |
+
= 1.1.8 =
|
437 |
+
* Fixed bug with Strings List appearing also in Dynamic Strings List. Also fixed bug with duplicate dynamic strings not having a pencil icon because of missing jquery_object.
|
438 |
+
* Fixed Woocommerce session storage compatibility
|
439 |
+
* Fixed language floater not opening on iPhone.
|
440 |
+
* Fixed issue with normal text nodes that were inside an element that had an atribute with gettext and did not get translated
|
441 |
+
* Replaced _ with - in hreflang and filter it
|
442 |
+
* Make force language to custom links set to yes as a default
|
443 |
+
* Remove intensive functions from inside two loops so they only happen once we detect something in js
|
444 |
+
* Decode html characters in mutation observed strings and removed stripslashes from trp-ajax.php to fix some strings added with js not being translated
|
445 |
+
|
446 |
+
= 1.1.7 =
|
447 |
+
* Compatibility fix with Elementor Page Builder
|
448 |
+
* Added translation .pot file
|
449 |
+
* Add proper encoding for mysqli connection in our trp-ajax.php file so we fixed some translation
|
450 |
+
* Fixed infinite loop related to mutation observer on javascript strings by not re-adding detected strings again if they are similar to existing ones
|
451 |
+
* Aligned text from add-ons tab.
|
452 |
+
|
453 |
+
= 1.1.6 =
|
454 |
+
* Added support for translating Contact Form 7 alert messages
|
455 |
+
* Fixed issue with some strings containing special characters not being translated (i.e. "¿¡")
|
456 |
+
* Fixed bug with switching languages in Editor when viewing as Logged out
|
457 |
+
* Fixed issue with broken homepage links in some themes
|
458 |
+
* Added support for RTL languages in translation editor
|
459 |
+
|
460 |
+
= 1.1.5 =
|
461 |
+
* Added support for translation blocks using the css class .translation-block.
|
462 |
+
* Added possibility to choose a different language as default language seen by website visitors.
|
463 |
+
* Updated add-ons settings page with the missing add-ons, added Language by GET parameter addon
|
464 |
+
* Fixed issue with the [language-switcher] in a post or page that broke saving the page when Yoast SEO plugin is active
|
465 |
+
* Added a plugin notification class and a notification for pretty permalinks
|
466 |
+
* Added WooCommerce compatibility tag
|
467 |
+
* Small css improvements
|
468 |
+
|
469 |
+
= 1.1.4 =
|
470 |
+
* Filter to allow adding new language: 'trp_wp_languages'
|
471 |
+
* Fixed issue with get_permalink() in ajax calls that was not returning the propper language
|
472 |
+
* Adapted code to allow language based on a GET parameter
|
473 |
+
* Fix some issues with language switcher and custom queries as well as take into account if subdirectory for default language is on
|
474 |
+
* Fixed issue with js translation that was trimming numbers and other characters from strings when it shouldn't
|
475 |
+
|
476 |
+
= 1.1.3 =
|
477 |
+
* Fix issue where the language switcher didn't work for BuddyPress pages
|
478 |
+
* Fixed issue with CDATA in post content that was breaking the translation
|
479 |
+
* Added a filter that can be activated and that tries to fix invalid html: trp_try_fixing_invalid_html
|
480 |
+
|
481 |
+
= 1.1.2 =
|
482 |
+
* We now make sure that all forms when submitted redirect to the correct language
|
483 |
+
* Fixed an issue with missing slash from language switcher
|
484 |
+
* Fixed an issue where we were not redirecting to the correct url slug when switching languages
|
485 |
+
* Fixed a possible notice inside the get_language_names function
|
486 |
+
* Fixed html breaking because of unescaped quotes in translated meta content
|
487 |
+
* Removed a special character from the full_trim function that was causing some strings to not be selectable for translation
|
488 |
+
|
489 |
+
= 1.1.1 =
|
490 |
+
* Fixed js error with startsWith method not being supported in IE
|
491 |
+
* Removed unnecessary files from select2 lib
|
492 |
+
* Improved the way we rewrite urls to remove certain bugs
|
493 |
+
|
494 |
+
= 1.1.0 =
|
495 |
+
* Implemented View As "Logged out user" functionality so you can translate strings that show only for logged out users
|
496 |
+
* Allow slug edit for default language
|
497 |
+
* Fixed an issue with the dropdown of translation strings when there were unsaved changes and the dropdown disconected from the textarea
|
498 |
+
* Prevent translate editor icon pencil to exit the translation iframe
|
499 |
+
* Fixed translating via the next/prev buttons that reset the position in the translation string list
|
500 |
+
* Refactor the way we are generating the language url for the language switcher when we don't have a variable available
|
501 |
+
|
502 |
+
= 1.0.9 =
|
503 |
+
* We now flush permalinks when saving the settings page to avoid getting 404 and 500 errors
|
504 |
+
* Added the current language as a class on the body tag. Ex: translatepress-en_US
|
505 |
+
* Small readme changes
|
506 |
+
|
507 |
+
= 1.0.8 =
|
508 |
+
* We now allow HTML in normal strings translations.
|
509 |
+
* Changed the way we get the default language permalinks in Woocommerce rewrites
|
510 |
+
* Fixed issues with date_i18n function
|
511 |
+
* Fixed a warning generated when there are no rewrite rules
|
512 |
+
* Fixed dynamic strings not updating the translation dropdown list.
|
513 |
+
* Fixed issues with hidden space characters that were breaking some translations
|
514 |
+
* Make sure we don't loose the trp-edit-translation=preview from url after a WordPress redirect
|
515 |
+
|
516 |
+
= 1.0.7 =
|
517 |
+
* Fixed a small bug in js regarding the translation editor sidebar with
|
518 |
+
* Fixed Language Switcher for Woocommerce product categories and product tags going to 404 pages
|
519 |
+
* Fixed issues with Woocommerce and permalinks when the default language was not english
|
520 |
+
* Excluded more functions from getting gettext wraps
|
521 |
+
|
522 |
+
= 1.0.6 =
|
523 |
+
* Added filter on capabilities to allow other roles to edit translations:'trp_translating_capability'
|
524 |
+
* Don't show php errors and notices when we are storing strings in the database
|
525 |
+
* Fixed issues with attributes that contain json content, for instance in woocommerce variations
|
526 |
+
* We no longer wrap gettext inside the wptexturize function
|
527 |
+
* We no longer wrap gettexts that appear in the bloginfo function
|
528 |
+
|
529 |
+
= 1.0.5 =
|
530 |
+
* Added possibility to edit gettext strings from themes and plugins from english to english, without adding another language. Basically, string-replace functionality.
|
531 |
+
* We now can translate text input placeholders
|
532 |
+
* We have a way of translating emails using the conditional language shortcode [trp_language language="en_US"] English only content [/trp_language]
|
533 |
+
* Fixed issues with some elements that contained new lines and \u00a0 at the start of the strings
|
534 |
+
|
535 |
+
= 1.0.4 =
|
536 |
+
* Fixed issues with the pencil select icon in the translation editor not showing up in certain cases on the button element
|
537 |
+
* Fixed issues with the pencil select icon in the translation editor not showing up in certain cases because of overflow hidden
|
538 |
+
* Fixed a issue that was sometimes causing javascript errors with certain plugins
|
539 |
+
|
540 |
+
= 1.0.3 =
|
541 |
+
* Added a conditional language shortcode: [trp_language language="en_US"] English only content [/trp_language]
|
542 |
+
* Create link to test out Google API key.
|
543 |
+
* Improvements to Woocommerce compatibility
|
544 |
+
* Fixed json_encode error that was causing js errors
|
545 |
+
* Changed 'template_include' hook priority to improve compatibility with some themes
|
546 |
+
|
547 |
+
= 1.0.2 =
|
548 |
+
* Translation interface improvements
|
549 |
+
* Fixed issues with strings loaded with ajax
|
550 |
+
* Added an addon page
|
551 |
+
* Fixed bug with gettext node accidentally wrapping another string too.
|
552 |
+
|
553 |
+
= 1.0.1 =
|
554 |
+
* Fixed incorrect blog prefix name for Multisite subsites on admin_bar gettext hook.
|
555 |
+
* Fixed Translate Page admin bar button sometimes not having the correct url for entering TP Editor Mode
|
556 |
+
* Skipped dynamic strings that have only numbers and special characters.
|
557 |
+
* Fixed order of categories in Editor dropdown. (Meta Information, String List..)
|
558 |
+
* Fixed JS error Uncaught Error: Syntax error, unrecognized expression
|
559 |
+
|
560 |
+
= 1.0.0 =
|
561 |
+
* Initial release.
|