slug translation implemented, needs review

Any suggestions on how to improve qTranslate? Post here!

Re: slug translation implemented, needs review

Postby baga » Sun Oct 31, 2010 6:53 pm

This slug plugin is fantastic, i was looking for it for ages.
I have a question, would it be possible to make it work with this plugin "Google XML Sitemaps with qTranslate Support" http://wordpress.org/extend/plugins/goo ... e-support/
baga
 
Posts: 14
Joined: Sat Apr 03, 2010 1:07 pm

Re: slug translation implemented, needs review

Postby sprutniks » Wed Nov 03, 2010 3:19 pm

kiwus wrote:Can anyone tell me where do i put
Code: Select all
qTranslateSlug_getSelfUrl($lang)

inside my theme?

anywhere you like to manually get the URL of the current page translated, instead of using the automatic qTranslateSlug_generateLanguageSelectCode()

baga wrote:would it be possible to make it work with this plugin "Google XML Sitemaps with qTranslate Support"

It should already be supported: after all it's the query/domain/prepath language code that matters.
But if you'd like to make it fully work and submit translated slugs into the sitemap, according to http://www.neoegm.com/tech/wordpress/plugins/qtranslate-support-for-the-google-xml-sitemaps-generator-wordpress-plugin/, I guess editing should better take place on that plugin.

