WordPress.org

Ready to get started?Download WordPress

Forums

Google XML Sitemaps v3 for qTranslate
Does it work with Qtranslate Slug? (7 posts)

  1. baga
    Member
    Posted 1 year ago #

  2. vhf
    Member
    Posted 1 year ago #

    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. :)

  3. baga
    Member
    Posted 1 year ago #

    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?

  4. vhf
    Member
    Posted 1 year ago #

    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.

  5. baga
    Member
    Posted 1 year ago #

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

  6. alejoparry
    Member
    Posted 1 year ago #

    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?

  7. DSmidge
    Member
    Plugin Author

    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.