Changing languages

filthlab
Posts: 118
Joined: Tue May 30, 2017 6:49 am

Re: Changing languages

Post by filthlab »

This one
/<?=$url_lng_prefix?>/category/<!--CATEGORY_NAME-->/
is in content_list. I do not have problem with it, it is working fine.

This one
<li id="lan-cs"><a href="/cs<?=$_SERVER['REQUEST_URI']?>">Čeština</a></li>
is in the header template. With these links I'm changing the language. Try to change the language several times and finally you will have some link like this:
.../sv/pt/no/it/es/cs/...
admin
Site Admin
Posts: 37202
Joined: Wed Sep 10, 2008 11:43 am

Re: Changing languages

Post by admin »

You need to get rid of <?=$_SERVER['REQUEST_URI']?> and use the way I described earlier like

/es/<!--CATEGORY_NAME--> and so on
Don't forget to run script update
filthlab
Posts: 118
Joined: Tue May 30, 2017 6:49 am

Re: Changing languages

Post by filthlab »

You advise me to do like this. We had a private conversation about this.

My task:
II. Language Pages
1. When you are in a category page or use a search and change the language you should stay in the same category page or search result in selected language. Generally, when you changing the language you should stay where you are, just the language should be changed. Now when you change the language, no matter where you are it redirects to the Homepage.
Your answer:
I guess now you have links like
htt://domain.com/de/
all you have to do is to change in template to
htt://domain.com/de/<?=$SERVER['REQUEST_URL']?>
And it is working fine, except for the problem I described above.
admin
Site Admin
Posts: 37202
Joined: Wed Sep 10, 2008 11:43 am

Re: Changing languages

Post by admin »

Yes, I did not foreseen this issue , that's why I recommend to change the way you form urls
Don't forget to run script update
filthlab
Posts: 118
Joined: Tue May 30, 2017 6:49 am

Re: Changing languages

Post by filthlab »

So, for this:
II. Language Pages
1. When you are in a category page or use a search and change the language you should stay in the same category page or search result in selected language. Generally, when you changing the language you should stay where you are, just the language should be changed. Now when you change the language, no matter where you are it redirects to the Homepage.
We are at starting position.
How do you suggest to form urls that the above condition is met?
admin
Site Admin
Posts: 37202
Joined: Wed Sep 10, 2008 11:43 am

Re: Changing languages

Post by admin »

Template of a category page is in the "content_list" and search results are in "content_search", so we can use different urls in different templates, right ?
Don't forget to run script update
filthlab
Posts: 118
Joined: Tue May 30, 2017 6:49 am

Re: Changing languages

Post by filthlab »

Right, but I'm changing languages in the header template.
admin
Site Admin
Posts: 37202
Joined: Wed Sep 10, 2008 11:43 am

Re: Changing languages

Post by admin »

You can use <!--TEMPLATE_NAME-->

if ('<!--TEMPLATE_NAME-->' == 'index') {
....
} elseif ('<!--TEMPLATE_NAME-->' == 'content_list') {
...
}

and so on
Don't forget to run script update
filthlab
Posts: 118
Joined: Tue May 30, 2017 6:49 am

Re: Changing languages

Post by filthlab »

I'm not sure what do you mean. Can you be more specific.
admin
Site Admin
Posts: 37202
Joined: Wed Sep 10, 2008 11:43 am

Re: Changing languages

Post by admin »

You create links in template 'header', right ?
Don't forget to run script update
Post Reply