Version Description
- Refactor the shortcode language switcher so it's now HTML similar to the floater
- Added link to Appearance -> menus in TranslatePress settings page
- Fixed language redirect with permalinks so custom parameters are passed correctly back to the url
- Do not load dynamic string translation for IE11 and older
Download this release
Release Info
Developer | madalin.ungureanu |
Plugin | TranslatePress – Translate Multilingual sites |
Version | 1.2.4 |
Comparing to | |
See all releases |
Code changes from version 1.2.3 to 1.2.4
- assets/css/trp-language-switcher.css +77 -59
- assets/js/trp-translate-dom-changes.js +27 -1
- class-translate-press.php +1 -1
- includes/class-language-switcher.php +42 -28
- includes/class-url-converter.php +17 -7
- index.php +1 -1
- languages/translatepress-multilingual.catalog.php +3 -3
- languages/translatepress-multilingual.pot +17 -17
- partials/language-switcher-shortcode.php +28 -24
- partials/main-settings-page.php +6 -2
- readme.txt +8 -2
assets/css/trp-language-switcher.css
CHANGED
@@ -1,96 +1,114 @@
|
|
|
|
|
|
|
|
|
|
1 |
.menu-item-object-language_switcher .trp-flag-image {
|
|
|
2 |
margin: -1px 5px;
|
3 |
vertical-align: baseline;
|
|
|
|
|
|
|
4 |
}
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
|
15 |
-
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { border-top-left-radius: 0 !important; }
|
16 |
-
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { border-top-right-radius: 0 !important; }
|
17 |
-
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { border-bottom-left-radius: 0 !important; }
|
18 |
-
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { border-bottom-right-radius: 0 !important; }
|
19 |
|
20 |
-
.
|
21 |
-
|
22 |
-
width: 18px;
|
23 |
-
height: 18px;
|
24 |
-
}
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
}
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
}
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
|
44 |
-
|
45 |
-
width: 100% !important;
|
46 |
-
}
|
47 |
|
48 |
-
|
49 |
-
width: auto !important;
|
50 |
}
|
51 |
|
52 |
-
.
|
53 |
-
|
|
|
|
|
|
|
54 |
}
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
display: inline-block;
|
59 |
-
margin: 3px 2px 3px 5px;
|
60 |
-
vertical-align: middle;
|
61 |
}
|
62 |
-
|
63 |
-
|
64 |
-
margin-top: 4px;
|
65 |
}
|
66 |
-
|
67 |
-
|
68 |
-
float: right;
|
69 |
-
margin-left: 0;
|
70 |
}
|
71 |
|
72 |
-
.
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
-
.
|
78 |
-
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
-
.
|
82 |
-
|
|
|
83 |
overflow: hidden;
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
|
|
|
|
|
|
|
87 |
#wpadminbar #wp-admin-bar-trp_edit_translation .ab-icon:before {
|
88 |
content: '\f326';
|
89 |
top: 3px;
|
90 |
}
|
91 |
|
92 |
@media screen and ( max-width: 782px ) {
|
93 |
-
|
94 |
#wpadminbar #wp-admin-bar-trp_edit_translation > .ab-item {
|
95 |
text-indent: 0;
|
96 |
}
|
@@ -98,5 +116,5 @@ form.trp-language-switcher-form .ui-selectmenu-button span.dashicons-arrow-down
|
|
98 |
#wpadminbar li#wp-admin-bar-trp_edit_translation {
|
99 |
display: block;
|
100 |
}
|
|
|
101 |
|
102 |
-
}
|
1 |
+
/*
|
2 |
+
* Menu Language Switcher
|
3 |
+
*/
|
4 |
+
|
5 |
.menu-item-object-language_switcher .trp-flag-image {
|
6 |
+
display: inline-block;
|
7 |
margin: -1px 5px;
|
8 |
vertical-align: baseline;
|
9 |
+
padding: 0;
|
10 |
+
border: 0;
|
11 |
+
border-radius:0;
|
12 |
}
|
13 |
|
14 |
+
/*
|
15 |
+
* Shortcode Language Switcher
|
16 |
+
*/
|
17 |
+
.trp-language-switcher{
|
18 |
+
position: relative;
|
19 |
+
width: auto;
|
20 |
+
display: inline-block;
|
21 |
+
padding: 0;
|
22 |
+
border: 0;
|
23 |
+
margin: 2px;
|
24 |
+
box-sizing: border-box;
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
.trp-language-switcher > div {
|
29 |
+
box-sizing: border-box;
|
|
|
|
|
|
|
30 |
|
31 |
+
padding:3px 20px 3px 5px;
|
32 |
+
border: 1px solid #c1c1c1;
|
33 |
+
border-radius: 3px;
|
|
|
34 |
|
35 |
+
background-image:
|
36 |
+
linear-gradient(45deg, transparent 50%, gray 50%),
|
37 |
+
linear-gradient(135deg, gray 50%, transparent 50%);
|
38 |
|
39 |
+
background-position:
|
40 |
+
calc(100% - 8px) calc(1em + 0px),
|
41 |
+
calc(100% - 3px) calc(1em + 0px);
|
|
|
42 |
|
43 |
+
background-size:
|
44 |
+
5px 5px,
|
45 |
+
5px 5px;
|
46 |
|
47 |
+
background-repeat: no-repeat;
|
|
|
|
|
48 |
|
49 |
+
background-color: #fff;
|
|
|
50 |
}
|
51 |
|
52 |
+
.trp-language-switcher > div > a {
|
53 |
+
display: block;
|
54 |
+
padding: 2px;
|
55 |
+
border-radius: 3px;
|
56 |
+
color: rgb(7, 105, 173);
|
57 |
}
|
58 |
|
59 |
+
.trp-language-switcher > div > a:hover {
|
60 |
+
background: #f1f1f1;
|
|
|
|
|
|
|
61 |
}
|
62 |
+
.trp-language-switcher > div > a.trp-ls-shortcode-disabled-language {
|
63 |
+
cursor: default;
|
|
|
64 |
}
|
65 |
+
.trp-language-switcher > div > a.trp-ls-shortcode-disabled-language:hover {
|
66 |
+
background: none;
|
|
|
|
|
67 |
}
|
68 |
|
69 |
+
.trp-language-switcher > div > a > img{
|
70 |
+
display: inline;
|
71 |
+
margin: 0 3px;
|
72 |
+
width: 18px;
|
73 |
+
height: 12px;
|
74 |
+
border-radius: 0;
|
75 |
}
|
76 |
|
77 |
+
.trp-language-switcher .trp-ls-shortcode-current-language{
|
78 |
+
display: inline-block;
|
79 |
+
}
|
80 |
+
.trp-language-switcher:focus .trp-ls-shortcode-current-language,
|
81 |
+
.trp-language-switcher:hover .trp-ls-shortcode-current-language{
|
82 |
+
visibility: hidden;
|
83 |
}
|
84 |
|
85 |
+
.trp-language-switcher .trp-ls-shortcode-language{
|
86 |
+
display: inline-block;
|
87 |
+
height: 1px;
|
88 |
overflow: hidden;
|
89 |
+
visibility: hidden;
|
90 |
+
}
|
91 |
+
|
92 |
+
.trp-language-switcher:focus .trp-ls-shortcode-language,
|
93 |
+
.trp-language-switcher:hover .trp-ls-shortcode-language{
|
94 |
+
visibility:visible;
|
95 |
+
height:auto;
|
96 |
+
position: absolute;
|
97 |
+
left: 0;
|
98 |
+
top: 0;
|
99 |
+
display: inline-block !important;
|
100 |
+
|
101 |
}
|
102 |
|
103 |
+
/*
|
104 |
+
* Front-end Admin Bar Icon
|
105 |
+
*/
|
106 |
#wpadminbar #wp-admin-bar-trp_edit_translation .ab-icon:before {
|
107 |
content: '\f326';
|
108 |
top: 3px;
|
109 |
}
|
110 |
|
111 |
@media screen and ( max-width: 782px ) {
|
|
|
112 |
#wpadminbar #wp-admin-bar-trp_edit_translation > .ab-item {
|
113 |
text-indent: 0;
|
114 |
}
|
116 |
#wpadminbar li#wp-admin-bar-trp_edit_translation {
|
117 |
display: block;
|
118 |
}
|
119 |
+
}
|
120 |
|
|
assets/js/trp-translate-dom-changes.js
CHANGED
@@ -368,8 +368,34 @@ var trpTranslator;
|
|
368 |
var current_language;
|
369 |
var original_language;
|
370 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
// Initialize the Translate Press Editor after jQuery is ready
|
372 |
jQuery( function() {
|
373 |
-
|
|
|
|
|
374 |
});
|
375 |
|
368 |
var current_language;
|
369 |
var original_language;
|
370 |
|
371 |
+
function trp_get_IE_version() {
|
372 |
+
var sAgent = window.navigator.userAgent;
|
373 |
+
var Idx = sAgent.indexOf("MSIE");
|
374 |
+
|
375 |
+
// If IE, return version number.
|
376 |
+
if (Idx > 0)
|
377 |
+
return parseInt(sAgent.substring(Idx+ 5, sAgent.indexOf(".", Idx)));
|
378 |
+
|
379 |
+
// If IE 11 then look for Updated user agent string.
|
380 |
+
else if (!!navigator.userAgent.match(/Trident\/7\./))
|
381 |
+
return 11;
|
382 |
+
else
|
383 |
+
return 0; //It is not IE
|
384 |
+
}
|
385 |
+
|
386 |
+
function trp_allow_detect_dom_changes_to_run(){
|
387 |
+
var IE_version = trp_get_IE_version();
|
388 |
+
if ( IE_version != 0 && IE_version <= 11 ){
|
389 |
+
return false;
|
390 |
+
}
|
391 |
+
return true;
|
392 |
+
}
|
393 |
+
|
394 |
+
|
395 |
// Initialize the Translate Press Editor after jQuery is ready
|
396 |
jQuery( function() {
|
397 |
+
if ( trp_allow_detect_dom_changes_to_run() ) {
|
398 |
+
trpTranslator = new TRP_Translator();
|
399 |
+
}
|
400 |
});
|
401 |
|
class-translate-press.php
CHANGED
@@ -39,7 +39,7 @@ class TRP_Translate_Press{
|
|
39 |
define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
40 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
41 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
42 |
-
define( 'TRP_PLUGIN_VERSION', '1.2.
|
43 |
|
44 |
$this->load_dependencies();
|
45 |
$this->initialize_components();
|
39 |
define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
40 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
41 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
42 |
+
define( 'TRP_PLUGIN_VERSION', '1.2.4' );
|
43 |
|
44 |
$this->load_dependencies();
|
45 |
$this->initialize_components();
|
includes/class-language-switcher.php
CHANGED
@@ -41,7 +41,6 @@ class TRP_Language_Switcher{
|
|
41 |
ob_start();
|
42 |
|
43 |
global $TRP_LANGUAGE;
|
44 |
-
$current_language = $TRP_LANGUAGE;
|
45 |
|
46 |
if ( ! $this->trp_languages ){
|
47 |
$trp = TRP_Translate_Press::get_trp_instance();
|
@@ -49,6 +48,18 @@ class TRP_Language_Switcher{
|
|
49 |
}
|
50 |
$published_languages = $this->trp_languages->get_language_names( $this->settings['publish-languages'] );
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
if( ! $this->trp_settings_object ) {
|
53 |
$trp = TRP_Translate_Press::get_trp_instance();
|
54 |
$this->trp_settings_object = $trp->get_component( 'settings' );
|
@@ -89,39 +100,12 @@ class TRP_Language_Switcher{
|
|
89 |
* Hooked on wp_enqueue_scripts.
|
90 |
*/
|
91 |
public function enqueue_language_switcher_scripts( ){
|
92 |
-
wp_enqueue_script('trp-language-switcher', TRP_PLUGIN_URL . 'assets/js/trp-language-switcher.js', array('jquery'), TRP_PLUGIN_VERSION );
|
93 |
|
94 |
if ( isset( $this->settings['trp-ls-floater'] ) && $this->settings['trp-ls-floater'] == 'yes' ) {
|
95 |
wp_enqueue_style('trp-floater-language-switcher-style', TRP_PLUGIN_URL . 'assets/css/trp-floater-language-switcher.css', array(), TRP_PLUGIN_VERSION );
|
96 |
}
|
97 |
|
98 |
wp_enqueue_style( 'trp-language-switcher-style', TRP_PLUGIN_URL . 'assets/css/trp-language-switcher.css', array(), TRP_PLUGIN_VERSION );
|
99 |
-
|
100 |
-
if( ! $this->trp_settings_object ) {
|
101 |
-
$trp = TRP_Translate_Press::get_trp_instance();
|
102 |
-
$this->trp_settings_object = $trp->get_component( 'settings' );
|
103 |
-
}
|
104 |
-
|
105 |
-
$ls_options = $this->trp_settings_object->get_language_switcher_options();
|
106 |
-
$shortcode_settings = $ls_options[$this->settings['shortcode-options']];
|
107 |
-
|
108 |
-
$ls_script_vars_array = array();
|
109 |
-
|
110 |
-
if( $shortcode_settings['flags'] ) {
|
111 |
-
wp_enqueue_script( 'jquery-ui-core' );
|
112 |
-
wp_enqueue_script( 'jquery-ui-widget' );
|
113 |
-
wp_enqueue_script( 'jquery-ui-menu' );
|
114 |
-
wp_enqueue_script( 'jquery-ui-position' );
|
115 |
-
wp_enqueue_script( 'jquery-ui-selectmenu' );
|
116 |
-
|
117 |
-
wp_enqueue_style( 'trp-jquery-ui-style', TRP_PLUGIN_URL . 'assets/css/trp-jquery-ui.css', array(), TRP_PLUGIN_VERSION );
|
118 |
-
|
119 |
-
$ls_script_vars_array['shortcode_ls_flags'] = true;
|
120 |
-
} else {
|
121 |
-
$ls_script_vars_array['shortcode_ls_flags'] = null;
|
122 |
-
}
|
123 |
-
|
124 |
-
wp_localize_script( 'trp-language-switcher', 'trp_language_switcher_data', $ls_script_vars_array );
|
125 |
}
|
126 |
|
127 |
/**
|
@@ -256,6 +240,36 @@ class TRP_Language_Switcher{
|
|
256 |
return $flag_html;
|
257 |
}
|
258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
/**
|
260 |
* Register language switcher post type.
|
261 |
*
|
41 |
ob_start();
|
42 |
|
43 |
global $TRP_LANGUAGE;
|
|
|
44 |
|
45 |
if ( ! $this->trp_languages ){
|
46 |
$trp = TRP_Translate_Press::get_trp_instance();
|
48 |
}
|
49 |
$published_languages = $this->trp_languages->get_language_names( $this->settings['publish-languages'] );
|
50 |
|
51 |
+
$current_language = array();
|
52 |
+
$other_languages = array();
|
53 |
+
|
54 |
+
foreach( $published_languages as $code => $name ) {
|
55 |
+
if( $code == $TRP_LANGUAGE ) {
|
56 |
+
$current_language['code'] = $code;
|
57 |
+
$current_language['name'] = $name;
|
58 |
+
} else {
|
59 |
+
$other_languages[$code] = $name;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
if( ! $this->trp_settings_object ) {
|
64 |
$trp = TRP_Translate_Press::get_trp_instance();
|
65 |
$this->trp_settings_object = $trp->get_component( 'settings' );
|
100 |
* Hooked on wp_enqueue_scripts.
|
101 |
*/
|
102 |
public function enqueue_language_switcher_scripts( ){
|
|
|
103 |
|
104 |
if ( isset( $this->settings['trp-ls-floater'] ) && $this->settings['trp-ls-floater'] == 'yes' ) {
|
105 |
wp_enqueue_style('trp-floater-language-switcher-style', TRP_PLUGIN_URL . 'assets/css/trp-floater-language-switcher.css', array(), TRP_PLUGIN_VERSION );
|
106 |
}
|
107 |
|
108 |
wp_enqueue_style( 'trp-language-switcher-style', TRP_PLUGIN_URL . 'assets/css/trp-language-switcher.css', array(), TRP_PLUGIN_VERSION );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
|
111 |
/**
|
240 |
return $flag_html;
|
241 |
}
|
242 |
|
243 |
+
/**
|
244 |
+
* Return full or short name, with or without flag
|
245 |
+
*
|
246 |
+
* @param string $language_code Language code.
|
247 |
+
* @param string $language_name Language full name or shortname.
|
248 |
+
* @param array $settings NULL | ls_shortcode
|
249 |
+
* @return string Returns html with flags short or long names, depending on settings.
|
250 |
+
*/
|
251 |
+
public function add_shortcode_preferences( $settings, $language_code, $language_name ) {
|
252 |
+
if ( $settings['flags'] ){
|
253 |
+
$flag = $this->add_flag($language_code, $language_name);
|
254 |
+
} else {
|
255 |
+
$flag = '';
|
256 |
+
}
|
257 |
+
|
258 |
+
if ( $settings['full_names'] ){
|
259 |
+
$full_name = $language_name;
|
260 |
+
} else {
|
261 |
+
$full_name = '';
|
262 |
+
}
|
263 |
+
|
264 |
+
if ( $settings['short_names'] ){
|
265 |
+
$short_name = strtoupper( $this->url_converter->get_url_slug( $language_code, false ) );
|
266 |
+
} else {
|
267 |
+
$short_name = '';
|
268 |
+
}
|
269 |
+
|
270 |
+
return $flag . ' ' . $short_name . $full_name;
|
271 |
+
}
|
272 |
+
|
273 |
/**
|
274 |
* Register language switcher post type.
|
275 |
*
|
includes/class-url-converter.php
CHANGED
@@ -199,14 +199,24 @@ class TRP_Url_Converter {
|
|
199 |
}
|
200 |
|
201 |
if( $post_id ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
$TRP_LANGUAGE = $language;
|
203 |
-
$new_url = get_permalink( $post_id );
|
204 |
-
|
205 |
-
$pass_arguments = parse_url($url);
|
206 |
-
if(isset($pass_arguments['query'])){
|
207 |
-
$new_url = trailingslashit($new_url) . '?' . $pass_arguments['query'];
|
208 |
-
}
|
209 |
-
|
210 |
$TRP_LANGUAGE = $trp_language_copy;
|
211 |
} else {
|
212 |
// If no $post_id is set we simply replace the current language root with the new language root.
|
199 |
}
|
200 |
|
201 |
if( $post_id ){
|
202 |
+
/*
|
203 |
+
* We need to find if the current URL (either passed as parameter or found via cur_page_url)
|
204 |
+
* has extra arguments compared to it's permalink.
|
205 |
+
* We need the permalink based on the language IN THE URL, not the one passed to this function,
|
206 |
+
* as that represents the language to be translated into.
|
207 |
+
*/
|
208 |
+
$TRP_LANGUAGE = $this->get_lang_from_url_string( $url );
|
209 |
+
$processed_permalink = get_permalink($post_id);
|
210 |
+
$arguments = str_replace($processed_permalink, '', $url);
|
211 |
+
// if nothing was replaced, something was wrong, just use the normal permalink without any arguments.
|
212 |
+
if( $arguments == $url ) $arguments = '';
|
213 |
+
|
214 |
+
/*
|
215 |
+
* Transform the global language into the language to be translated,
|
216 |
+
* so we can get the correct permalink (slug and all) and add the remaining arguments that might exist.
|
217 |
+
*/
|
218 |
$TRP_LANGUAGE = $language;
|
219 |
+
$new_url = trailingslashit(get_permalink( $post_id )) . ltrim($arguments, '/');
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
$TRP_LANGUAGE = $trp_language_copy;
|
221 |
} else {
|
222 |
// If no $post_id is set we simply replace the current language root with the new language root.
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: TranslatePress - Multilingual
|
4 |
Plugin URI: https://translatepress.com/
|
5 |
Description: Experience a better way of translating your WordPress site, with full support for WooCommerce and site builders.
|
6 |
-
Version: 1.2.
|
7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
8 |
Author URI: https://cozmoslabs.com/
|
9 |
Text Domain: translatepress-multilingual
|
3 |
Plugin Name: TranslatePress - Multilingual
|
4 |
Plugin URI: https://translatepress.com/
|
5 |
Description: Experience a better way of translating your WordPress site, with full support for WooCommerce and site builders.
|
6 |
+
Version: 1.2.4
|
7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
8 |
Author URI: https://cozmoslabs.com/
|
9 |
Text Domain: translatepress-multilingual
|
languages/translatepress-multilingual.catalog.php
CHANGED
@@ -47,7 +47,6 @@
|
|
47 |
<?php __("Twitter Description", "translatepress-multilingual"); ?>
|
48 |
<?php __("Post Slug", "translatepress-multilingual"); ?>
|
49 |
<?php __("Page Title", "translatepress-multilingual"); ?>
|
50 |
-
<?php __("Change", "translatepress-multilingual"); ?>
|
51 |
<?php __("All Languages", "translatepress-multilingual"); ?>
|
52 |
<?php __("Select the language you wish to make your website available in.", "translatepress-multilingual"); ?>
|
53 |
<?php __("To add <strong>more then two languages</strong> and support for SEO Title, Description, Slug and more checkout <a href=\"%s\" class=\"button button-primary\" target=\"_blank\" title=\"TranslatePress Pro\">TranslatePress PRO</a>", "translatepress-multilingual"); ?>
|
@@ -59,7 +58,7 @@
|
|
59 |
<?php __("Yes", "translatepress-multilingual"); ?>
|
60 |
<?php __("Select Yes if you want languages to display in their native names. Otherwise, they will be displayed in English.", "translatepress-multilingual"); ?>
|
61 |
<?php __("Use subdirectory for default language", "translatepress-multilingual"); ?>
|
62 |
-
<?php __("Select Yes if you want to add the subdirectory in the url for the default language.</br>By selecting Yes, the default language seen by website visitors will become the first one in the \"
|
63 |
<?php __("Force language in custom links", "translatepress-multilingual"); ?>
|
64 |
<?php __("Select Yes if you want to force custom links without language encoding to keep the currently selected language.", "translatepress-multilingual"); ?>
|
65 |
<?php __("Google Translate", "translatepress-multilingual"); ?>
|
@@ -71,7 +70,8 @@
|
|
71 |
<?php __("Shortcode ", "translatepress-multilingual"); ?>
|
72 |
<?php __("Use shortcode on any page or widget.", "translatepress-multilingual"); ?>
|
73 |
<?php __("Menu item", "translatepress-multilingual"); ?>
|
74 |
-
<?php __("Go to Appearance -> Menus to add Language Switcher Languages in any menu.", "translatepress-multilingual"); ?>
|
|
|
75 |
<?php __("Floating language selection", "translatepress-multilingual"); ?>
|
76 |
<?php __("Have a floating dropdown following the user on every page.", "translatepress-multilingual"); ?>
|
77 |
<?php __("Google API Key from settings page:", "translatepress-multilingual"); ?>
|
47 |
<?php __("Twitter Description", "translatepress-multilingual"); ?>
|
48 |
<?php __("Post Slug", "translatepress-multilingual"); ?>
|
49 |
<?php __("Page Title", "translatepress-multilingual"); ?>
|
|
|
50 |
<?php __("All Languages", "translatepress-multilingual"); ?>
|
51 |
<?php __("Select the language you wish to make your website available in.", "translatepress-multilingual"); ?>
|
52 |
<?php __("To add <strong>more then two languages</strong> and support for SEO Title, Description, Slug and more checkout <a href=\"%s\" class=\"button button-primary\" target=\"_blank\" title=\"TranslatePress Pro\">TranslatePress PRO</a>", "translatepress-multilingual"); ?>
|
58 |
<?php __("Yes", "translatepress-multilingual"); ?>
|
59 |
<?php __("Select Yes if you want languages to display in their native names. Otherwise, they will be displayed in English.", "translatepress-multilingual"); ?>
|
60 |
<?php __("Use subdirectory for default language", "translatepress-multilingual"); ?>
|
61 |
+
<?php __("Select Yes if you want to add the subdirectory in the url for the default language.</br>By selecting Yes, the default language seen by website visitors will become the first one in the \"All Languages\" list.", "translatepress-multilingual"); ?>
|
62 |
<?php __("Force language in custom links", "translatepress-multilingual"); ?>
|
63 |
<?php __("Select Yes if you want to force custom links without language encoding to keep the currently selected language.", "translatepress-multilingual"); ?>
|
64 |
<?php __("Google Translate", "translatepress-multilingual"); ?>
|
70 |
<?php __("Shortcode ", "translatepress-multilingual"); ?>
|
71 |
<?php __("Use shortcode on any page or widget.", "translatepress-multilingual"); ?>
|
72 |
<?php __("Menu item", "translatepress-multilingual"); ?>
|
73 |
+
<?php __("Go to %1$s Appearance -> Menus%2$s to add Language Switcher Languages in any menu.", "translatepress-multilingual"); ?>
|
74 |
+
<?php __("Learn more in our documentation.", "translatepress-multilingual"); ?>
|
75 |
<?php __("Floating language selection", "translatepress-multilingual"); ?>
|
76 |
<?php __("Have a floating dropdown following the user on every page.", "translatepress-multilingual"); ?>
|
77 |
<?php __("Google API Key from settings page:", "translatepress-multilingual"); ?>
|
languages/translatepress-multilingual.pot
CHANGED
@@ -21,23 +21,23 @@ msgstr ""
|
|
21 |
msgid "Limit this menu item to the following languages"
|
22 |
msgstr ""
|
23 |
|
24 |
-
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:4, ../tp-add-on-extra-languages/partials/license-settings-page.php:4, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:4, partials/license-settings-page.php:4, ../translatepress/partials/addons-settings-page.php:3, ../translatepress/partials/main-settings-page.php:5, ../translatepress/partials/test-google-key-settings-page.php:17,
|
25 |
msgid "TranslatePress Settings"
|
26 |
msgstr ""
|
27 |
|
28 |
-
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:10, ../tp-add-on-extra-languages/partials/license-settings-page.php:10, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:10, partials/license-settings-page.php:10,
|
29 |
msgid "License Key"
|
30 |
msgstr ""
|
31 |
|
32 |
-
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:15, ../tp-add-on-extra-languages/partials/license-settings-page.php:15, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:15, partials/license-settings-page.php:15,
|
33 |
msgid "Enter your license key."
|
34 |
msgstr ""
|
35 |
|
36 |
-
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:22, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:31, ../tp-add-on-extra-languages/partials/license-settings-page.php:22, ../tp-add-on-extra-languages/partials/license-settings-page.php:31, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:22, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:31, partials/license-settings-page.php:22, partials/license-settings-page.php:31,
|
37 |
msgid "Activate License"
|
38 |
msgstr ""
|
39 |
|
40 |
-
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:28, ../tp-add-on-extra-languages/partials/license-settings-page.php:28, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:28, partials/license-settings-page.php:28,
|
41 |
msgid "Deactivate License"
|
42 |
msgstr ""
|
43 |
|
@@ -172,7 +172,7 @@ msgstr ""
|
|
172 |
msgid "Settings"
|
173 |
msgstr ""
|
174 |
|
175 |
-
#: ../translatepress/includes/class-translation-manager.php:
|
176 |
msgid "Security check"
|
177 |
msgstr ""
|
178 |
|
@@ -208,10 +208,6 @@ msgstr ""
|
|
208 |
msgid "Page Title"
|
209 |
msgstr ""
|
210 |
|
211 |
-
#: ../translatepress/partials/language-switcher-shortcode.php:27
|
212 |
-
msgid "Change"
|
213 |
-
msgstr ""
|
214 |
-
|
215 |
#: ../translatepress/partials/main-settings-language-selector.php:2
|
216 |
msgid "All Languages"
|
217 |
msgstr ""
|
@@ -257,7 +253,7 @@ msgid "Use subdirectory for default language"
|
|
257 |
msgstr ""
|
258 |
|
259 |
#: ../translatepress/partials/main-settings-page.php:49
|
260 |
-
msgid "Select Yes if you want to add the subdirectory in the url for the default language.</br>By selecting Yes, the default language seen by website visitors will become the first one in the \"
|
261 |
msgstr ""
|
262 |
|
263 |
#: ../translatepress/partials/main-settings-page.php:55
|
@@ -304,15 +300,19 @@ msgstr ""
|
|
304 |
msgid "Menu item"
|
305 |
msgstr ""
|
306 |
|
307 |
-
#: ../translatepress/partials/main-settings-page.php:
|
308 |
-
msgid "Go to Appearance -> Menus to add Language Switcher Languages in any menu."
|
309 |
msgstr ""
|
310 |
|
311 |
#: ../translatepress/partials/main-settings-page.php:114
|
|
|
|
|
|
|
|
|
312 |
msgid "Floating language selection"
|
313 |
msgstr ""
|
314 |
|
315 |
-
#: ../translatepress/partials/main-settings-page.php:
|
316 |
msgid "Have a floating dropdown following the user on every page."
|
317 |
msgstr ""
|
318 |
|
@@ -440,14 +440,14 @@ msgstr ""
|
|
440 |
msgid "Learn More"
|
441 |
msgstr ""
|
442 |
|
443 |
-
#:
|
444 |
msgid " TranslatePress Settings"
|
445 |
msgstr ""
|
446 |
|
447 |
-
#:
|
448 |
msgid "Translator"
|
449 |
msgstr ""
|
450 |
|
451 |
-
#:
|
452 |
msgid "Allow this user to translate the website."
|
453 |
msgstr ""
|
21 |
msgid "Limit this menu item to the following languages"
|
22 |
msgstr ""
|
23 |
|
24 |
+
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:4, ../tp-add-on-extra-languages/partials/license-settings-page.php:4, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:4, ../tp-add-on-seo-pack/partials/license-settings-page.php:4, ../translatepress/partials/addons-settings-page.php:3, ../translatepress/partials/main-settings-page.php:5, ../translatepress/partials/test-google-key-settings-page.php:17, partials/license-settings-page.php:4
|
25 |
msgid "TranslatePress Settings"
|
26 |
msgstr ""
|
27 |
|
28 |
+
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:10, ../tp-add-on-extra-languages/partials/license-settings-page.php:10, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:10, ../tp-add-on-seo-pack/partials/license-settings-page.php:10, partials/license-settings-page.php:10
|
29 |
msgid "License Key"
|
30 |
msgstr ""
|
31 |
|
32 |
+
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:15, ../tp-add-on-extra-languages/partials/license-settings-page.php:15, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:15, ../tp-add-on-seo-pack/partials/license-settings-page.php:15, partials/license-settings-page.php:15
|
33 |
msgid "Enter your license key."
|
34 |
msgstr ""
|
35 |
|
36 |
+
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:22, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:31, ../tp-add-on-extra-languages/partials/license-settings-page.php:22, ../tp-add-on-extra-languages/partials/license-settings-page.php:31, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:22, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:31, ../tp-add-on-seo-pack/partials/license-settings-page.php:22, ../tp-add-on-seo-pack/partials/license-settings-page.php:31, partials/license-settings-page.php:22, partials/license-settings-page.php:31
|
37 |
msgid "Activate License"
|
38 |
msgstr ""
|
39 |
|
40 |
+
#: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:28, ../tp-add-on-extra-languages/partials/license-settings-page.php:28, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:28, ../tp-add-on-seo-pack/partials/license-settings-page.php:28, partials/license-settings-page.php:28
|
41 |
msgid "Deactivate License"
|
42 |
msgstr ""
|
43 |
|
172 |
msgid "Settings"
|
173 |
msgstr ""
|
174 |
|
175 |
+
#: ../translatepress/includes/class-translation-manager.php:1114
|
176 |
msgid "Security check"
|
177 |
msgstr ""
|
178 |
|
208 |
msgid "Page Title"
|
209 |
msgstr ""
|
210 |
|
|
|
|
|
|
|
|
|
211 |
#: ../translatepress/partials/main-settings-language-selector.php:2
|
212 |
msgid "All Languages"
|
213 |
msgstr ""
|
253 |
msgstr ""
|
254 |
|
255 |
#: ../translatepress/partials/main-settings-page.php:49
|
256 |
+
msgid "Select Yes if you want to add the subdirectory in the url for the default language.</br>By selecting Yes, the default language seen by website visitors will become the first one in the \"All Languages\" list."
|
257 |
msgstr ""
|
258 |
|
259 |
#: ../translatepress/partials/main-settings-page.php:55
|
300 |
msgid "Menu item"
|
301 |
msgstr ""
|
302 |
|
303 |
+
#: ../translatepress/partials/main-settings-page.php:113
|
304 |
+
msgid "Go to %1$s Appearance -> Menus%2$s to add Language Switcher Languages in any menu."
|
305 |
msgstr ""
|
306 |
|
307 |
#: ../translatepress/partials/main-settings-page.php:114
|
308 |
+
msgid "Learn more in our documentation."
|
309 |
+
msgstr ""
|
310 |
+
|
311 |
+
#: ../translatepress/partials/main-settings-page.php:118
|
312 |
msgid "Floating language selection"
|
313 |
msgstr ""
|
314 |
|
315 |
+
#: ../translatepress/partials/main-settings-page.php:123
|
316 |
msgid "Have a floating dropdown following the user on every page."
|
317 |
msgstr ""
|
318 |
|
440 |
msgid "Learn More"
|
441 |
msgstr ""
|
442 |
|
443 |
+
#: includes/class-translator-accounts.php:119
|
444 |
msgid " TranslatePress Settings"
|
445 |
msgstr ""
|
446 |
|
447 |
+
#: includes/class-translator-accounts.php:123, includes/class-translator-accounts.php:124
|
448 |
msgid "Translator"
|
449 |
msgstr ""
|
450 |
|
451 |
+
#: includes/class-translator-accounts.php:128
|
452 |
msgid "Allow this user to translate the website."
|
453 |
msgstr ""
|
partials/language-switcher-shortcode.php
CHANGED
@@ -1,29 +1,33 @@
|
|
1 |
<?php
|
2 |
-
$
|
3 |
-
if( $shortcode_settings['flags'] && ! $shortcode_settings['full_names'] && ! $shortcode_settings['short_names'] ) {
|
4 |
-
$only_flags_class = 'trp-ls-shortcode-only-flags';
|
5 |
-
}
|
6 |
|
7 |
?>
|
8 |
-
<div class="trp-language-switcher
|
9 |
-
<
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
?>
|
24 |
-
</option>
|
25 |
-
<?php } ?>
|
26 |
-
</select>
|
27 |
-
<noscript><input type="submit" value="<?php _e( 'Change', 'translatepress-multilingual' );?>"></noscript>
|
28 |
-
</form>
|
29 |
-
</div>
|
1 |
<?php
|
2 |
+
$current_language_preference = $this->add_shortcode_preferences($shortcode_settings, $current_language['code'], $current_language['name']);
|
|
|
|
|
|
|
3 |
|
4 |
?>
|
5 |
+
<div class="trp-language-switcher" data-no-translation <?php echo ( isset( $_GET['trp-edit-translation'] ) && $_GET['trp-edit-translation'] == 'preview' ) ? 'data-trp-unpreviewable="trp-unpreviewable"' : '' ?>>
|
6 |
+
<script type="application/javascript">
|
7 |
+
jQuery( document ).ready(function(){
|
8 |
+
// need to have the same with set from JS on both divs. Otherwise it can push stuff around in HTML
|
9 |
+
jQuery('.trp-language-switcher').each(function(index, el){
|
10 |
+
var trp_ls_shortcode_width = jQuery(el).find('.trp-ls-shortcode-language').width() + 5;
|
11 |
+
jQuery(el).find('.trp-ls-shortcode-language').width(trp_ls_shortcode_width);
|
12 |
+
jQuery(el).find('.trp-ls-shortcode-current-language').width(trp_ls_shortcode_width);
|
13 |
+
// We're putting this on display: none after we have it's width.
|
14 |
+
jQuery(el).find('.trp-ls-shortcode-language').hide();
|
15 |
+
})
|
16 |
+
})
|
17 |
+
</script>
|
18 |
+
<div class="trp-ls-shortcode-current-language">
|
19 |
+
<a href="javascript:void(0)" class="trp-ls-shortcode-disabled-language" title="<?php echo $current_language['name'] ?>"><?php echo $current_language_preference ?></a>
|
20 |
+
</div>
|
21 |
+
<div class="trp-ls-shortcode-language">
|
22 |
+
<a href="javascript:void(0)" class="trp-ls-shortcode-disabled-language" title="<?php echo $current_language['name'] ?>"><?php echo $current_language_preference ?></a>
|
23 |
+
<?php foreach ( $other_languages as $code => $name ){
|
24 |
|
25 |
+
$language_preference = $this->add_shortcode_preferences($shortcode_settings, $code, $name);
|
26 |
+
?>
|
27 |
+
<a href="<?php echo $this->url_converter->get_url_for_language($code, false); ?>" title="<?php echo $name; ?>">
|
28 |
+
<?php echo $language_preference?>
|
29 |
+
</a>
|
30 |
|
31 |
+
<?php } ?>
|
32 |
+
</div>
|
33 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
partials/main-settings-page.php
CHANGED
@@ -46,7 +46,7 @@
|
|
46 |
<option value="yes" <?php selected( $this->settings['add-subdirectory-to-default-language'], 'yes' ); ?>><?php _e( 'Yes', 'translatepress-multilingual') ?></option>
|
47 |
</select>
|
48 |
<p class="description">
|
49 |
-
<?php _e( 'Select Yes if you want to add the subdirectory in the url for the default language.</br>By selecting Yes, the default language seen by website visitors will become the first one in the "
|
50 |
</p>
|
51 |
</td>
|
52 |
</tr>
|
@@ -107,7 +107,11 @@
|
|
107 |
<?php $this->output_language_switcher_select( 'menu-options', $this->settings['menu-options'] ); ?>
|
108 |
</div>
|
109 |
<p class="description">
|
110 |
-
<?php
|
|
|
|
|
|
|
|
|
111 |
</p>
|
112 |
</div>
|
113 |
<div class="trp-ls-type">
|
46 |
<option value="yes" <?php selected( $this->settings['add-subdirectory-to-default-language'], 'yes' ); ?>><?php _e( 'Yes', 'translatepress-multilingual') ?></option>
|
47 |
</select>
|
48 |
<p class="description">
|
49 |
+
<?php _e( 'Select Yes if you want to add the subdirectory in the url for the default language.</br>By selecting Yes, the default language seen by website visitors will become the first one in the "All Languages" list.', 'translatepress-multilingual' ); ?>
|
50 |
</p>
|
51 |
</td>
|
52 |
</tr>
|
107 |
<?php $this->output_language_switcher_select( 'menu-options', $this->settings['menu-options'] ); ?>
|
108 |
</div>
|
109 |
<p class="description">
|
110 |
+
<?php
|
111 |
+
$link_start = '<a href="' . admin_url( 'nav-menus.php' ) .'">';
|
112 |
+
$link_end = '</a>';
|
113 |
+
printf(__( 'Go to %1$s Appearance -> Menus%2$s to add Language Switcher Languages in any menu.', 'translatepress-multilingual' ), $link_start, $link_end ); ?>
|
114 |
+
<a href="https://translatepress.com/docs/settings/#language-switcher"><?php _e( 'Learn more in our documentation.', 'translatepress-multilingual' ); ?></a>
|
115 |
</p>
|
116 |
</div>
|
117 |
<div class="trp-ls-type">
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: cozmoslabs, razvan.mo, madalin.ungureanu, cristophor
|
|
3 |
Donate link: https://www.cozmoslabs.com/
|
4 |
Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
|
5 |
Requires at least: 3.1.0
|
6 |
-
Tested up to: 4.9.
|
7 |
-
Stable tag: 1.2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -117,6 +117,12 @@ For more information please check out [TranslatePress documentation](https://tra
|
|
117 |
6. Menu Language Switcher
|
118 |
|
119 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
= 1.2.3 =
|
121 |
* Fixed back-end css style not being targeted only for TranslatePress Settings page
|
122 |
* Add filter to not remove detected dynamic strings until the ajax is finished
|
3 |
Donate link: https://www.cozmoslabs.com/
|
4 |
Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
|
5 |
Requires at least: 3.1.0
|
6 |
+
Tested up to: 4.9.6
|
7 |
+
Stable tag: 1.2.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
117 |
6. Menu Language Switcher
|
118 |
|
119 |
== Changelog ==
|
120 |
+
= 1.2.4 =
|
121 |
+
* Refactor the shortcode language switcher so it's now HTML similar to the floater
|
122 |
+
* Added link to Appearance -> menus in TranslatePress settings page
|
123 |
+
* Fixed language redirect with permalinks so custom parameters are passed correctly back to the url
|
124 |
+
* Do not load dynamic string translation for IE11 and older
|
125 |
+
|
126 |
= 1.2.3 =
|
127 |
* Fixed back-end css style not being targeted only for TranslatePress Settings page
|
128 |
* Add filter to not remove detected dynamic strings until the ajax is finished
|