replace the suffix by /?lang=fr

Popular automatic website translation tool

replace the suffix by /?lang=fr

Postby laurent » Fri Sep 26, 2014 6:10 pm

Hi,

Right now gtranslate adds a language suffix (ex: /fr) at the end of the address line.
However in the buddypress profile pages it comes before the name of the member.
For example "mysite.com/fr/membername"

I'm using gtranslate pro in conjunction with wpml which I need for specific parts of the website and I'd like to know if it would be possible to replace the actual suffix "/fr" by "/?lang=fr" and which always come at the end of the address line (also in buddypress pages)?

I need it to work like that to be sure that when I move from a gtranslate page to another managed by wpml that I remain in the same logic.

Is there a way to do it, even by customizing the gtranslate plugin?

Thank you,
Laurent.
laurent
 
Posts: 28
Joined: Wed Sep 24, 2014 4:46 pm

Re: replace the suffix by /?lang=fr

Postby Edvard » Sat Sep 27, 2014 12:50 am

Hi,

You will need to modify gtranslate rewrite rules in .htaccess file and define which pages are going to be managed by gtranslate and which will not pass to it.

Thank you!
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: replace the suffix by /?lang=fr

Postby laurent » Mon Sep 29, 2014 1:31 pm

Hi,

I'm not exactly sure how to do it.

Imagine I have "http://mysite/activity/?lang=fr" where I use gtranslate and I want to define that when I go to any other page on the site it should be "http://mysite/*/?lang=fr"

Can you please tell me what I should put in htaccess?

Thank you,
L.
laurent
 
Posts: 28
Joined: Wed Sep 24, 2014 4:46 pm

Re: replace the suffix by /?lang=fr

Postby Edvard » Mon Sep 29, 2014 4:31 pm

Hi,

You are not using GTranslate on http://mysite/activity/?lang=fr, so may be you will define the problem more clearly, so I can try to find a solution for you.

If you want mysite.com/fr/membername to become mysite.com/membername?lang=fr I can write a rewrite rule for you. However as I understand membername is not a constant, so you will need to write a rewrite rule per user, which of course wouldn't be possible. If you can configure it to be something like mysite.com/member/membername for your users, it will be easier to rewrite mysite.com/fr/member/* to mysite.com/member/*?lang=fr

Thank you!
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: replace the suffix by /?lang=fr

Postby laurent » Mon Sep 29, 2014 4:39 pm

Hi,

I'm using gtranslate on all buddypress related pages, meaning:
members, activity, groups, etc.

While activity and groups are fix, it is correct that the member pages changes.

So, as you write I need indeed to have for the profile pages: mysite.com/member/*?lang=fr
and I also need it for the other pages: mysite.com/activity/?lang=fr
and mysite.com/groups/?lang=fr

Thanks a lot.
laurent
 
Posts: 28
Joined: Wed Sep 24, 2014 4:46 pm

Re: replace the suffix by /?lang=fr

Postby Edvard » Mon Sep 29, 2014 4:56 pm

So, can you confirm that you want the following:

1. Redirect mysite.com/XX/member/* -> mysite.com/member/*?lang=XX
2. Redirect mysite.com/XX/activity/* -> mysite.com/activity/*?lang=XX
3. Redirect mysite.com/XX/groups/* -> mysite.com/groups/*?lang=XX

Where XX is the 2 letter language code, for example fr, de, it, etc...

Thank you!
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: replace the suffix by /?lang=fr

Postby laurent » Mon Sep 29, 2014 5:08 pm

that's it.
laurent
 
Posts: 28
Joined: Wed Sep 24, 2014 4:46 pm

Re: replace the suffix by /?lang=fr

Postby Edvard » Mon Sep 29, 2014 5:16 pm

Hi,

Please place the following rewrite rules BEFORE gtranslate config rules in your .htaccess file:

RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/member/(.*)$ /member/$2?lang=$1 [R=301,L,QSA]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/activity/(.*)$ /activity/$2?lang=$1 [R=301,L,QSA]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/groups/(.*)$ /groups/$2?lang=$1 [R=301,L,QSA]

Thank you!
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: replace the suffix by /?lang=fr

Postby laurent » Mon Sep 29, 2014 6:06 pm

Hi Edvard,

It's working thanks a lot!

If you don't mind, one last question.
While now I manage to go from a french buddypress page to another page in french, the opposite doesn't work.

Is their a way to say: mysite.com/*/?lang=xx -> mysite.com/member/member/?lang=xx ?