Since the qtranslateslug plugin, after removing default qtranslate values, adds filters to page_link, post_link (tag and categories aren't yet implemented),
replacing every qtrans_convertURL with qTranslateSlug_convertURL could be enough (if not even needed at all), but:
-check if function exists, if not then run the normal qtrans_convertURL
-this function doesnt really collect translated slugs at the moment

So we have to test the results
sprutniks
 
Posts: 12
Joined: Mon Apr 26, 2010 9:36 pm

Re: slug translation implemented, needs review

Postby beaver82 » Fri Nov 05, 2010 2:43 pm

it doesn't support categories!! pls add this feature
i also wrote in wordpress forum http://wordpress.org/support/topic/plug ... ?replies=1
beaver82
 
Posts: 1
Joined: Fri Nov 05, 2010 2:42 pm

Re: slug translation implemented, needs review

Postby theycallmediddy » Fri Nov 12, 2010 1:32 pm

If it's not working, be sure to doublecheck your permalink structure as Thomas pointed out here: http://wordpress.org/support/topic/plug ... r-language
It has to be "/%post_id%/%postname%"
Finally working for me!!!!
theycallmediddy
 
Posts: 6
Joined: Sat Oct 16, 2010 9:46 pm

Re: slug translation implemented, needs review

Postby alexkappel » Wed Dec 08, 2010 10:06 pm

I use:
qTranslate
qTranslate META
qTranslate slug

My permalink structure is:
/%post_id%/%postname%/

I have a /se/ and a /en/ set up.
I want to use both pages and posts together with qtranslate and still have good SEO.

I got from:
/se/vara-viner/
/en/vara-viner/

to:
/se/vara-viner/
/en/our-wines/

Which is perfect, thanks to qTranslate slug.
Now to my problem! What happens when I use /%post_id%/%postname%/ is that the posts permalink messes up.

It becomes, by default:
/se/%postid%/vidal-ice-wine-2008-erhaller-guld-i-vin-vm/
/en/%postid%/vidal-ice-wine-2008-receives-gold-in-challenge-international-du-vin/

And nothing works. I try to browse to just /en/vidal-ice-wine-2008-receives-gold-in-challenge-international-du-vin/ but it changes and returns a 404.

Can ayone help me? Any plugins? core hack? a function?
The permlink works to the posts if I change the permlink structure to /%postname%/ but then my second langauge doesn't work (the /en site) exactly which is discussed in this thread.
alexkappel
 
Posts: 4
Joined: Wed Dec 08, 2010 9:45 pm

Re: slug translation implemented, needs review

Postby alexkappel » Thu Dec 09, 2010 10:05 am

Sorry I used %postid% instead of %post_id%. Now it works with.

en/185/vidal-ice-wine-2008-receives-gold-in-challenge-international-du-vin/
alexkappel
 
Posts: 4
Joined: Wed Dec 08, 2010 9:45 pm

Re: slug translation implemented, needs review

Postby ivan.flores » Tue Dec 14, 2010 1:00 am

Well, I read all posts, I'm a noob in PHP but I managed to find a way to solve my problem, the slug with pages.

My default language is Spanish, so if the user are a page (mysite.com/nosotros) and he click in change to English, it works, but the url become (mysite.com/en/nosotros) but well, he can see the English content, the main problem is if the user are view the page in English from the beginning, the url is (mysite.com/en/about-us) ok it works great, but if he change to Spanish the url become (mysite.com/about-us) and show 404 error. Then I found here the function qTranslateSlug_getSelfUrl()

I get this function from: viewtopic.php?f=3&t=1476&p=6023&hilit=qtrans_generateLanguageSelectCode#p6046

But I edit it, I change the qtrans_convertURL(curPageURL(), 'variableLanguage') to qTranslateSlug_getSelfUrl('variableLanguage') and it works like a charm.


This is my code:

Code: Select all
function langlist () {
   
   echo '<ul>';
   if (qtrans_getLanguage() == 'es') {
      echo '<li><a href="' . qTranslateSlug_getSelfUrl('en') . '">Change to English</a></li>';
   } elseif (qtrans_getLanguage() == 'en') {
      echo '<li><a href="' . qTranslateSlug_getSelfUrl('es') . '">Cambiar a Español</a></li>';
   } else {
      echo '<li><a href="' . qTranslateSlug_getSelfUrl('es') . '">Cambiar a  Español</a></li>';
      echo '<li><a href="' . qTranslateSlug_getSelfUrl('en') . '">Change to English</a></li>';
   }
   echo '</ul>';
}


so now, dont care if the user are in Spanish or English, this function get the correct slug for each language, if he are en Spanish (mysite.com/nosotros) and click English the url change to (mysite.com/en/about-us) and if he click English to Spanish the url change to (mysite.com/nosotros)

I know that this solution had already discussed here, but I post this for some new people in PHP like me to help them with this explanation. Between my permanent link format is : /%post_id%/%postname%

Thanks for the plugin and support!
ivan.flores
 
Posts: 14
Joined: Tue Dec 14, 2010 12:33 am

Re: slug translation implemented [now with categories]

Postby marco.delpercio » Sun Mar 13, 2011 3:26 pm

Hi guys

I am not a wordpress expert but I absolutely needed qTranslate to work with categories slug in URL. The plugin posted here was excellent in managing multilingual slugs for posts/pages though it didn't work with categories, I watched the code and lots of parts about categories were still reporting "TODO: implement it!" well I implemented those parts about categories slugs. And now you can choose category slug in any enabled language directly from the category edit form. :)

Please I'd like any wordpress expert coder to review my work since as I said it's my first time coding for wordpress though I can say it is working like charm on my production wordpress 3.1

Regards
Marco Del Percio
Attachments
qtranslate-slug.0.5.php.txt
qTranslate slugs plugin now working with multilingual category slugs
(29.8 KiB) Downloaded 163 times
marco.delpercio
 
Posts: 2
Joined: Sun Mar 13, 2011 3:17 pm

Re: slug translation implemented, needs review

Postby marco.delpercio » Sat Mar 19, 2011 1:56 pm

Hi again guys

I noticed that using default qtranslate language switcher didn't work when you choose custom multilingual slugs so I added qtranslate slug language switcher and moreover I fixed a bug with slugs of parent categories. That is: in previous version 0.5, when you assigned a multilingual slug to a category it was successfully translated yet if this category had any parent categories, the parent categories were not translated by the plugin. Now this version also translates the slugs of parent categories.

Regards
Marco Del Percio
Attachments
qtranslate-slug.0.6.php.txt
Qtranslate Slugs plugin ver. 0.6
(36.32 KiB) Downloaded 203 times
marco.delpercio
 
Posts: 2
Joined: Sun Mar 13, 2011 3:17 pm

Re: slug translation implemented, needs review

Postby CarlosSanz » Thu Mar 24, 2011 10:39 am

2 bug fixes:

On line 71:

Code: Select all
function qTranslateSlug_install(){
   global $wpdb;



On line 75:

Code: Select all
require_once(ABSPATH.'wp-admin/includes/upgrade.php');


Thanks for this plugin :)
Attachments
qtranslate-slug.0.6.php.txt
(36.34 KiB) Downloaded 401 times
CarlosSanz
 
Posts: 8
Joined: Tue Feb 22, 2011 1:23 am

PreviousNext

Return to qTranslate Suggestions Forum

Who is online

Users browsing this forum: No registered users and 0 guests