We’re rewarding the question askers & reputations are being recalculated! Read more.
15

You must use the qTranslate native functions to do your job. Use qtrans_use, that is the function that do all the job in qTranslate. It's defined in qtranslate_core.php, line 747 function qtrans_use($lang, $text, $show_available=false) Use it on the raw content of the post! Try this code: <?php $id=47; $post = get_page($id); $content = qtrans_use(...


12

I just found the answer and instead of putting this in the Title: <!--:en-->My English Title<!--:--><!--:fr-->My French Title<!--:--> We need to put this code: [:en]My English Title[:fr]My French Title and qTranslate does the rest :)


9

You can use the qtrans_getLanguage() function. $currentLang = qtrans_getLanguage(); return the current language. See this link for an example


9

This solution worked for me <?php echo __('[:fr]Plus[:en]More'); ?> Note : the " : " is before the language, not after


7

In my header.php, where I want qTranslate language chooser to live, I put this in: <?php echo qtrans_SelectCode('code');?> Then, I added this code to functions.php. It's a little redundant in that it repeats the built-in qTranslate options (image, text, dropdown) which I am not using on my page - but I wanted to retain the code since my filter is ...


5

Check the code that is used by NuRelm Get Posts, it's very likely that it outputs the title using something like echo $post->post_title; To have the title translated by qTranslate,the plugin must use the standard function of Wordpress, in this case the_title, that is applying the filters that qTranslate use to render the text multilanguage. Use: echo ...


5

And I got it. What was missing was re-loading the text domain for WooCommerce, that was loaded with the current locale at initialization: // set the current locale and send email with it active unload_textdomain('woocommerce'); setlocale(LC_ALL, $new_locale); global $q_config, $locale, $woocommerce; $locale = $new_locale; $q_config['language'] = substr($...


4

I have found a possible solution: if ( 'de' === $GLOBALS['q_config']['language']) { echo "<style>#nav li a { margin-left:3px !important; }</style>"; // menu bar width fix } This works well for my menu items being not looking wired.


4

The difference in your case is in filters being applied to output of these functions. While bloginfo applies one of these filters: if ( 'display' == $filter ) { if ( $url ) $output = apply_filters('bloginfo_url', $output, $show); else $output = apply_filters('bloginfo', $output, $show); } Function home_url ...


4

Most correct way to do this would be to use WordPress translations. You should replace this static text with: <?php _e('YOUR TEXT', 'your_text_domain'); ?> And add text domain to your theme. More on this topic: http://codex.wordpress.org/I18n_for_WordPress_Developers You can also... ... use qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage ...


4

I found the solution for a related problem of mine in a Qtranslate Support forums: <?php if(qtrans_getLanguage() == "fr") : ?> <h1>This is French</h1> <?php endif ?> <?php if(qtrans_getLanguage() == "en") : ?> <h1>This is English</h1> <?php endif ?> I hope it would work for you! :)


4

The define('WPLANG', 'ru_RU'); in the wp-config.php is no longer needed, as WordPress stores this value in the database (starting from version 4.0). However, I suppose your problem is actually something different. Your Steps: Add a filter to locale To ensure your language is set correctly, use a code like this: add_filter( 'locale', 'f711_set_language' )...


3

Hi Will also try this: Add this to your functions.php function get_qTrans_TitleText($text) { $language=qtrans_getLanguage(); preg_match('/<!--:'.$language.'-->(.*?)<!--:-->/', $text, $matches); return strip_tags($matches[0]); } And then: <?php echo get_qTrans_TitleText($text); ?> Have no Idea what version of qTranslate and WP you ...


3

Following snippet will disable it for post_type post (modify array below to affect other post_types): function qtrans_disable() { global $typenow, $pagenow; if (in_array($typenow, array('post')) && // post_types where qTranslate should be disabled in_array($pagenow, array('post-new.php', 'post.php'))) { remove_action('...


3

Ok, now that you know your final goal I can try to answer : first , A little background for other people who will read this and might wonder why this question exists (because it can help also in other cases ) the function get_page_by_title() does exactly what the name say . But qTarnslate , as well as other plugins , actually CHANGE the title in the DB . ...


3

<?php $meta = get_post_meta( $post->ID, 'Meta', true ); $lan = qtrans_getLanguage(); $meta_lan = qtrans_use( $lan, $meta, true ); echo $meta_lan; ?> then enter your custom field data using the qtranslate comments: <!--:ca-->CA<!--:--><!--:es-->ES<!--:--><!--:en-->EN<!--:-->


3

What I normally do when using this combination of plugins is to create one form per language. Easy and effective. You could also try qTranslate quicktags: [:en]English text[:ru]Фамилия. But much probably this will lead to some issues down the road.


3

Ok, here is a slightly more complete answer for those who stumble upon this later. add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { $fields['order']['language']['placeholder'] = ''; $fields['order']['language']['type'] = 'text'; $fields['order']['...


3

I don't know the function you mention either, but I would venture to guess that that applies to default roles only anyhow. Still, the link you posted does contain a pointer in the right direction. It speaks of "dummy gettext calls", which is exactly what you have to do. In the following we will adjust the global $wp_roles object on init and hook a filter ...


3

Using tags is pretty straightforward. All data in qTranslate is stored between special <!--:lang-->content<!--:--> tags, wherein lang is the code for the language, like en, ru, de, etc. The post edit UI is altered via qTranslate's heavy JavaScript. The JavaScript parses the content for preset fields and creates new controls. Before saving the ...


2

http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=9 You can use _e(); function to echo your variable and __(); to return your variable. Qtranslate hooks into these functions and translates following your input.


2

As Wyck points out, that's the easiest way. I have the following function in my functions.php and use it to filter a bunch of duplicated widgets, one for each language, e.g.: is_lingo('en'), is_lingo('pt'), etc... function is_lingo( $what ) { if ( !function_exists('qtrans_getLanguage') ) return false; $lingo = qtrans_getLanguage(); ...


2

Less complicated is to use the plugin's Quicktags and use the Gettext functions to print the content in the site. [:en]English[:pt]Português Quicktags docs Another option is to do just like qTranslate interface does with the post titles: Create one custom field for each language in your meta box: qTrans documentation is not consolidated, so analyzing ...


2

1) The plugin doesn't automatically provide translation - you have to fill it in yourself. However, there is a service you can use to get your translations: With qTranslate 2.3, a new feature called "qTranslate Services" have been added. So what does it do? Well, with qTranslate Services, qTranslate can finally do what the name suggest: Translations....


2

In the output of your metabox in the page you want this to appear in you should wrap it in __(). Maybe something like this: echo __( get_post_meta( get_the_ID(), 'your_field' ) );


2

I've experienced issues like this with qTranslate, and the first thing you should do definitely is to make sure that you are using the_title() or the the_title filter, as suggested by Daniel Sachs. Since your widget is already calling the_title() that's clearly not the case. On a few occasions (specifically while updating WordPress or qTranslate) I have had ...


2

Open your backend and go to Settings/General. You will see to input fields: WordPress Address (URL) Site Address (URL) The first one correspond to site_url() and the second one to home_url() So why is there a difference? Because WordPress is able to start from a different site then your blog posts. For example, create a page called 'homepage' and enter in ...


2

What would be the easiest, cheapest approach for this? Simple, create one form per language. In functions.php or, preferably, as a custom plugin: add_shortcode( 'my-lingo-form', 'shortcode_wpse_98360'); function shortcode_wpse_98360() { $lingo = your_language_detection_method(); switch( $lingo ) { case 'en': echo ...


Only top voted, non community-wiki answers of a minimum length are eligible