Translation issue in sessions
-
Hello,
I am having an issue with translation on my website. The sessions that are included in the schedule from the content builder do not change to the French language when the language is changed on the page. The WordPress theme is Khore Child.
Is there any way you can help me rectify this?
-
Hello,
Can you try to use the last (development) version: downloads.wordpress.org/plugin/sublanguage.zip. I think I fixed an issue regarding Content Builder. Please ask me again if it doesn’t help.
Hi,
This is the version that I am currently using. Any suggestions?
Sorry, can you mail me the theme files? (maxime4@gmail.com)
Thank you for reporting this problem. I had a look and it appears there is a few issues I will take care in the next plugin update.
In the meantime, you can try to add this code in the function.php of your child theme to patch things.
<?php // add a script to send language variables for ajax add_action('sublanguage_init', function($sublanguage) { add_action('wp_footer', function() use ($sublanguage) { if (isset($sublanguage->current_language, $sublanguage->language_query_var)) { echo '<script>$.ajaxSetup({ beforeSend: function (jqXHR, settings) { if (settings.type=="POST") { settings.data = (settings.data ? settings.data+"&" : "")+"'.$sublanguage->language_query_var.'='.$sublanguage->current_language->post_name.'"; } else { settings.url += (settings.url.indexOf("?") > -1 ? "&" : "?")+"'.$sublanguage->language_query_var.'='.$sublanguage->current_language->post_name.'"; } } });</script>'; } }); }); // correct some interoperability issues between Khore theme and Sublanguage if (defined('DOING_AJAX') && DOING_AJAX) { add_filter('posts_fields', function($sql, $wp_query) { global $wpdb; if (empty($wp_query->query_vars['post_type']) || $wp_query->query_vars['post_type'] !== "session") { $sql = str_replace(", $wpdb->postmeta.meta_value as time, mt1.meta_value as date" , '', $sql); } return $sql; }, 11, 2); add_filter('posts_orderby', function($sql, $wp_query) { global $wpdb; if (empty($wp_query->query_vars['post_type']) || $wp_query->query_vars['post_type'] !== "session") { $sql = str_replace("mt1.meta_value ASC, $wpdb->postmeta.meta_value ASC" , '', $sql); } return $sql; }, 11, 2); add_action('init', function() { global $sublanguage_admin; add_filter('home_url', array($sublanguage_admin,'translate_home_url'), 10, 4); }); }Thank you!
Hi,
I have noticed now that this code has been entered, the french Speaker pages do not load, and I receive a message for an internal server error. Is it possible to have the code work with the speakers?
Thank you.
Hello,
I think you need to go in settings>permalinks and set a translation for “speakers” after “Translate Custom Post Types”.
What is the error message you get?
Hi,
The translation for speakers in the permalinks setting is: presentateurstrices
The error message I receive is:
500 – Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.so the english link for a speaker is:
www.yoursite.com/speakers/speaker-nameand in french:
www.yoursite.com/fr/presentateurstrices/speaker-nameAnd the english one is working but not the french’s. Do I understand right?
yes, that is correct.
Hello,
I am to release a new version of the plugin, with a few changes that should improve general compatibility. Would you like to have a try? You can download it from there: https://downloads.wordpress.org/plugin/sublanguage.zip. Just replace the sublanguage directory in your plugins folder, then go in wp-admin > settings > sublanguages and make sure “use front-end ajax” is checked. You also need to remove the code above I asked you to put on your theme child’s function.php.
Hi,
We have updated the plug-in (replaced the file in the plesk control panel) and changed the settings (in the WordPress back end, under “Settings>sublanguage”) as directed.
However now we cannot access the website at all, we receive this message:
500 – Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.Please advise how to rectify this.
Is the wordpress admin still accessible? If so, try to go in settings > permalink and save to regenerate permalinks.
If you cant access wp-admin at all, you need to delete the sublanguage folder, then visit the admin to deactivate the plugin. Verify the site is running normally, then put back the previous version of the plugin (you can download it there: https://downloads.wordpress.org/plugin/sublanguage.1.5.3.zip)
Sorry for these troubles.
Thank you, the website is up again.
Hi,
Do you have an update on when these issues will be fixed in the next plugin update?
Thanks
The topic ‘Translation issue in sessions’ is closed to new replies.