Version Description
- Modified an autoloader to prevent errors when manually updating the plugin
Download this release
Release Info
Developer | madalin.ungureanu |
Plugin | TranslatePress – Translate Multilingual sites |
Version | 1.5.7 |
Comparing to | |
See all releases |
Code changes from version 1.5.6 to 1.5.7
- class-translate-press.php +333 -333
- includes/class-advanced-tab.php +10 -8
- index.php +63 -63
- readme.txt +554 -551
class-translate-press.php
CHANGED
@@ -1,333 +1,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 $query;
|
15 |
-
protected $language_switcher;
|
16 |
-
protected $translation_manager;
|
17 |
-
protected $editor_api_regular_strings;
|
18 |
-
protected $editor_api_gettext_strings;
|
19 |
-
protected $url_converter;
|
20 |
-
protected $languages;
|
21 |
-
protected $slug_manager;
|
22 |
-
protected $upgrade;
|
23 |
-
protected $plugin_updater;
|
24 |
-
protected $license_page;
|
25 |
-
protected $advanced_tab;
|
26 |
-
protected $translation_memory;
|
27 |
-
|
28 |
-
public $active_pro_addons = array();
|
29 |
-
public static $translate_press = null;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Get singleton object.
|
33 |
-
*
|
34 |
-
* @return TRP_Translate_Press Singleton object.
|
35 |
-
*/
|
36 |
-
public static function get_trp_instance(){
|
37 |
-
if ( self::$translate_press == null ){
|
38 |
-
self::$translate_press = new TRP_Translate_Press();
|
39 |
-
}
|
40 |
-
|
41 |
-
return self::$translate_press;
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* TRP_Translate_Press constructor.
|
46 |
-
*/
|
47 |
-
public function __construct() {
|
48 |
-
define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
49 |
-
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
50 |
-
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
51 |
-
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
52 |
-
define( 'TRP_PLUGIN_VERSION', '1.5.
|
53 |
-
|
54 |
-
wp_cache_add_non_persistent_groups(array('trp'));
|
55 |
-
|
56 |
-
$this->load_dependencies();
|
57 |
-
$this->initialize_components();
|
58 |
-
$this->get_active_pro_addons();
|
59 |
-
$this->define_admin_hooks();
|
60 |
-
$this->define_frontend_hooks();
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Returns particular component by name.
|
65 |
-
*
|
66 |
-
* @param string $component 'loader' | 'settings' | 'translation_render' |
|
67 |
-
* 'machine_translator' | 'query' | 'language_switcher' |
|
68 |
-
* 'translation_manager' | 'url_converter' | 'languages'
|
69 |
-
* @return mixed
|
70 |
-
*/
|
71 |
-
public function get_component( $component ){
|
72 |
-
return $this->$component;
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Includes necessary files.
|
77 |
-
*/
|
78 |
-
protected function load_dependencies() {
|
79 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-settings.php';
|
80 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-translation-manager.php';
|
81 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-regular-strings.php';
|
82 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-gettext-strings.php';
|
83 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-translation-manager.php';
|
84 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-hooks-loader.php';
|
85 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-languages.php';
|
86 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-translation-render.php';
|
87 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-language-switcher.php';
|
88 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-machine-translator.php';
|
89 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-query.php';
|
90 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-url-converter.php';
|
91 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-uri.php';
|
92 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-upgrade.php';
|
93 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-plugin-notices.php';
|
94 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-advanced-tab.php';
|
95 |
-
require_once TRP_PLUGIN_DIR . 'includes/class-translation-memory.php';
|
96 |
-
require_once TRP_PLUGIN_DIR . 'includes/external-functions.php';
|
97 |
-
require_once TRP_PLUGIN_DIR . 'includes/functions.php';
|
98 |
-
require_once TRP_PLUGIN_DIR . 'assets/lib/simplehtmldom/simple_html_dom.php';
|
99 |
-
require_once TRP_PLUGIN_DIR . 'includes/shortcodes.php';
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Instantiates components.
|
104 |
-
*/
|
105 |
-
protected function initialize_components() {
|
106 |
-
$this->advanced_tab = new TRP_Advanced_Tab();
|
107 |
-
$this->advanced_tab->include_custom_codes();
|
108 |
-
|
109 |
-
$this->loader = new TRP_Hooks_Loader();
|
110 |
-
$this->languages = new TRP_Languages();
|
111 |
-
$this->settings = new TRP_Settings();
|
112 |
-
$this->translation_render = new TRP_Translation_Render( $this->settings->get_settings() );
|
113 |
-
$this->url_converter = new TRP_Url_Converter( $this->settings->get_settings() );
|
114 |
-
$this->language_switcher = new TRP_Language_Switcher( $this->settings->get_settings(), $this );
|
115 |
-
$this->query = new TRP_Query( $this->settings->get_settings() );
|
116 |
-
$this->machine_translator = new TRP_Machine_Translator( $this->settings->get_settings() );
|
117 |
-
$this->translation_manager = new TRP_Translation_Manager( $this->settings->get_settings() );
|
118 |
-
$this->editor_api_regular_strings = new TRP_Editor_Api_Regular_Strings( $this->settings->get_settings() );
|
119 |
-
$this->editor_api_gettext_strings = new TRP_Editor_Api_Gettext_Strings( $this->settings->get_settings() );
|
120 |
-
$this->notifications = new TRP_Trigger_Plugin_Notifications();
|
121 |
-
$this->upgrade = new TRP_Upgrade( $this->settings->get_settings() );
|
122 |
-
$this->plugin_updater = new TRP_Plugin_Updater();
|
123 |
-
$this->license_page = new TRP_LICENSE_PAGE();
|
124 |
-
$this->translation_memory = new TRP_Translation_Memory( $this->settings->get_settings() );
|
125 |
-
}
|
126 |
-
|
127 |
-
/**
|
128 |
-
* We use this function to detect if we have any addons that require a license
|
129 |
-
*/
|
130 |
-
public function get_active_pro_addons(){
|
131 |
-
|
132 |
-
//don't do nothing in frontend
|
133 |
-
if( !is_admin() )
|
134 |
-
return;
|
135 |
-
|
136 |
-
// the names of your product should match the download names in EDD exactly
|
137 |
-
$trp_all_pro_addons = array(
|
138 |
-
"tp-add-on-automatic-language-detection" => "Automatic User Language Detection",
|
139 |
-
"tp-add-on-browse-as-other-roles" => "Browse as other Role",
|
140 |
-
"tp-add-on-extra-languages" => "Multiple Languages",
|
141 |
-
"tp-add-on-navigation-based-on-language" => "Navigation Based on Language",
|
142 |
-
"tp-add-on-seo-pack" => "SEO Pack",
|
143 |
-
"tp-add-on-translator-accounts" => "Translator Accounts",
|
144 |
-
);
|
145 |
-
$active_plugins = get_option('active_plugins');
|
146 |
-
foreach ( $trp_all_pro_addons as $trp_pro_addon_folder => $trp_pro_addon_name ){
|
147 |
-
foreach( $active_plugins as $active_plugin ){
|
148 |
-
if( strpos( $active_plugin, $trp_pro_addon_folder.'/' ) === 0 ){
|
149 |
-
$this->active_pro_addons[$trp_pro_addon_folder] = $trp_pro_addon_name;
|
150 |
-
}
|
151 |
-
}
|
152 |
-
}
|
153 |
-
}
|
154 |
-
|
155 |
-
/**
|
156 |
-
* Hooks methods used in admin area.
|
157 |
-
*/
|
158 |
-
protected function define_admin_hooks() {
|
159 |
-
$this->loader->add_action( 'admin_menu', $this->settings, 'register_menu_page' );
|
160 |
-
$this->loader->add_action( 'admin_init', $this->settings, 'register_setting' );
|
161 |
-
$this->loader->add_action( 'admin_notices', $this->settings, 'admin_notices' );
|
162 |
-
$this->loader->add_action( 'admin_enqueue_scripts', $this->settings, 'enqueue_scripts_and_styles', 10, 1 );
|
163 |
-
$this->loader->add_filter( 'plugin_action_links_' . TRP_PLUGIN_BASE , $this->settings, 'plugin_action_links', 10, 1 );
|
164 |
-
$this->loader->add_action( 'trp_settings_navigation_tabs', $this->settings, 'add_navigation_tabs' );
|
165 |
-
$this->loader->add_action( 'trp_language_selector', $this->settings, 'languages_selector', 10, 1 );
|
166 |
-
|
167 |
-
$this->loader->add_action( 'trp_settings_tabs', $this->advanced_tab, 'add_advanced_tab_to_settings', 10, 1 );
|
168 |
-
$this->loader->add_action( 'admin_menu', $this->advanced_tab, 'add_submenu_page_advanced' );
|
169 |
-
$this->loader->add_action( 'trp_output_advanced_settings_options', $this->advanced_tab, 'output_advanced_options' );
|
170 |
-
$this->loader->add_action( 'admin_init', $this->advanced_tab, 'register_setting' );
|
171 |
-
$this->loader->add_action( 'admin_notices', $this->advanced_tab, 'admin_notices' );
|
172 |
-
|
173 |
-
|
174 |
-
$this->loader->add_action( 'wp_ajax_nopriv_trp_get_translations', $this->editor_api_regular_strings, 'get_translations' );
|
175 |
-
|
176 |
-
$this->loader->add_action( 'wp_ajax_trp_get_translations_regular', $this->editor_api_regular_strings, 'get_translations' );
|
177 |
-
$this->loader->add_action( 'wp_ajax_trp_save_translations_regular', $this->editor_api_regular_strings, 'save_translations' );
|
178 |
-
$this->loader->add_action( 'wp_ajax_trp_split_translation_block', $this->editor_api_regular_strings, 'split_translation_block' );
|
179 |
-
$this->loader->add_action( 'wp_ajax_trp_create_translation_block', $this->editor_api_regular_strings, 'create_translation_block' );
|
180 |
-
|
181 |
-
$this->loader->add_action( 'wp_ajax_trp_get_translations_gettext', $this->editor_api_gettext_strings, 'gettext_get_translations' );
|
182 |
-
$this->loader->add_action( 'wp_ajax_trp_save_translations_gettext', $this->editor_api_gettext_strings, 'gettext_save_translations' );
|
183 |
-
|
184 |
-
$this->loader->add_action( 'wp_ajax_trp_get_similar_string_translation', $this->translation_memory, 'ajax_get_similar_string_translation' );
|
185 |
-
|
186 |
-
$this->loader->add_filter( 'trp_get_existing_translations', $this->translation_manager, 'display_possible_db_errors', 20, 3 );
|
187 |
-
|
188 |
-
|
189 |
-
$this->loader->add_action( 'wp_ajax_trp_process_js_strings_in_translation_editor', $this->translation_render, 'process_js_strings_in_translation_editor' );
|
190 |
-
$this->loader->add_filter( 'trp_skip_selectors_from_dynamic_translation', $this->translation_render, 'skip_base_attributes_from_dynamic_translation', 10, 1 );
|
191 |
-
|
192 |
-
|
193 |
-
$this->loader->add_action( 'admin_menu', $this->upgrade, 'register_menu_page' );
|
194 |
-
$this->loader->add_action( 'admin_init', $this->upgrade, 'show_admin_notice' );
|
195 |
-
$this->loader->add_action( 'admin_enqueue_scripts', $this->upgrade, 'enqueue_update_script', 10, 1 );
|
196 |
-
$this->loader->add_action( 'wp_ajax_trp_update_database', $this->upgrade, 'trp_update_database' );
|
197 |
-
|
198 |
-
/* add hooks for license operations */
|
199 |
-
if( !empty( $this->active_pro_addons ) ) {
|
200 |
-
$this->loader->add_action('admin_init', $this->plugin_updater, 'activate_license');
|
201 |
-
$this->loader->add_filter('pre_set_site_transient_update_plugins', $this->plugin_updater, 'check_license');
|
202 |
-
$this->loader->add_action('admin_init', $this->plugin_updater, 'deactivate_license');
|
203 |
-
$this->loader->add_action('admin_notices', $this->plugin_updater, 'admin_activation_notices');
|
204 |
-
}
|
205 |
-
|
206 |
-
/* add license page */
|
207 |
-
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)
|
208 |
-
if( !isset( $trp_license_page ) ) {
|
209 |
-
$trp_license_page = $this->license_page;
|
210 |
-
$this->loader->add_action('admin_menu', $this->license_page, 'license_menu');
|
211 |
-
}
|
212 |
-
|
213 |
-
}
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Hooks methods used in front-end
|
217 |
-
*/
|
218 |
-
protected function define_frontend_hooks(){
|
219 |
-
|
220 |
-
//we do not need the plugin in cron requests ?
|
221 |
-
if( isset( $_REQUEST['doing_wp_cron'] ) )
|
222 |
-
return;
|
223 |
-
|
224 |
-
$this->loader->add_action( 'init', $this->translation_render, 'start_output_buffer', 0 );
|
225 |
-
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_render, 'enqueue_scripts', 10 );
|
226 |
-
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_render, 'enqueue_dynamic_translation', 1 );
|
227 |
-
$this->loader->add_filter( 'wp_redirect', $this->translation_render, 'force_preview_on_url_redirect', 99, 2 );
|
228 |
-
$this->loader->add_filter( 'wp_redirect', $this->translation_render, 'force_language_on_form_url_redirect', 99, 2 );
|
229 |
-
$this->loader->add_filter( 'trp_before_translate_content', $this->translation_render, 'force_preview_on_url_in_ajax', 10 );
|
230 |
-
$this->loader->add_filter( 'trp_before_translate_content', $this->translation_render, 'force_form_language_on_url_in_ajax', 20 );
|
231 |
-
/* handle CDATA str replacement from the content as it is messing up the renderer */
|
232 |
-
$this->loader->add_filter( "trp_before_translate_content", $this->translation_render, 'handle_cdata', 1000 );
|
233 |
-
$this->loader->add_action( "trp_set_translation_for_attribute", $this->translation_render, 'translate_image_srcset_attributes', 10, 3 );
|
234 |
-
$this->loader->add_action( "trp_allow_machine_translation_for_string", $this->translation_render, 'allow_machine_translation_for_string', 10, 4 );
|
235 |
-
$this->loader->add_action( "init", $this->translation_render, 'add_callbacks_for_translating_rest_api', 10, 4 );
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
$this->loader->add_action( 'wp_enqueue_scripts', $this->language_switcher, 'enqueue_language_switcher_scripts' );
|
241 |
-
$this->loader->add_action( 'wp_footer', $this->language_switcher, 'add_floater_language_switcher' );
|
242 |
-
$this->loader->add_filter( 'init', $this->language_switcher, 'register_ls_menu_switcher' );
|
243 |
-
$this->loader->add_action( 'wp_get_nav_menu_items', $this->language_switcher, 'ls_menu_permalinks', 10, 3 );
|
244 |
-
add_shortcode( 'language-switcher', array( $this->language_switcher, 'language_switcher' ) );
|
245 |
-
|
246 |
-
|
247 |
-
$this->loader->add_action( 'trp_translation_manager_footer', $this->translation_manager, 'enqueue_scripts_and_styles' );
|
248 |
-
$this->loader->add_filter( 'template_include', $this->translation_manager, 'translation_editor', 99999 );
|
249 |
-
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_manager, 'enqueue_preview_scripts_and_styles' );
|
250 |
-
$this->loader->add_action( 'admin_bar_menu', $this->translation_manager, 'add_shortcut_to_translation_editor', 90, 1 );
|
251 |
-
$this->loader->add_action( 'admin_head', $this->translation_manager, 'add_styling_to_admin_bar_button', 10 );
|
252 |
-
$this->loader->add_filter( 'show_admin_bar', $this->translation_manager, 'hide_admin_bar_when_in_editor', 90 );
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
$this->loader->add_filter( 'home_url', $this->url_converter, 'add_language_to_home_url', 1, 4 );
|
257 |
-
$this->loader->add_action( 'wp_head', $this->url_converter, 'add_hreflang_to_head' );
|
258 |
-
$this->loader->add_filter( 'language_attributes', $this->url_converter, 'change_lang_attr_in_html_tag', 10, 1 );
|
259 |
-
|
260 |
-
|
261 |
-
$this->loader->add_filter( 'widget_text', null, 'do_shortcode', 11 );
|
262 |
-
$this->loader->add_filter( 'widget_text', null, 'shortcode_unautop', 11 );
|
263 |
-
|
264 |
-
/* handle dynamic texts with gettext */
|
265 |
-
$this->loader->add_filter( 'locale', $this->languages, 'change_locale' );
|
266 |
-
|
267 |
-
$this->loader->add_action( 'init', $this->translation_manager, 'create_gettext_translated_global' );
|
268 |
-
$this->loader->add_action( 'init', $this->translation_manager, 'initialize_gettext_processing' );
|
269 |
-
$this->loader->add_action( 'shutdown', $this->translation_manager, 'machine_translate_gettext', 100 );
|
270 |
-
|
271 |
-
|
272 |
-
/* we need to treat the date_i18n function differently so we remove the gettext wraps */
|
273 |
-
$this->loader->add_filter( 'date_i18n', $this->translation_manager, 'handle_date_i18n_function_for_gettext', 1, 4 );
|
274 |
-
/* strip esc_url() from gettext wraps */
|
275 |
-
$this->loader->add_filter( 'clean_url', $this->translation_manager, 'trp_strip_gettext_tags_from_esc_url', 1, 3 );
|
276 |
-
/* strip sanitize_title() from gettext wraps and apply custom trp_remove_accents */
|
277 |
-
$this->loader->add_filter( 'sanitize_title', $this->translation_manager, 'trp_sanitize_title', 1, 3 );
|
278 |
-
|
279 |
-
/* define an update hook here */
|
280 |
-
$this->loader->add_action( 'plugins_loaded', $this->upgrade, 'check_for_necessary_updates', 10 );
|
281 |
-
|
282 |
-
$this->loader->add_filter( 'trp_language_name', $this->languages, 'beautify_language_name', 10, 4 );
|
283 |
-
$this->loader->add_filter( 'trp_languages', $this->languages, 'reorder_languages', 10, 2 );
|
284 |
-
|
285 |
-
/* set up wp_mail hooks */
|
286 |
-
$this->loader->add_filter( 'wp_mail', $this->translation_render, 'wp_mail_filter', 1 );
|
287 |
-
|
288 |
-
/* hide php ors and notice when we are storing strings in db */
|
289 |
-
$this->loader->add_action( 'init', $this->translation_render, 'trp_debug_mode_off', 0 );
|
290 |
-
|
291 |
-
/* fix wptexturize to always replace with the default translated strings */
|
292 |
-
$this->loader->add_action( 'gettext_with_context', $this->translation_render, 'fix_wptexturize_characters', 999, 4 );
|
293 |
-
|
294 |
-
/* ?or init ? hook here where you can change the $current_user global */
|
295 |
-
$this->loader->add_action( 'init', $this->translation_manager, 'trp_view_as_user' );
|
296 |
-
|
297 |
-
/**
|
298 |
-
* we need to modify the permalinks structure for woocommerce when we switch languages
|
299 |
-
* 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 )
|
300 |
-
* we can't flush the permalinks on every page load so we filter the rewrite_rules option
|
301 |
-
*/
|
302 |
-
$this->loader->add_filter( "option_rewrite_rules", $this->url_converter, 'woocommerce_filter_permalinks_on_other_languages' );
|
303 |
-
$this->loader->add_filter( "option_woocommerce_permalinks", $this->url_converter, 'woocommerce_filter_permalink_option' );
|
304 |
-
$this->loader->add_filter( "pre_update_option_woocommerce_permalinks", $this->url_converter, 'woocommerce_handle_permalink_option_on_frontend', 10, 2 );
|
305 |
-
|
306 |
-
/* add to the body class the current language */
|
307 |
-
$this->loader->add_filter( "body_class", $this->translation_manager, 'add_language_to_body_class' );
|
308 |
-
|
309 |
-
/* load textdomain */
|
310 |
-
$this->loader->add_action( "init", $this, 'init_translation', 8 );
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* Register hooks to WP.
|
315 |
-
*/
|
316 |
-
public function run() {
|
317 |
-
/*
|
318 |
-
* Hook that prevents running the hooks. Caution: some TP code like constructors of classes still run!
|
319 |
-
*/
|
320 |
-
$run_tp = apply_filters( 'trp_allow_tp_to_run', true );
|
321 |
-
if ( $run_tp ) {
|
322 |
-
$this->loader->run();
|
323 |
-
}
|
324 |
-
}
|
325 |
-
|
326 |
-
/**
|
327 |
-
* Load plugin textdomain
|
328 |
-
*/
|
329 |
-
public function init_translation(){
|
330 |
-
load_plugin_textdomain( 'translatepress-multilingual', false, basename(dirname(__FILE__)) . '/languages/' );
|
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 $query;
|
15 |
+
protected $language_switcher;
|
16 |
+
protected $translation_manager;
|
17 |
+
protected $editor_api_regular_strings;
|
18 |
+
protected $editor_api_gettext_strings;
|
19 |
+
protected $url_converter;
|
20 |
+
protected $languages;
|
21 |
+
protected $slug_manager;
|
22 |
+
protected $upgrade;
|
23 |
+
protected $plugin_updater;
|
24 |
+
protected $license_page;
|
25 |
+
protected $advanced_tab;
|
26 |
+
protected $translation_memory;
|
27 |
+
|
28 |
+
public $active_pro_addons = array();
|
29 |
+
public static $translate_press = null;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Get singleton object.
|
33 |
+
*
|
34 |
+
* @return TRP_Translate_Press Singleton object.
|
35 |
+
*/
|
36 |
+
public static function get_trp_instance(){
|
37 |
+
if ( self::$translate_press == null ){
|
38 |
+
self::$translate_press = new TRP_Translate_Press();
|
39 |
+
}
|
40 |
+
|
41 |
+
return self::$translate_press;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* TRP_Translate_Press constructor.
|
46 |
+
*/
|
47 |
+
public function __construct() {
|
48 |
+
define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
49 |
+
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
50 |
+
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
51 |
+
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
52 |
+
define( 'TRP_PLUGIN_VERSION', '1.5.7' );
|
53 |
+
|
54 |
+
wp_cache_add_non_persistent_groups(array('trp'));
|
55 |
+
|
56 |
+
$this->load_dependencies();
|
57 |
+
$this->initialize_components();
|
58 |
+
$this->get_active_pro_addons();
|
59 |
+
$this->define_admin_hooks();
|
60 |
+
$this->define_frontend_hooks();
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Returns particular component by name.
|
65 |
+
*
|
66 |
+
* @param string $component 'loader' | 'settings' | 'translation_render' |
|
67 |
+
* 'machine_translator' | 'query' | 'language_switcher' |
|
68 |
+
* 'translation_manager' | 'url_converter' | 'languages'
|
69 |
+
* @return mixed
|
70 |
+
*/
|
71 |
+
public function get_component( $component ){
|
72 |
+
return $this->$component;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Includes necessary files.
|
77 |
+
*/
|
78 |
+
protected function load_dependencies() {
|
79 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-settings.php';
|
80 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-translation-manager.php';
|
81 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-regular-strings.php';
|
82 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-gettext-strings.php';
|
83 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-translation-manager.php';
|
84 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-hooks-loader.php';
|
85 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-languages.php';
|
86 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-translation-render.php';
|
87 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-language-switcher.php';
|
88 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-machine-translator.php';
|
89 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-query.php';
|
90 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-url-converter.php';
|
91 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-uri.php';
|
92 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-upgrade.php';
|
93 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-plugin-notices.php';
|
94 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-advanced-tab.php';
|
95 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-translation-memory.php';
|
96 |
+
require_once TRP_PLUGIN_DIR . 'includes/external-functions.php';
|
97 |
+
require_once TRP_PLUGIN_DIR . 'includes/functions.php';
|
98 |
+
require_once TRP_PLUGIN_DIR . 'assets/lib/simplehtmldom/simple_html_dom.php';
|
99 |
+
require_once TRP_PLUGIN_DIR . 'includes/shortcodes.php';
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Instantiates components.
|
104 |
+
*/
|
105 |
+
protected function initialize_components() {
|
106 |
+
$this->advanced_tab = new TRP_Advanced_Tab();
|
107 |
+
$this->advanced_tab->include_custom_codes();
|
108 |
+
|
109 |
+
$this->loader = new TRP_Hooks_Loader();
|
110 |
+
$this->languages = new TRP_Languages();
|
111 |
+
$this->settings = new TRP_Settings();
|
112 |
+
$this->translation_render = new TRP_Translation_Render( $this->settings->get_settings() );
|
113 |
+
$this->url_converter = new TRP_Url_Converter( $this->settings->get_settings() );
|
114 |
+
$this->language_switcher = new TRP_Language_Switcher( $this->settings->get_settings(), $this );
|
115 |
+
$this->query = new TRP_Query( $this->settings->get_settings() );
|
116 |
+
$this->machine_translator = new TRP_Machine_Translator( $this->settings->get_settings() );
|
117 |
+
$this->translation_manager = new TRP_Translation_Manager( $this->settings->get_settings() );
|
118 |
+
$this->editor_api_regular_strings = new TRP_Editor_Api_Regular_Strings( $this->settings->get_settings() );
|
119 |
+
$this->editor_api_gettext_strings = new TRP_Editor_Api_Gettext_Strings( $this->settings->get_settings() );
|
120 |
+
$this->notifications = new TRP_Trigger_Plugin_Notifications();
|
121 |
+
$this->upgrade = new TRP_Upgrade( $this->settings->get_settings() );
|
122 |
+
$this->plugin_updater = new TRP_Plugin_Updater();
|
123 |
+
$this->license_page = new TRP_LICENSE_PAGE();
|
124 |
+
$this->translation_memory = new TRP_Translation_Memory( $this->settings->get_settings() );
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* We use this function to detect if we have any addons that require a license
|
129 |
+
*/
|
130 |
+
public function get_active_pro_addons(){
|
131 |
+
|
132 |
+
//don't do nothing in frontend
|
133 |
+
if( !is_admin() )
|
134 |
+
return;
|
135 |
+
|
136 |
+
// the names of your product should match the download names in EDD exactly
|
137 |
+
$trp_all_pro_addons = array(
|
138 |
+
"tp-add-on-automatic-language-detection" => "Automatic User Language Detection",
|
139 |
+
"tp-add-on-browse-as-other-roles" => "Browse as other Role",
|
140 |
+
"tp-add-on-extra-languages" => "Multiple Languages",
|
141 |
+
"tp-add-on-navigation-based-on-language" => "Navigation Based on Language",
|
142 |
+
"tp-add-on-seo-pack" => "SEO Pack",
|
143 |
+
"tp-add-on-translator-accounts" => "Translator Accounts",
|
144 |
+
);
|
145 |
+
$active_plugins = get_option('active_plugins');
|
146 |
+
foreach ( $trp_all_pro_addons as $trp_pro_addon_folder => $trp_pro_addon_name ){
|
147 |
+
foreach( $active_plugins as $active_plugin ){
|
148 |
+
if( strpos( $active_plugin, $trp_pro_addon_folder.'/' ) === 0 ){
|
149 |
+
$this->active_pro_addons[$trp_pro_addon_folder] = $trp_pro_addon_name;
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Hooks methods used in admin area.
|
157 |
+
*/
|
158 |
+
protected function define_admin_hooks() {
|
159 |
+
$this->loader->add_action( 'admin_menu', $this->settings, 'register_menu_page' );
|
160 |
+
$this->loader->add_action( 'admin_init', $this->settings, 'register_setting' );
|
161 |
+
$this->loader->add_action( 'admin_notices', $this->settings, 'admin_notices' );
|
162 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $this->settings, 'enqueue_scripts_and_styles', 10, 1 );
|
163 |
+
$this->loader->add_filter( 'plugin_action_links_' . TRP_PLUGIN_BASE , $this->settings, 'plugin_action_links', 10, 1 );
|
164 |
+
$this->loader->add_action( 'trp_settings_navigation_tabs', $this->settings, 'add_navigation_tabs' );
|
165 |
+
$this->loader->add_action( 'trp_language_selector', $this->settings, 'languages_selector', 10, 1 );
|
166 |
+
|
167 |
+
$this->loader->add_action( 'trp_settings_tabs', $this->advanced_tab, 'add_advanced_tab_to_settings', 10, 1 );
|
168 |
+
$this->loader->add_action( 'admin_menu', $this->advanced_tab, 'add_submenu_page_advanced' );
|
169 |
+
$this->loader->add_action( 'trp_output_advanced_settings_options', $this->advanced_tab, 'output_advanced_options' );
|
170 |
+
$this->loader->add_action( 'admin_init', $this->advanced_tab, 'register_setting' );
|
171 |
+
$this->loader->add_action( 'admin_notices', $this->advanced_tab, 'admin_notices' );
|
172 |
+
|
173 |
+
|
174 |
+
$this->loader->add_action( 'wp_ajax_nopriv_trp_get_translations', $this->editor_api_regular_strings, 'get_translations' );
|
175 |
+
|
176 |
+
$this->loader->add_action( 'wp_ajax_trp_get_translations_regular', $this->editor_api_regular_strings, 'get_translations' );
|
177 |
+
$this->loader->add_action( 'wp_ajax_trp_save_translations_regular', $this->editor_api_regular_strings, 'save_translations' );
|
178 |
+
$this->loader->add_action( 'wp_ajax_trp_split_translation_block', $this->editor_api_regular_strings, 'split_translation_block' );
|
179 |
+
$this->loader->add_action( 'wp_ajax_trp_create_translation_block', $this->editor_api_regular_strings, 'create_translation_block' );
|
180 |
+
|
181 |
+
$this->loader->add_action( 'wp_ajax_trp_get_translations_gettext', $this->editor_api_gettext_strings, 'gettext_get_translations' );
|
182 |
+
$this->loader->add_action( 'wp_ajax_trp_save_translations_gettext', $this->editor_api_gettext_strings, 'gettext_save_translations' );
|
183 |
+
|
184 |
+
$this->loader->add_action( 'wp_ajax_trp_get_similar_string_translation', $this->translation_memory, 'ajax_get_similar_string_translation' );
|
185 |
+
|
186 |
+
$this->loader->add_filter( 'trp_get_existing_translations', $this->translation_manager, 'display_possible_db_errors', 20, 3 );
|
187 |
+
|
188 |
+
|
189 |
+
$this->loader->add_action( 'wp_ajax_trp_process_js_strings_in_translation_editor', $this->translation_render, 'process_js_strings_in_translation_editor' );
|
190 |
+
$this->loader->add_filter( 'trp_skip_selectors_from_dynamic_translation', $this->translation_render, 'skip_base_attributes_from_dynamic_translation', 10, 1 );
|
191 |
+
|
192 |
+
|
193 |
+
$this->loader->add_action( 'admin_menu', $this->upgrade, 'register_menu_page' );
|
194 |
+
$this->loader->add_action( 'admin_init', $this->upgrade, 'show_admin_notice' );
|
195 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $this->upgrade, 'enqueue_update_script', 10, 1 );
|
196 |
+
$this->loader->add_action( 'wp_ajax_trp_update_database', $this->upgrade, 'trp_update_database' );
|
197 |
+
|
198 |
+
/* add hooks for license operations */
|
199 |
+
if( !empty( $this->active_pro_addons ) ) {
|
200 |
+
$this->loader->add_action('admin_init', $this->plugin_updater, 'activate_license');
|
201 |
+
$this->loader->add_filter('pre_set_site_transient_update_plugins', $this->plugin_updater, 'check_license');
|
202 |
+
$this->loader->add_action('admin_init', $this->plugin_updater, 'deactivate_license');
|
203 |
+
$this->loader->add_action('admin_notices', $this->plugin_updater, 'admin_activation_notices');
|
204 |
+
}
|
205 |
+
|
206 |
+
/* add license page */
|
207 |
+
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)
|
208 |
+
if( !isset( $trp_license_page ) ) {
|
209 |
+
$trp_license_page = $this->license_page;
|
210 |
+
$this->loader->add_action('admin_menu', $this->license_page, 'license_menu');
|
211 |
+
}
|
212 |
+
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Hooks methods used in front-end
|
217 |
+
*/
|
218 |
+
protected function define_frontend_hooks(){
|
219 |
+
|
220 |
+
//we do not need the plugin in cron requests ?
|
221 |
+
if( isset( $_REQUEST['doing_wp_cron'] ) )
|
222 |
+
return;
|
223 |
+
|
224 |
+
$this->loader->add_action( 'init', $this->translation_render, 'start_output_buffer', 0 );
|
225 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_render, 'enqueue_scripts', 10 );
|
226 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_render, 'enqueue_dynamic_translation', 1 );
|
227 |
+
$this->loader->add_filter( 'wp_redirect', $this->translation_render, 'force_preview_on_url_redirect', 99, 2 );
|
228 |
+
$this->loader->add_filter( 'wp_redirect', $this->translation_render, 'force_language_on_form_url_redirect', 99, 2 );
|
229 |
+
$this->loader->add_filter( 'trp_before_translate_content', $this->translation_render, 'force_preview_on_url_in_ajax', 10 );
|
230 |
+
$this->loader->add_filter( 'trp_before_translate_content', $this->translation_render, 'force_form_language_on_url_in_ajax', 20 );
|
231 |
+
/* handle CDATA str replacement from the content as it is messing up the renderer */
|
232 |
+
$this->loader->add_filter( "trp_before_translate_content", $this->translation_render, 'handle_cdata', 1000 );
|
233 |
+
$this->loader->add_action( "trp_set_translation_for_attribute", $this->translation_render, 'translate_image_srcset_attributes', 10, 3 );
|
234 |
+
$this->loader->add_action( "trp_allow_machine_translation_for_string", $this->translation_render, 'allow_machine_translation_for_string', 10, 4 );
|
235 |
+
$this->loader->add_action( "init", $this->translation_render, 'add_callbacks_for_translating_rest_api', 10, 4 );
|
236 |
+
|
237 |
+
|
238 |
+
|
239 |
+
|
240 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $this->language_switcher, 'enqueue_language_switcher_scripts' );
|
241 |
+
$this->loader->add_action( 'wp_footer', $this->language_switcher, 'add_floater_language_switcher' );
|
242 |
+
$this->loader->add_filter( 'init', $this->language_switcher, 'register_ls_menu_switcher' );
|
243 |
+
$this->loader->add_action( 'wp_get_nav_menu_items', $this->language_switcher, 'ls_menu_permalinks', 10, 3 );
|
244 |
+
add_shortcode( 'language-switcher', array( $this->language_switcher, 'language_switcher' ) );
|
245 |
+
|
246 |
+
|
247 |
+
$this->loader->add_action( 'trp_translation_manager_footer', $this->translation_manager, 'enqueue_scripts_and_styles' );
|
248 |
+
$this->loader->add_filter( 'template_include', $this->translation_manager, 'translation_editor', 99999 );
|
249 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_manager, 'enqueue_preview_scripts_and_styles' );
|
250 |
+
$this->loader->add_action( 'admin_bar_menu', $this->translation_manager, 'add_shortcut_to_translation_editor', 90, 1 );
|
251 |
+
$this->loader->add_action( 'admin_head', $this->translation_manager, 'add_styling_to_admin_bar_button', 10 );
|
252 |
+
$this->loader->add_filter( 'show_admin_bar', $this->translation_manager, 'hide_admin_bar_when_in_editor', 90 );
|
253 |
+
|
254 |
+
|
255 |
+
|
256 |
+
$this->loader->add_filter( 'home_url', $this->url_converter, 'add_language_to_home_url', 1, 4 );
|
257 |
+
$this->loader->add_action( 'wp_head', $this->url_converter, 'add_hreflang_to_head' );
|
258 |
+
$this->loader->add_filter( 'language_attributes', $this->url_converter, 'change_lang_attr_in_html_tag', 10, 1 );
|
259 |
+
|
260 |
+
|
261 |
+
$this->loader->add_filter( 'widget_text', null, 'do_shortcode', 11 );
|
262 |
+
$this->loader->add_filter( 'widget_text', null, 'shortcode_unautop', 11 );
|
263 |
+
|
264 |
+
/* handle dynamic texts with gettext */
|
265 |
+
$this->loader->add_filter( 'locale', $this->languages, 'change_locale' );
|
266 |
+
|
267 |
+
$this->loader->add_action( 'init', $this->translation_manager, 'create_gettext_translated_global' );
|
268 |
+
$this->loader->add_action( 'init', $this->translation_manager, 'initialize_gettext_processing' );
|
269 |
+
$this->loader->add_action( 'shutdown', $this->translation_manager, 'machine_translate_gettext', 100 );
|
270 |
+
|
271 |
+
|
272 |
+
/* we need to treat the date_i18n function differently so we remove the gettext wraps */
|
273 |
+
$this->loader->add_filter( 'date_i18n', $this->translation_manager, 'handle_date_i18n_function_for_gettext', 1, 4 );
|
274 |
+
/* strip esc_url() from gettext wraps */
|
275 |
+
$this->loader->add_filter( 'clean_url', $this->translation_manager, 'trp_strip_gettext_tags_from_esc_url', 1, 3 );
|
276 |
+
/* strip sanitize_title() from gettext wraps and apply custom trp_remove_accents */
|
277 |
+
$this->loader->add_filter( 'sanitize_title', $this->translation_manager, 'trp_sanitize_title', 1, 3 );
|
278 |
+
|
279 |
+
/* define an update hook here */
|
280 |
+
$this->loader->add_action( 'plugins_loaded', $this->upgrade, 'check_for_necessary_updates', 10 );
|
281 |
+
|
282 |
+
$this->loader->add_filter( 'trp_language_name', $this->languages, 'beautify_language_name', 10, 4 );
|
283 |
+
$this->loader->add_filter( 'trp_languages', $this->languages, 'reorder_languages', 10, 2 );
|
284 |
+
|
285 |
+
/* set up wp_mail hooks */
|
286 |
+
$this->loader->add_filter( 'wp_mail', $this->translation_render, 'wp_mail_filter', 1 );
|
287 |
+
|
288 |
+
/* hide php ors and notice when we are storing strings in db */
|
289 |
+
$this->loader->add_action( 'init', $this->translation_render, 'trp_debug_mode_off', 0 );
|
290 |
+
|
291 |
+
/* fix wptexturize to always replace with the default translated strings */
|
292 |
+
$this->loader->add_action( 'gettext_with_context', $this->translation_render, 'fix_wptexturize_characters', 999, 4 );
|
293 |
+
|
294 |
+
/* ?or init ? hook here where you can change the $current_user global */
|
295 |
+
$this->loader->add_action( 'init', $this->translation_manager, 'trp_view_as_user' );
|
296 |
+
|
297 |
+
/**
|
298 |
+
* we need to modify the permalinks structure for woocommerce when we switch languages
|
299 |
+
* 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 )
|
300 |
+
* we can't flush the permalinks on every page load so we filter the rewrite_rules option
|
301 |
+
*/
|
302 |
+
$this->loader->add_filter( "option_rewrite_rules", $this->url_converter, 'woocommerce_filter_permalinks_on_other_languages' );
|
303 |
+
$this->loader->add_filter( "option_woocommerce_permalinks", $this->url_converter, 'woocommerce_filter_permalink_option' );
|
304 |
+
$this->loader->add_filter( "pre_update_option_woocommerce_permalinks", $this->url_converter, 'woocommerce_handle_permalink_option_on_frontend', 10, 2 );
|
305 |
+
|
306 |
+
/* add to the body class the current language */
|
307 |
+
$this->loader->add_filter( "body_class", $this->translation_manager, 'add_language_to_body_class' );
|
308 |
+
|
309 |
+
/* load textdomain */
|
310 |
+
$this->loader->add_action( "init", $this, 'init_translation', 8 );
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Register hooks to WP.
|
315 |
+
*/
|
316 |
+
public function run() {
|
317 |
+
/*
|
318 |
+
* Hook that prevents running the hooks. Caution: some TP code like constructors of classes still run!
|
319 |
+
*/
|
320 |
+
$run_tp = apply_filters( 'trp_allow_tp_to_run', true );
|
321 |
+
if ( $run_tp ) {
|
322 |
+
$this->loader->run();
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Load plugin textdomain
|
328 |
+
*/
|
329 |
+
public function init_translation(){
|
330 |
+
load_plugin_textdomain( 'translatepress-multilingual', false, basename(dirname(__FILE__)) . '/languages/' );
|
331 |
+
}
|
332 |
+
|
333 |
+
}
|
includes/class-advanced-tab.php
CHANGED
@@ -117,14 +117,16 @@ class TRP_Advanced_Tab {
|
|
117 |
* Require the custom codes from the specified folder
|
118 |
*/
|
119 |
public function include_custom_codes(){
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
128 |
}
|
129 |
|
130 |
/*
|
117 |
* Require the custom codes from the specified folder
|
118 |
*/
|
119 |
public function include_custom_codes(){
|
120 |
+
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/disable-dynamic-translation.php');
|
121 |
+
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/enable-auto-translate-slug.php');
|
122 |
+
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/exclude-dynamic-selectors.php');
|
123 |
+
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/exclude-gettext-strings.php');
|
124 |
+
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/exclude-selectors.php');
|
125 |
+
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/fix-broken-html.php');
|
126 |
+
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/fix-invalid-space-between-html-attr.php');
|
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 |
/*
|
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.7
|
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 |
+
}
|
readme.txt
CHANGED
@@ -1,551 +1,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.
|
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 |
-
* Added
|
153 |
-
* Added
|
154 |
-
* Added compatibility with
|
155 |
-
*
|
156 |
-
*
|
157 |
-
*
|
158 |
-
*
|
159 |
-
*
|
160 |
-
*
|
161 |
-
*
|
162 |
-
|
163 |
-
|
164 |
-
* Fixed
|
165 |
-
|
166 |
-
= 1.5.
|
167 |
-
*
|
168 |
-
|
169 |
-
|
170 |
-
*
|
171 |
-
*
|
172 |
-
|
173 |
-
|
174 |
-
*
|
175 |
-
|
176 |
-
= 1.5.
|
177 |
-
*
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
* Added
|
182 |
-
|
183 |
-
|
184 |
-
*
|
185 |
-
* Added
|
186 |
-
*
|
187 |
-
*
|
188 |
-
*
|
189 |
-
* Fixed
|
190 |
-
* Fixed
|
191 |
-
* Fixed
|
192 |
-
* Fixed
|
193 |
-
* Fixed
|
194 |
-
* Fixed
|
195 |
-
|
196 |
-
|
197 |
-
* Fixed
|
198 |
-
|
199 |
-
= 1.
|
200 |
-
* Fixed
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
*
|
206 |
-
|
207 |
-
|
208 |
-
* Added support for translating
|
209 |
-
* Added support for translating
|
210 |
-
* Added support for translating
|
211 |
-
* Added
|
212 |
-
*
|
213 |
-
* Added
|
214 |
-
*
|
215 |
-
*
|
216 |
-
|
217 |
-
|
218 |
-
*
|
219 |
-
|
220 |
-
= 1.4.
|
221 |
-
* Fixed a
|
222 |
-
|
223 |
-
|
224 |
-
* Fixed
|
225 |
-
|
226 |
-
|
227 |
-
*
|
228 |
-
|
229 |
-
|
230 |
-
*
|
231 |
-
*
|
232 |
-
*
|
233 |
-
*
|
234 |
-
*
|
235 |
-
* Fixed
|
236 |
-
*
|
237 |
-
* Fixed
|
238 |
-
|
239 |
-
|
240 |
-
*
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
*
|
246 |
-
|
247 |
-
|
248 |
-
*
|
249 |
-
|
250 |
-
|
251 |
-
*
|
252 |
-
|
253 |
-
|
254 |
-
*
|
255 |
-
|
256 |
-
|
257 |
-
*
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
*
|
262 |
-
|
263 |
-
|
264 |
-
* Added compatibility
|
265 |
-
*
|
266 |
-
*
|
267 |
-
* Added
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
* Fixed
|
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 |
-
*
|
314 |
-
|
315 |
-
|
316 |
-
*
|
317 |
-
* Fixed
|
318 |
-
|
319 |
-
|
320 |
-
* Fixed issue with
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
* Speed improvements
|
325 |
-
|
326 |
-
|
327 |
-
*
|
328 |
-
*
|
329 |
-
*
|
330 |
-
*
|
331 |
-
*
|
332 |
-
*
|
333 |
-
|
334 |
-
|
335 |
-
*
|
336 |
-
|
337 |
-
|
338 |
-
*
|
339 |
-
* Added
|
340 |
-
*
|
341 |
-
*
|
342 |
-
*
|
343 |
-
|
344 |
-
|
345 |
-
*
|
346 |
-
|
347 |
-
|
348 |
-
*
|
349 |
-
*
|
350 |
-
*
|
351 |
-
* Fixed
|
352 |
-
* Added
|
353 |
-
*
|
354 |
-
*
|
355 |
-
* Added
|
356 |
-
*
|
357 |
-
|
358 |
-
|
359 |
-
*
|
360 |
-
|
361 |
-
|
362 |
-
*
|
363 |
-
* Fixed
|
364 |
-
*
|
365 |
-
|
366 |
-
|
367 |
-
*
|
368 |
-
|
369 |
-
|
370 |
-
*
|
371 |
-
*
|
372 |
-
*
|
373 |
-
*
|
374 |
-
|
375 |
-
|
376 |
-
*
|
377 |
-
|
378 |
-
|
379 |
-
*
|
380 |
-
|
381 |
-
|
382 |
-
*
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
* Fixed
|
388 |
-
|
389 |
-
= 1.2.
|
390 |
-
*
|
391 |
-
|
392 |
-
|
393 |
-
*
|
394 |
-
|
395 |
-
|
396 |
-
*
|
397 |
-
|
398 |
-
|
399 |
-
* Fixed
|
400 |
-
*
|
401 |
-
* Fixed
|
402 |
-
*
|
403 |
-
* Fixed
|
404 |
-
|
405 |
-
|
406 |
-
*
|
407 |
-
|
408 |
-
|
409 |
-
*
|
410 |
-
*
|
411 |
-
|
412 |
-
|
413 |
-
*
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
* Fix
|
419 |
-
|
420 |
-
|
421 |
-
*
|
422 |
-
|
423 |
-
|
424 |
-
*
|
425 |
-
|
426 |
-
= 1.1.
|
427 |
-
*
|
428 |
-
|
429 |
-
|
430 |
-
* Fixed
|
431 |
-
*
|
432 |
-
*
|
433 |
-
*
|
434 |
-
*
|
435 |
-
|
436 |
-
|
437 |
-
*
|
438 |
-
|
439 |
-
|
440 |
-
*
|
441 |
-
*
|
442 |
-
|
443 |
-
|
444 |
-
*
|
445 |
-
|
446 |
-
|
447 |
-
*
|
448 |
-
*
|
449 |
-
|
450 |
-
|
451 |
-
* Added support for
|
452 |
-
|
453 |
-
|
454 |
-
*
|
455 |
-
* Added a
|
456 |
-
*
|
457 |
-
*
|
458 |
-
|
459 |
-
|
460 |
-
*
|
461 |
-
|
462 |
-
|
463 |
-
*
|
464 |
-
* Fixed issue with
|
465 |
-
|
466 |
-
|
467 |
-
*
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
*
|
473 |
-
|
474 |
-
|
475 |
-
*
|
476 |
-
* Fixed
|
477 |
-
*
|
478 |
-
|
479 |
-
|
480 |
-
*
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
*
|
486 |
-
|
487 |
-
|
488 |
-
*
|
489 |
-
*
|
490 |
-
*
|
491 |
-
|
492 |
-
|
493 |
-
*
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
*
|
499 |
-
|
500 |
-
|
501 |
-
*
|
502 |
-
*
|
503 |
-
* Fixed issues with
|
504 |
-
*
|
505 |
-
|
506 |
-
|
507 |
-
*
|
508 |
-
|
509 |
-
|
510 |
-
*
|
511 |
-
|
512 |
-
|
513 |
-
*
|
514 |
-
|
515 |
-
|
516 |
-
*
|
517 |
-
*
|
518 |
-
|
519 |
-
|
520 |
-
*
|
521 |
-
|
522 |
-
|
523 |
-
*
|
524 |
-
|
525 |
-
=
|
526 |
-
* Fixed issues with
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
*
|
532 |
-
|
533 |
-
|
534 |
-
*
|
535 |
-
*
|
536 |
-
|
537 |
-
|
538 |
-
*
|
539 |
-
|
540 |
-
|
541 |
-
*
|
542 |
-
|
543 |
-
|
544 |
-
* Fixed
|
545 |
-
|
546 |
-
|
547 |
-
* Fixed
|
548 |
-
* Fixed
|
549 |
-
|
550 |
-
|
551 |
-
*
|
|
|
|
|
|
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.7
|
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.7 =
|
146 |
+
* Modified an autoloader to prevent errors when manually updating the plugin
|
147 |
+
|
148 |
+
= 1.5.6 =
|
149 |
+
* Improved speed on Gettext exclusion
|
150 |
+
* Make Gettext exclusion work without a domain in Advanced Settings
|
151 |
+
* Allow po/mo localization files to translate excluded Gettext strings
|
152 |
+
* Added Advanced setting to Exclude selectors from translation
|
153 |
+
* Added option to change floating language switcher position
|
154 |
+
* Added compatibility with CartFlows plugin
|
155 |
+
* Added compatibility with NextGen plugin
|
156 |
+
* Added compatibility with Ninja Popups plugin mails
|
157 |
+
* Added compatibility with Woo Tours plugin
|
158 |
+
* Fixed issue with trp-gettext wrappings in WooCommerce REST API
|
159 |
+
* Fixed issue with translating images run through JetPack CDN
|
160 |
+
* Fixed edge case where gettext inside script tag attributes was breaking html
|
161 |
+
* Translated title of product in WooCommerce "Product has been added to cart" message
|
162 |
+
* Better handling of string overdetection in dynamic string translation
|
163 |
+
* Better handling of sql errors and machine translation
|
164 |
+
* Fixed WooCommerce Product Translation on Cart Page for products with hyphen in their names
|
165 |
+
|
166 |
+
= 1.5.5 =
|
167 |
+
* Fixed warnings regarding settings that appeared on fresh installs
|
168 |
+
|
169 |
+
= 1.5.4 =
|
170 |
+
* Added Translation Memory feature
|
171 |
+
* Beaver Builder compatibility
|
172 |
+
* Fixed isseu with gettext special characters inside attributes breaking html sometimes
|
173 |
+
* Fixed an issue with urls slugs not being translated in site-map for secondary languages if "Use subdirectory on default language" was on
|
174 |
+
* Added support for display attribute for language-switcher shortcode
|
175 |
+
|
176 |
+
= 1.5.3 =
|
177 |
+
* Fixed blank page when opening Translation Editor in some localized languages
|
178 |
+
|
179 |
+
= 1.5.2 =
|
180 |
+
* Added -Advanced- tab with various custom settings
|
181 |
+
* Added compatibility to allow translating SeedProd plugin Coming Soon page
|
182 |
+
|
183 |
+
= 1.5.1 =
|
184 |
+
* Added maximum possible size to srcset for translated images
|
185 |
+
* Added compatibility with Query Monitor plugin
|
186 |
+
* Better handling of licenses when pro addons are active
|
187 |
+
* Improved descriptions in settings page and other places
|
188 |
+
* Added filter to allow translation of href as an exception
|
189 |
+
* Fixed translation blocks not working on live in some edge cases
|
190 |
+
* Fixed translation block created in secondary language not working when strings were already translated
|
191 |
+
* Fixed JS error when dynamic translation is disabled by filter
|
192 |
+
* Fixed translating dynamic strings in Editor when viewing as Logged out
|
193 |
+
* Fixed page titles containing special characters not being translated
|
194 |
+
* Fixed title attribute not being translated
|
195 |
+
* Fixed certain custom WooCommerce permalinks not working on translated products
|
196 |
+
* Fixed pencil icon not showing for WooCommerce product images in Shop page on certain themes
|
197 |
+
* Fixed modifying wp_mail headers when we didn't have to
|
198 |
+
|
199 |
+
= 1.5.0 =
|
200 |
+
* Fixed some dynamic images not showing up in translated pages.
|
201 |
+
|
202 |
+
= 1.4.9 =
|
203 |
+
* Fixed incompatibility with custom code for changing flags
|
204 |
+
* Fixed some pages not being translated due to incorrectly encoded character
|
205 |
+
* Fixed some images missing when automatic translation is on
|
206 |
+
|
207 |
+
= 1.4.8 =
|
208 |
+
* Added support for translating images
|
209 |
+
* Added support for translating title attribute
|
210 |
+
* Added support for translating href pointing to internal files and href pointing to any external links
|
211 |
+
* Added support for translating attributes modified dynamically through JS
|
212 |
+
* Added support for translating multiple attributes on the same node
|
213 |
+
* Added support for translating nodes containing mixt of gettext and user-inputted strings
|
214 |
+
* Added notification and disabled TP for servers not running minimum PHP version 5.6.20
|
215 |
+
* Refactored and improved Translation Editor user interface
|
216 |
+
* Added Keyboard shortcuts: CTRL + S (save), CTRL + ALT + Z (discard all changes), CTRL + ALT + LEFT (previous string), CTRL + ALT + RIGHT (next string)
|
217 |
+
* Fixed issues with translation blocks not working on some instances
|
218 |
+
* Security improvements
|
219 |
+
|
220 |
+
= 1.4.7 =
|
221 |
+
* Fixed a php error in previous commit
|
222 |
+
|
223 |
+
= 1.4.6 =
|
224 |
+
* Fixed a js compatibility error with mootools.js
|
225 |
+
* Modified how the license page works and added plugin notifications
|
226 |
+
* Allow compatibility fix for Translation Editor on certain environments
|
227 |
+
* Fixed Safari bug with links when WooCommerce active
|
228 |
+
|
229 |
+
= 1.4.5 =
|
230 |
+
* Performance improvements
|
231 |
+
* Fixed an issue that was causing empty strings to get inserted in the database
|
232 |
+
* Improvements to detecting dynamic js strings earlier
|
233 |
+
* Fixes some urls for sitemap
|
234 |
+
* We now check if str_get_html is successful to avoid fatal error
|
235 |
+
* Fixed regular string loaded by ajax not detected in translation editor
|
236 |
+
* We now allow translating WooCommerce product base name separately from selected variations
|
237 |
+
* Fixed WooCommerce cart details not being translated when changing language
|
238 |
+
* Fixed Automatic Google Translation on languages not published yet
|
239 |
+
* Fixed Translation Editor not working in default language when no translation language is published yet
|
240 |
+
* Fixed gettext wrapping characters showing up in WooCommerce Shipping taxes metabox on Order pages
|
241 |
+
|
242 |
+
= 1.4.4 =
|
243 |
+
* Added more filters
|
244 |
+
* Make sure we do not insert empty strings in the gettext translation table
|
245 |
+
* Added support for Affiliate tracking
|
246 |
+
|
247 |
+
= 1.4.3 =
|
248 |
+
* Fixed an issue with the Language by Get Parameter add-on
|
249 |
+
* Added compatibility with WooCommerce PDF invoice and WooCommerce's order notes.
|
250 |
+
* Added stop_translating_page and before_running_hooks hooks.
|
251 |
+
* Refactored hooks-loader to easily remove hook
|
252 |
+
|
253 |
+
= 1.4.2 =
|
254 |
+
* Fixes the issue with not being able to publish pages when Use subdirectory for default language is set to yes and Gutenberg is installed
|
255 |
+
* Fixed an issue with Elementor and Use subdirectory for default language set to yes
|
256 |
+
* Fixed an issue with Yoast Premium and Use subdirectory for default language set to yes
|
257 |
+
* Fixed missing spaces in translations for original gettext strings with untrimmed spaces
|
258 |
+
|
259 |
+
= 1.4.1 =
|
260 |
+
* Added PHP 7.3 support
|
261 |
+
* Performance improvements
|
262 |
+
|
263 |
+
= 1.4.0 =
|
264 |
+
* Added Enfold compatibility by increasing the template_include hook priority
|
265 |
+
* Add the costa rica flag
|
266 |
+
* Speed improvements by optimizing the full_trim function
|
267 |
+
* Added compatibility for WooCommerce Invoices plugins
|
268 |
+
* Fixed querying for dynamic strings in Translation Editor not bringing up translations for all languages
|
269 |
+
* Fixed notice when gettext table is empty
|
270 |
+
* Added function to display strings with bad encoding in Translation Editor
|
271 |
+
|
272 |
+
|
273 |
+
= 1.3.9 =
|
274 |
+
* Fixed some issues with url translations
|
275 |
+
* Speed improvements
|
276 |
+
* Add Javanese flag
|
277 |
+
* Fixed issue with trimming dynamic strings in our own ajax calls
|
278 |
+
|
279 |
+
= 1.3.8 =
|
280 |
+
* Speed improvements
|
281 |
+
* Remove notices from Editor when we don't have translation languages
|
282 |
+
* Fixed notices with referrer in translator machine
|
283 |
+
* Fixed issues with urls in other languages
|
284 |
+
* Fix issue of nested gettext resulting in unwanted characters
|
285 |
+
* Strip gettext tags from urls run through sanitize_title and esc_url
|
286 |
+
* Set caching calls non-persistent. Doesn't work with object caching otherwise
|
287 |
+
* Set lang attribute in html tag all the time including when on default language
|
288 |
+
* Refactored the way we translate json
|
289 |
+
* Fixed issue with Woocommerce ajax calls
|
290 |
+
|
291 |
+
= 1.3.7 =
|
292 |
+
* Fixed an issue with Woocommerce and redirects when the default language is not English
|
293 |
+
* Speed improvements
|
294 |
+
* Fix relative url without a trailingslash not getting a proper link back
|
295 |
+
* Add ?trp=edit-translation=preview to ajax loaded content. Also add it to all dynamic content.
|
296 |
+
* Added language code column in settings
|
297 |
+
* Removed async false from JS translate-dom-changes
|
298 |
+
|
299 |
+
= 1.3.6 =
|
300 |
+
* Refactored the get_url_for_language() function which should fix a lot of problems with links
|
301 |
+
* Speed improvements
|
302 |
+
* Fixed translation block icon when creating a new block
|
303 |
+
* Fixed issues with trp tags leftovers in html
|
304 |
+
* Fixed issues with gettext strings that weren't detected correctly
|
305 |
+
* Add support for relative url's
|
306 |
+
* Added warning in settings about controlling costs of Google API
|
307 |
+
* Changed API key field description. Added feature to show/hide API key field based on Google Translate Active Yes/No
|
308 |
+
* Fixed Translated-dom-changes string not translated through trp-ajax.
|
309 |
+
* Fixed 400 errors in google translate API
|
310 |
+
|
311 |
+
= 1.3.5 =
|
312 |
+
* Fixed translation problems introduced in the last two versions
|
313 |
+
* Added a console message when trp-ajax request uses fall back to admin ajax for debugging purposes.
|
314 |
+
|
315 |
+
= 1.3.4 =
|
316 |
+
* Fixed issue with options in select tag that couldn't be translated
|
317 |
+
* Fixed force language in custom links
|
318 |
+
* Fixed Woocommerce links fpr products or categories that were added by the user manually in a page
|
319 |
+
* Added Settings link to the list of links displayed on Plugins page
|
320 |
+
* Fixed issue with Kazakhstan flag
|
321 |
+
|
322 |
+
= 1.3.3 =
|
323 |
+
* Fixed issue with Woocommerce ajax strings that were broken in editor on default language in some cases
|
324 |
+
* Speed improvements
|
325 |
+
|
326 |
+
= 1.3.2 =
|
327 |
+
* Speed improvements
|
328 |
+
* Add support for the Ginger – EU Cookie Law plugin
|
329 |
+
* Add support for data-no-dynamic-translation attribute that skips dynamic strings from being translated by dom changes detector
|
330 |
+
* Fixed Edit Pencil icon css in Translation Editor for some sites
|
331 |
+
* Refactored the way we add trp-gettext tag. This should have a lot of benefits in compatibility with other plugins
|
332 |
+
* Optimized block translation detection
|
333 |
+
* Added caching to trp_x function when reading external .mo files
|
334 |
+
* Fixed issue with translatepress icon css that was broken on wpforms forms
|
335 |
+
* Added secret page for removing duplicate rows from database: wp-admin/admin.php?page=trp_remove_duplicate_rows
|
336 |
+
|
337 |
+
= 1.3.1 =
|
338 |
+
* Fixed Woocommerce translation of permalinks
|
339 |
+
* Added support for remove_accents to be based on default language when called from the sanitize_title function
|
340 |
+
* Added support for translating JSON found in custom ajax request
|
341 |
+
* Added better REST compatibility
|
342 |
+
* Added compatibility for Peepso plugin
|
343 |
+
* Fixed TranslatePress roken link to google translate set up api key on settings page
|
344 |
+
* Corrected flags for Arabic and Bengali languages
|
345 |
+
* Fixed issue with multiple slashes being added when the URL had extra get parameters
|
346 |
+
|
347 |
+
= 1.3.0 =
|
348 |
+
* Added support for word trim when the default language is japanese, chinese or thai.
|
349 |
+
* Exluded wp_trim_words funtion from our gettext filter to prevent som issues
|
350 |
+
* Fixed an issue with gettext inside attributes that passed through the wp_kses function.
|
351 |
+
* Fixed issues with the Customizer
|
352 |
+
* Added padding to the language switcher image so we don't conflict with themes that add extra padding to images inside links
|
353 |
+
* We no longer remove \r \n \t from the translation
|
354 |
+
* Fixed issue with title attribute that contained html
|
355 |
+
* Added a filter to all href attributes detected on our translation page
|
356 |
+
* Added a notice to inform admins of the missing mbstring php library
|
357 |
+
* We now send all error logs to debug.log
|
358 |
+
* Added cite and blockquote as top_parents for merge rule on Translation blocks
|
359 |
+
* Fixed nonce accidentally being passed through internationalized function
|
360 |
+
|
361 |
+
= 1.2.9 =
|
362 |
+
* Rearranged and renamed some languages in the options dropdown
|
363 |
+
* Fixed flag of Khmer language
|
364 |
+
* Added Automatic Language Detection notice and included it on add-ons page
|
365 |
+
* Fixed an issue with WooCommerce checkout and Stripe Gateway
|
366 |
+
* Fixed issues with some improper responses from the WP Remote API functions
|
367 |
+
* Fixed minor issues with ajax
|
368 |
+
|
369 |
+
= 1.2.8 =
|
370 |
+
* Added a lot of hooks in the translation manager interface so other people can insert new content there.
|
371 |
+
* We now take into account the presence of www or lack of it in custom links that might be local
|
372 |
+
* We now make sure we're not changing the locale in the backend if the language order is different.
|
373 |
+
* Fixed issue with incorrect language adding in the backend that caused notices in the front-end
|
374 |
+
* Removed obsolete function add_cookie
|
375 |
+
* Fixed trailingslashit over get_permalink in url-converter
|
376 |
+
* Removed adding cookie from php. Fixed enqueue_styles on license and add-ons tabs. Removed deprecated function.
|
377 |
+
|
378 |
+
= 1.2.7 =
|
379 |
+
* Added a warning when changing the default language that it will invalidate their existing translations
|
380 |
+
* Fixed incorrect detection of the form action language parameter
|
381 |
+
* Improved compatibility with themes and plugins that use object buffering
|
382 |
+
* Fixed some issues with image urls
|
383 |
+
|
384 |
+
= 1.2.6 =
|
385 |
+
* Refactored determining language, redirecting and cookie adding
|
386 |
+
* Removed leftover trp-gettext tags when WooCommerce is active on some pages
|
387 |
+
* Fixed get_url_for_language function that was having problems in some cases.
|
388 |
+
|
389 |
+
= 1.2.5 =
|
390 |
+
* Fixed DOM changes script not being enqueued anymore
|
391 |
+
|
392 |
+
= 1.2.4 =
|
393 |
+
* Refactor the shortcode language switcher so it's now HTML similar to the floater
|
394 |
+
* Added link to Appearance -> menus in TranslatePress settings page
|
395 |
+
* Fixed language redirect with permalinks so custom parameters are passed correctly back to the url
|
396 |
+
* Do not load dynamic string translation for IE11 and older
|
397 |
+
|
398 |
+
= 1.2.3 =
|
399 |
+
* Fixed back-end css style not being targeted only for TranslatePress Settings page
|
400 |
+
* Add filter to not remove detected dynamic strings until the ajax is finished
|
401 |
+
* Fixed data-no-translation not taken into account in some cases of Dynamic strings
|
402 |
+
* Fixed translated slug not being included in url sometimes
|
403 |
+
* Fixed issue with gettext string on non visible html attr that prevented other attr from being translated
|
404 |
+
* Fixed bug with translating dom changes not working for complex HTML hierarchy
|
405 |
+
* Corrected flag for Afrikaans.
|
406 |
+
* Fixed compatibility issues with older jQuery versions
|
407 |
+
|
408 |
+
= 1.2.2 =
|
409 |
+
* Added Translation Block feature in which you can translate multiple html elements together
|
410 |
+
* Improvement: make it possible for the SEO Addon to automatically translate page slugs using Google Translate
|
411 |
+
* Fix: using the shortcode language switcher added #trpprocessurl to the end of the url
|
412 |
+
* Fix: changing languages from a secondary language gave 404 page when the page slug was translated
|
413 |
+
* 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
|
414 |
+
|
415 |
+
= 1.2.1 =
|
416 |
+
* Extra css for the floater images so they don't brake the line in certain themes
|
417 |
+
* Fixed compatibility issue with Woocommerce cart widget
|
418 |
+
* Fix: use the siteurl when the homeurl is empty to detect the language
|
419 |
+
|
420 |
+
= 1.2.0 =
|
421 |
+
* Fix wptexturize changing characters in secondary languages
|
422 |
+
* Mini refactoring of the url_is_file() function
|
423 |
+
* Refactor get_url_for_language() to not use the global var
|
424 |
+
* We no longer add the language path to links to actual files on the server
|
425 |
+
|
426 |
+
= 1.1.9 =
|
427 |
+
* Fix widget language switcher to take into account the new hreflang
|
428 |
+
|
429 |
+
= 1.1.8 =
|
430 |
+
* 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.
|
431 |
+
* Fixed Woocommerce session storage compatibility
|
432 |
+
* Fixed language floater not opening on iPhone.
|
433 |
+
* Fixed issue with normal text nodes that were inside an element that had an atribute with gettext and did not get translated
|
434 |
+
* Replaced _ with - in hreflang and filter it
|
435 |
+
* Make force language to custom links set to yes as a default
|
436 |
+
* Remove intensive functions from inside two loops so they only happen once we detect something in js
|
437 |
+
* Decode html characters in mutation observed strings and removed stripslashes from trp-ajax.php to fix some strings added with js not being translated
|
438 |
+
|
439 |
+
= 1.1.7 =
|
440 |
+
* Compatibility fix with Elementor Page Builder
|
441 |
+
* Added translation .pot file
|
442 |
+
* Add proper encoding for mysqli connection in our trp-ajax.php file so we fixed some translation
|
443 |
+
* Fixed infinite loop related to mutation observer on javascript strings by not re-adding detected strings again if they are similar to existing ones
|
444 |
+
* Aligned text from add-ons tab.
|
445 |
+
|
446 |
+
= 1.1.6 =
|
447 |
+
* Added support for translating Contact Form 7 alert messages
|
448 |
+
* Fixed issue with some strings containing special characters not being translated (i.e. "¿¡")
|
449 |
+
* Fixed bug with switching languages in Editor when viewing as Logged out
|
450 |
+
* Fixed issue with broken homepage links in some themes
|
451 |
+
* Added support for RTL languages in translation editor
|
452 |
+
|
453 |
+
= 1.1.5 =
|
454 |
+
* Added support for translation blocks using the css class .translation-block.
|
455 |
+
* Added possibility to choose a different language as default language seen by website visitors.
|
456 |
+
* Updated add-ons settings page with the missing add-ons, added Language by GET parameter addon
|
457 |
+
* Fixed issue with the [language-switcher] in a post or page that broke saving the page when Yoast SEO plugin is active
|
458 |
+
* Added a plugin notification class and a notification for pretty permalinks
|
459 |
+
* Added WooCommerce compatibility tag
|
460 |
+
* Small css improvements
|
461 |
+
|
462 |
+
= 1.1.4 =
|
463 |
+
* Filter to allow adding new language: 'trp_wp_languages'
|
464 |
+
* Fixed issue with get_permalink() in ajax calls that was not returning the propper language
|
465 |
+
* Adapted code to allow language based on a GET parameter
|
466 |
+
* Fix some issues with language switcher and custom queries as well as take into account if subdirectory for default language is on
|
467 |
+
* Fixed issue with js translation that was trimming numbers and other characters from strings when it shouldn't
|
468 |
+
|
469 |
+
= 1.1.3 =
|
470 |
+
* Fix issue where the language switcher didn't work for BuddyPress pages
|
471 |
+
* Fixed issue with CDATA in post content that was breaking the translation
|
472 |
+
* Added a filter that can be activated and that tries to fix invalid html: trp_try_fixing_invalid_html
|
473 |
+
|
474 |
+
= 1.1.2 =
|
475 |
+
* We now make sure that all forms when submitted redirect to the correct language
|
476 |
+
* Fixed an issue with missing slash from language switcher
|
477 |
+
* Fixed an issue where we were not redirecting to the correct url slug when switching languages
|
478 |
+
* Fixed a possible notice inside the get_language_names function
|
479 |
+
* Fixed html breaking because of unescaped quotes in translated meta content
|
480 |
+
* Removed a special character from the full_trim function that was causing some strings to not be selectable for translation
|
481 |
+
|
482 |
+
= 1.1.1 =
|
483 |
+
* Fixed js error with startsWith method not being supported in IE
|
484 |
+
* Removed unnecessary files from select2 lib
|
485 |
+
* Improved the way we rewrite urls to remove certain bugs
|
486 |
+
|
487 |
+
= 1.1.0 =
|
488 |
+
* Implemented View As "Logged out user" functionality so you can translate strings that show only for logged out users
|
489 |
+
* Allow slug edit for default language
|
490 |
+
* Fixed an issue with the dropdown of translation strings when there were unsaved changes and the dropdown disconected from the textarea
|
491 |
+
* Prevent translate editor icon pencil to exit the translation iframe
|
492 |
+
* Fixed translating via the next/prev buttons that reset the position in the translation string list
|
493 |
+
* Refactor the way we are generating the language url for the language switcher when we don't have a variable available
|
494 |
+
|
495 |
+
= 1.0.9 =
|
496 |
+
* We now flush permalinks when saving the settings page to avoid getting 404 and 500 errors
|
497 |
+
* Added the current language as a class on the body tag. Ex: translatepress-en_US
|
498 |
+
* Small readme changes
|
499 |
+
|
500 |
+
= 1.0.8 =
|
501 |
+
* We now allow HTML in normal strings translations.
|
502 |
+
* Changed the way we get the default language permalinks in Woocommerce rewrites
|
503 |
+
* Fixed issues with date_i18n function
|
504 |
+
* Fixed a warning generated when there are no rewrite rules
|
505 |
+
* Fixed dynamic strings not updating the translation dropdown list.
|
506 |
+
* Fixed issues with hidden space characters that were breaking some translations
|
507 |
+
* Make sure we don't loose the trp-edit-translation=preview from url after a WordPress redirect
|
508 |
+
|
509 |
+
= 1.0.7 =
|
510 |
+
* Fixed a small bug in js regarding the translation editor sidebar with
|
511 |
+
* Fixed Language Switcher for Woocommerce product categories and product tags going to 404 pages
|
512 |
+
* Fixed issues with Woocommerce and permalinks when the default language was not english
|
513 |
+
* Excluded more functions from getting gettext wraps
|
514 |
+
|
515 |
+
= 1.0.6 =
|
516 |
+
* Added filter on capabilities to allow other roles to edit translations:'trp_translating_capability'
|
517 |
+
* Don't show php errors and notices when we are storing strings in the database
|
518 |
+
* Fixed issues with attributes that contain json content, for instance in woocommerce variations
|
519 |
+
* We no longer wrap gettext inside the wptexturize function
|
520 |
+
* We no longer wrap gettexts that appear in the bloginfo function
|
521 |
+
|
522 |
+
= 1.0.5 =
|
523 |
+
* Added possibility to edit gettext strings from themes and plugins from english to english, without adding another language. Basically, string-replace functionality.
|
524 |
+
* We now can translate text input placeholders
|
525 |
+
* We have a way of translating emails using the conditional language shortcode [trp_language language="en_US"] English only content [/trp_language]
|
526 |
+
* Fixed issues with some elements that contained new lines and \u00a0 at the start of the strings
|
527 |
+
|
528 |
+
= 1.0.4 =
|
529 |
+
* Fixed issues with the pencil select icon in the translation editor not showing up in certain cases on the button element
|
530 |
+
* Fixed issues with the pencil select icon in the translation editor not showing up in certain cases because of overflow hidden
|
531 |
+
* Fixed a issue that was sometimes causing javascript errors with certain plugins
|
532 |
+
|
533 |
+
= 1.0.3 =
|
534 |
+
* Added a conditional language shortcode: [trp_language language="en_US"] English only content [/trp_language]
|
535 |
+
* Create link to test out Google API key.
|
536 |
+
* Improvements to Woocommerce compatibility
|
537 |
+
* Fixed json_encode error that was causing js errors
|
538 |
+
* Changed 'template_include' hook priority to improve compatibility with some themes
|
539 |
+
|
540 |
+
= 1.0.2 =
|
541 |
+
* Translation interface improvements
|
542 |
+
* Fixed issues with strings loaded with ajax
|
543 |
+
* Added an addon page
|
544 |
+
* Fixed bug with gettext node accidentally wrapping another string too.
|
545 |
+
|
546 |
+
= 1.0.1 =
|
547 |
+
* Fixed incorrect blog prefix name for Multisite subsites on admin_bar gettext hook.
|
548 |
+
* Fixed Translate Page admin bar button sometimes not having the correct url for entering TP Editor Mode
|
549 |
+
* Skipped dynamic strings that have only numbers and special characters.
|
550 |
+
* Fixed order of categories in Editor dropdown. (Meta Information, String List..)
|
551 |
+
* Fixed JS error Uncaught Error: Syntax error, unrecognized expression
|
552 |
+
|
553 |
+
= 1.0.0 =
|
554 |
+
* Initial release.
|