Right now when I go from a non buddypress page in xx to the profile page it sends me to the default language rather than the same language I'm on.
laurent
 
Posts: 28
Joined: Wed Sep 24, 2014 4:46 pm

Re: replace the suffix by /?lang=fr

Postby Edvard » Mon Sep 29, 2014 8:47 pm

Hi,

It will be also possible using RewriteCond and RewriteRule statements in your .htaccess, however it is more time consuming. If you are ready to pay I can do that for you.

Thank you!
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: replace the suffix by /?lang=fr

Postby laurent » Tue Sep 30, 2014 3:56 pm

Hi Edvard,

Thank you for the offer.
I'm actually that impressed with gtranslate that I want to use it for the whole website and replace wpml.
I'm testing it now to see if that will be posible.

This also means that I need to have ?lang=xx at the end of all pages.
I tried using the same logic as before, but it doesn't work.
This is what I use, can you please tell me what I'm doing wrong?

# gtranslate config
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$ /$2?lang=$1 [R=301,L,QSA]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$ /$2?lang=$1 [R=301,L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/(.*)$ /gtranslate/translate.php?url=$2&lang=$1 [L,QSA]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)$ /gtranslate/translate.php?lang=$1 [L,QSA]

Thank you,
L.
laurent
 
Posts: 28
Joined: Wed Sep 24, 2014 4:46 pm

Re: replace the suffix by /?lang=fr

Postby Edvard » Tue Sep 30, 2014 4:01 pm

Hi,

I think if you are not going to use wpml you will need to redirect domain.com/*?lang=xx to domain.com/xx/* , so you will have SEF URLs with GTranslate, is that correct or I'm missing something?

Thanks!
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: replace the suffix by /?lang=fr

Postby laurent » Tue Sep 30, 2014 4:23 pm

Hi,

As I'm using multisite I have links going from one site to the other.
Right now I have in my menus the following links: mysite.com/xx//mysite.com/page
This of course doesn't work, therefore I need the language part to be added to the end of the url, that way I have as link: mysite.com/page/xx
laurent
 
Posts: 28
Joined: Wed Sep 24, 2014 4:46 pm

Re: replace the suffix by /?lang=fr

Postby Edvard » Tue Sep 30, 2014 4:36 pm

I'm not sure I understand, may be you can write an example of what you have and what you want to get?

Why you want to keep lang=xx parameter in the URL if you are not going to use WPML?
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: replace the suffix by /?lang=fr

Postby laurent » Tue Sep 30, 2014 4:44 pm

I think the easiest is to show it to you.

Please have a look at http://www.trainerswall.com/eshop/
If you click on the french flag you'll go to http://www.trainerswall.com/fr/eshop/
Now in the menu hover on "A Propos" and you will see the url link which sends us to another site within the multisite environment.
laurent
 
Posts: 28
Joined: Wed Sep 24, 2014 4:46 pm

Re: replace the suffix by /?lang=fr

Postby Edvard » Tue Sep 30, 2014 5:05 pm

I can see you are using //www.trainerswall.com/services/ as a href attribute of <a> tag. You need to replace it with http://www.trainerswall.com/services/ or add class="nturl" attribute to the submenu item <a> tag, so it will not try to change the URL address and make it incorrect.
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: replace the suffix by /?lang=fr

Postby laurent » Thu Oct 02, 2014 4:38 pm

It's indeed the easiest.
thank you for your help.
laurent
 
Posts: 28
Joined: Wed Sep 24, 2014 4:46 pm

Re: replace the suffix by /?lang=fr

Postby Edvard » Thu Oct 02, 2014 7:04 pm

You are welcome. Thanks!
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

2GLux
cron