Category desciption & qtranslate
-
Hi,
I’m using qtranslate in my site and I want to make it works for events manager’s category description. I think I have to insert some code in functions.php, but I’m not familiar with php.Thanks
-
here’s another thread which may help you with this – https://www.ads-software.com/support/topic/plugin-events-manager-when-used-with-qtranslate-displays-tags-in-titles?replies=40
Thank you, Angelo, I’ve just taken a look to that thread. Infact qtranslate now works perfectly with articles, pages and events – title, content and so on – but I don’t understand how I can make it works with category description. For me it is enough that the language tags – [:en] or <!–en–> behave as in the widgets.
Has anyone a solution for this?
Do you mean the normal WordPress categories of those for Events Manager?
I mean both of them if it is possible. But for the moment I need a quick solution for events manager ??
I’m not overly familiar with qTranslate – did you mean above that if you can wrap any output with [:en] or <!–en–> tags it can be translated by qTranslate?
Qtranslate permits to manage a multilingual site in this way: every page or post can be written in two or more languages, because the editor presents two or more windows in which you can add any text you want. In this case one for italian language and one for the english one – even if my english is very bad, I know ??
This is great, because you can manage a website in many languages without creating a mirror site for each language.
Widgets don’t have a real editor, but the plugin recognize the language’s tags. For example I can write on a single widget title “[:it]informazioni[:en]information” and when I switch on english, for example, the widget is translated correctly: “information”.
This property doesn’t work for category description, and neither for category event description of events manager.I think – but it is only an intuition – I need to change a php file and I’m not an expert.
Can you help me?
unfortunately we can’t support qTranslate at the moment, it requires lots of custom code specific to the plugin to make it work. there’s various snippets littered around the forums that fix certain holes in certain areas, but we ourselves can’t look at this in the near future.
Thank you for your answer,
I think a solution can be elsewhere. Maybe it will be possible to act on some part of wp code inherent description category, tags and similar. If I can fix it, I think, then it will be simple to write a description in a specific language using only lang tags.This is can be useful, I think, but I don’t an expert in php code. I ask for an help.
1) Many users have fixed some problems between qtranslate and events manager adding this patch into function.php, as you know:
// qtranslate function em_qtranslate($target, $arg1=null, $arg2=null, $arg3=null) { $target->event_name = em_qtranslate_string($target->event_name); $target->event_owner = em_qtranslate_string($target->event_owner); $target->post_content = em_qtranslate_string($target->post_content); $target->event_category = em_qtranslate_string($target->event_category); } function em_qtranslate_string($raw_string) { if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $output = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($raw_string); else $output = __($raw_string); return $output; }
With this patch all things go well, but not for category description. But it is a little step forward solution, I think.
Now it is possible to make work qtranslate with category name adding this other patch:
function qtranslate_edit_taxonomies(){ $args=array( 'public' => true , '_builtin' => false ); $output = 'object'; // or objects $operator = 'and'; // 'and' or 'or' $taxonomies = get_taxonomies($args,$output,$operator); if ($taxonomies) { foreach ($taxonomies as $taxonomy ) { add_action( $taxonomy->name.'_add_form', 'qtrans_modifyTermFormFor'); add_action( $taxonomy->name.'_edit_form', 'qtrans_modifyTermFormFor'); } } } add_action('admin_init', 'qtranslate_edit_taxonomies'); add_filter('get_term', 'qtrans_useTermLib'); ?>
In this case we have a field for each language to name a category.
This patch creates a field for each category “article” name in admin panel.
Now, my questions are:
1) Can I fix event taxonomy in the same way of the first solution I posted?
2) Has anyone an idea I can have a field for each category description, and so for event-category-description, elaborating the second patch?
Excuse for my english, I don’t know if all is clear.
Thanks
I can’t help you with this, but maybe someone using EM and QT can chime in to help ??
NicoWp, we have at the moment all internationalizations for EM & QT done with EM’s filters and placeholders. We’re hoping to one day be able to get rid of all the placeholder customizations and stick completely to filters. This is the most update-safe way.
Previous posts under my account might help you with this. At the moment we’re working on internationalizing AJAX requests. Finished an update for the AJAX event search today. Taking a stab at location autocomplete search next in Add/Edit Event page.
Thank you Daedalon,
I took a look to your solution, that I post here, so that all those who use EM and QT can have all in one post.You suggest to include in wp-admin.php this:
('EM_AJAX_SEARCH', true);
Ok, but where do I include the following snippet?
add_filter( 'em_wp_localize_script', 'ml_em_ajaxurl_fix', 1, 2 ); function ml_em_ajaxurl_fix( $em_localized_js ) { if ( function_exists( 'qtrans_getLanguage' ) ) { $em_localized_js['ajaxurl'] = admin_url('admin-ajax.php?lang=' . qtrans_getLanguage() ); $em_localized_js['locationajaxurl'] = admin_url('admin-ajax.php?action=locations_search&lang=' . qtrans_getLanguage() ); } return( $em_localized_js ); }
Thanks for your help.
We have it in a custom plugin. Should work also if copy-pasted into your theme’s functions.php file.
I pasted it in my theme’s functions.php file but it seems it doesn’t affect anything. I’m sure it’s my fault. I don’t understand what this function has to do.
Perhaps I noticed that if I’ll try to navigate in english in my website when I click on a title event in the full calendar, the linked page is the italian one.
You can see it in this url: https://www.officinebeat.com/en/eventi/
If you click on an event title into the full calendar, it will appear the italian page content, so you must to switch to english again to back to the english menu.
In fine, the category page and any single category event is linked properly, even if the descriptions are always in italian because of the original problem I wrote in this thread – concerning category description.
I must solve theese two issues and all will be right.
That function only affects the AJAX search. If you haven’t edited your wp-config.php to enable it, it would have no effect.
Some other thread that I have written on during this year might be helpful. Hopefully you’ll find a helpful thread through my www.ads-software.com profile!
- The topic ‘Category desciption & qtranslate’ is closed to new replies.