WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Google XML Sitemaps v3 for qTranslate] Does it work with Qtranslate Slug?

[Plugin: Google XML Sitemaps v3 for qTranslate] Does it work with Qtranslate Slug?

Viewing 6 replies - 1 through 6 (of 6 total)
  • vhf
    Member

    @kortchnoi

    No, it doesn’t work with qTranslate Slug.

    But as a happy user, I really wanted to use it with qTranslate Slug, just like you.

    I managed to make them work together, but my hack is really ugly and I don’t expect it to work on any qTranslate Slug install because I kind of hard-coded my qTranslate settings. However, it should work for everybody using foo.bar/lang/some/permalink/structure/. If you use ?lang=lang instead, you’ll have to hack further.

    In sitemap-qtranslate.php, replace :

    // Add an extra permalink url for every non-default qTranslate language
    		foreach ($languages as $language) {
    			if ($qt["hide_default_language"] == 1 && $qt["default_language"] == $language) {
    				$sitemap->AddUrl($permalink, $modified_time, $change_freq, $priority);
    			} else {
    				$sitemap->AddUrl(qtrans_convertURL($permalink, $language, true), $modified_time, $change_freq, $priority);
    			}
    		}

    by :

    global $q_config;
    		$oslug = new QtranslateSlug();
    		$oslug->init();
    		$a = $permalink;
    
    		foreach($q_config['enabled_languages'] as $language) {
    			if ($qt["hide_default_language"] == 1 && $qt["default_language"] == $language) {
    				$sitemap->AddUrl($permalink, $modified_time, $change_freq, $priority);
    			} else {
    				$a = substr($a, 0, strrpos(substr($a, 0, -1), '/')).'/';
    				if(!in_array($a, array('http://', 'http:/'))) {
    					$slug = get_post_meta( url_to_postid($permalink), $oslug->get_meta_key($language), true);
    					$turl = str_replace(home_url(), home_url().'/'.$language, $a.$slug.'/');
    					$turl = preg_replace('#([^:])//#', '$1/', $turl);
    					$sitemap->AddUrl($turl, $modified_time, $change_freq, $priority);
    				}
    			}
    		}

    Dear developpers of this plugin, thanks for your hard work ! Please integrate some qTranslate Slug support in the next version !
    Should you need a starting point, have a look at my dirty code. 🙂

    baga
    Participant

    @baga

    Thanks a lot for posting your solution.

    It didn’t work for me unfortunately, did not even work the original (unmodified) version of the plugin.

    After trying the debug mode, I have this error message:
    “Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 695 bytes) in /home/www-data/mysite.com/wp-content/plugins/qtranslate/qtranslate_core.php on line 688”

    My memory limit is 256M and time limit is 120s.

    Any suggestion?

    vhf
    Member

    @kortchnoi

    Well, if the original unmodified version of this plugin doesn’t work for you, I can’t help you.

    It seems that the problem doesn’t come from the plugin but from your webserver/php configuration.

    16777216B is way less than 256MB, if I were you I would check my configuration again.

    baga
    Participant

    @baga

    I’ll try it on another website which is on another host.

    alejoparry
    Member

    @alejoparry

    I have the same problem. I don’t realized until now. Had any sense to use xml-qtranslate sans translate permalink or maybe the contrary?

    Plugin Author DSmidge
    Member

    @dsmidgy

    Sorry. I tried to implement the slugs but it requires too much work.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Google XML Sitemaps v3 for qTranslate] Does it work with Qtranslate Slug?’ is closed to new replies.