BUG when "remove url language code" is on

General questions regarding the use of languages in Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
Giu Tae Kim
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Oct 24, 2012 2:56 pm

BUG when "remove url language code" is on

Post by Giu Tae Kim » Sat May 04, 2013 8:44 pm

Hi... First of all, English it's not my native language. Patience please ;)

I know that this may be a known issue. But after looking and searching (a lot of) info around the web and forums I can't get my language configuration right.

And here I post the configuration of Joomla and languages:

Joomla n server config:
Apache
PHP 5.3.6
Joomla 3.1.1
Protostar Template (same template for all languages)
K2 2.6.6
SEF ON (native)

My host provider is an elite company with dedicated servers especialized in joomla, so at least it isn't a host problem.

I attached imgs of my language status and filter configuration.


---------------------- THE PROBLEM ------------------------

I have my site in 4 languages: English, Spanish, Portuguese and Korean. The site default language is spanish (cause most of us speak es, and we have the most complete version of the site in that language).

In the past I used SH404SEF to make friendly urls for my K2 component. But since K2 have a new built-in seo urls plugin, I stop using SH404SEF (I always pridge to avoid the unnecessary use of extensions, if you can do it natively).

And since Joomla release the new multilanguage feature, I said goodbye to JoomFish :laugh: BTW I think that the multilanguage power is the STRONGEST spot of Joomla , something that either WP can fight.

Something that SH404SEF did is remove the url default language code from all my spanish (default language). That wasn't a choice, that is the way the component work dunno why. So "www.mysite.com/es/hello.html" become "www.mysite.com/hello.html", and the others languages stay as the same, with their owns language tags in url "en", "pt" and "ko".

When I change to Joomla 3, I used the language filter natively. And GREAT! there was an option to turn off the default language code, so I kept my urls articles the same.

Everything OK. BUT, lately I figured out that this option is messing things out.

For example. My PC is in spanish... for me there are no problem to enter in any version of my site in any language.

But in any PC where the default language is different from spanish, the site wont display spanish information... NEVER. I mean NEVER in any part of the site. And this have nothing to do with item associations.


---------------------- THE EXAMPLE ------------------------

I mean. For example, my cousin have his PC in portuguese. And he can access my site in Portuguese (defualt language when he enter):

"www.mysite.com/pt"

He can access to English and also Korean site too...

"www.mysite.com/en" or "www.mysite.com/ko"

But when he try to access in spanish (the real default language). There start the problems...

There are different kind of errors, but I think that everything come from the same point: a bug in languagefilter or a incorrect form of manage language redirection in joomla core.

For example:

If for some reason the menu alias is the same in portuguese and spanish, the the url change correctly but the content (the article, categories and modules, etc) remains in portuguese...

"www.mysite.com/pt/city.html" (PT URL) --> (click es in language switcher) --> "www.mysite.com/city.html" (ES URL)

"www.mysite.com/pt" (PT URL) --> (click es in language switcher) --> "www.mysite.com" (ES URL)

In the cases above, city is the same alias in spanish and portuguese, and the homepages have the same alias. but even the url change, all the rest stay in portuguese. There are not 404 page in these cases.

But in all the others cases where the alias are different, there redirect to an 404 error... most of cases. Example:

"www.mysite.com/pt/atracoes.html" (PT URL) --> (click es in language switcher) --> "www.mysite.com/atracciones.html" (ES URL) but with a nice 404 error page.

The same occurs in other languages. For example:

"www.mysite.com/en/attractions.html" (EN URL) --> (click es in language switcher) --> "www.mysite.com/atracciones.html" (ES URL) but with a nice 404 error page, AND THE CONTENT OF THE 404 PAGE IN PORTUGUESE, the default language of my cousin PC.


---------------------- THE SOLUTION (?) ------------------------

When I turn off the option of remove url language code, everything appear to works fine.

But if I do this, I'm not only going to have to wait to Google crawl all my new urls again (and I'm talking about hundred of pages), also I'm going to lost hundred of Social likes and comments (Fb, Twitter, G+ and others) in spanish. Obviusly I work very hard to got that user interactions and I really don't want to lose that.

I really don't know if this is the best way to solve this. Anyway, the option "remove url language code" may cause problems with others users that are dealing with multilanguage sites.

I found a forum post of someone that describe the same issue: http://forum.joomla.org/viewtopic.php?f=711&t=793150

But, I have the impression that he still couldn't find the solution.

I rly wait a lot of months before posting this, but I don't know what to do now... Please, give me a hand.

Thanks for reading!

---------------------- UPDATES ------------------------

■ J2.5 doesn't seems to reproduce this problem, since the http://multilingual-joomla-demo.cloudaccess.net, is 2.5. And I can access to all languages (also the default english).
You do not have the required permissions to view the files attached to this post.

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: BUG when "remove url language code" is on

Post by infograf768 » Fri May 10, 2013 7:51 am

Please send me by pm a superuser access to your site back-end.
I will have a look.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

Giu Tae Kim
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Oct 24, 2012 2:56 pm

Re: BUG when "remove url language code" is on

Post by Giu Tae Kim » Fri May 10, 2013 9:51 pm

Hi... sr, very thanks for your attention. But I rly prefer to mantain my admin classfied. Please, understand that I had a lot of bad experiences.

This is a real bug, have nothing to do with my Joomla or Server configuration

You can reproduce the problem by:
- Make a fresh install of Joomla 3.1 and a multilanguage site.
- Turn on SEF URL, multilanguage plugin, and remove default language code in url.
- Try to access to the default language page from a PC (and browser) where the language is different from the default site language.

Regards!

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: BUG when "remove url language code" is on

Post by infograf768 » Sat May 11, 2013 9:49 am

Giu Tae Kim wrote:Hi... sr, very thanks for your attention. But I rly prefer to mantain my admin classfied. Please, understand that I had a lot of bad experiences.

This is a real bug, have nothing to do with my Joomla or Server configuration

You can reproduce the problem by:
- Make a fresh install of Joomla 3.1 and a multilanguage site.
- Turn on SEF URL, multilanguage plugin, and remove default language code in url.
- Try to access to the default language page from a PC (and browser) where the language is different from the default site language.

Regards!
I can't reproduce this precise issue here.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

Giu Tae Kim
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Oct 24, 2012 2:56 pm

Re: BUG when "remove url language code" is on

Post by Giu Tae Kim » Mon May 13, 2013 6:04 pm

Well... I spent the whole week testing... and I have this results:

- This error have nothing to do with any of joomla components (like K2).

It seems to be server related. Cause, the error occurs only in the pages where I use an especific hosting.

But how can the server configuration affect the joomla url sef or multilanguage behaviour? I can't find the connection...

Sir infograf768, I will send you a site developed in joomla where I'm having the same issue by PM... thanks for your attention

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: BUG when "remove url language code" is on

Post by infograf768 » Tue May 14, 2013 7:11 am

I looked, and my feeling was that it may have been related to K2.

But if you have tested that your server settings are at fault, there is not much I can do.
I suggest you contact your host.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

Giu Tae Kim
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Oct 24, 2012 2:56 pm

Re: BUG when "remove url language code" is on

Post by Giu Tae Kim » Tue May 14, 2013 9:41 pm

It's not K2 as long that I can reproduce the problem with or without K2.

I only supose that is server related.

But how can the server configuration affect the multilanguage behaviour?

Thanks for your attention

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: BUG when "remove url language code" is on

Post by infograf768 » Wed May 15, 2013 6:32 am

I suggest you compare the parameters of the server where it works to the one where it does not. It may be an .htaccess difference, or anything else...
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

Giu Tae Kim
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Oct 24, 2012 2:56 pm

Re: BUG when "remove url language code" is on

Post by Giu Tae Kim » Sun May 19, 2013 5:11 pm

The server settings are the same, the the php version is correct too.

Something more that I point out is that the error occurs also if the option "Language selection for new visitors" is "browser settings". If this is as "Default Language", the error desappear.

BUT the new visitors from the whole world are going to enter in spanish always first...

I'm rly lost. The host provider say that the host have nothing to do with this. There are no other cases like this?

gijs007
Joomla! Intern
Joomla! Intern
Posts: 88
Joined: Sat Oct 30, 2010 1:43 pm

Re: BUG when "remove url language code" is on

Post by gijs007 » Wed Jun 19, 2013 6:05 pm

I'm having the same issue:

http://forum.joomla.org/viewtopic.php?f=711&t=793150

Apparently it didn't happen with Joomla 2.5

JanMilo
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Jul 05, 2013 8:07 pm

Re: BUG when "remove url language code" is on

Post by JanMilo » Fri Jul 05, 2013 8:23 pm

Giu Tae Kim wrote:The server settings are the same, the the php version is correct too.

Something more that I point out is that the error occurs also if the option "Language selection for new visitors" is "browser settings". If this is as "Default Language", the error desappear.

BUT the new visitors from the whole world are going to enter in spanish always first...

I'm rly lost. The host provider say that the host have nothing to do with this. There are no other cases like this?
Giu,

try to switch off "Search Engine Friendly URLs" as 'freeme' posted in the forum http://forum.joomla.org/viewtopic.php?f=711&t=793150. This helped to solve my issue, so hopefully it will solve yours as well.

fozis
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Oct 07, 2013 10:48 pm
Contact:

Re: BUG when "remove url language code" is on

Post by fozis » Mon Oct 07, 2013 11:03 pm

Lets suppose that we have two language "en(default)" and "fr" .

If "remove url language code" is off everything is well because
user can navigate
http://mysite/en/photos to http://mysite/fr/photos

if "remove url language code" is on joomla removes en/ and this is the beginning of all problems.

In reality joomla cannot go from http://mysite/fr/photos to http://mysite/photos.
So joomla does a redirect (trick) from http://mysite/fr/photos to http://mysite/en/photos and finally to
http://mysite/photos

I have found a tricky solution. I don't know if it is 100% accurately.

Go to joomla/plugins/system/languagefilter/languagefilter.php in function parseRule.

Go to this code

// redirect if sef does not exists and language is not the default one
if (!isset(self::$sefs[$sef]) && $lang_code != self::$default_lang)
{
$sef = isset(self::$lang_codes[$lang_code]) ? self::$lang_codes[$lang_code]->sef : self::$default_sef;

$uri->setPath($sef . '/' . $path);

change the bold text with this

if(strpos($_SERVER["REQUEST_URI"],'fr/') === false)
$uri->setPath('en/' . $path);
else
$uri->setPath($sef . '/' . $path);

Of course languages depend from your site.

Thanks. Sorry for my bad English.

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: BUG when "remove url language code" is on

Post by infograf768 » Sat Oct 12, 2013 5:01 am

When using Items associations, whether menu items or articles. categories, etc. it is strongly suggested to set default to Default Site language instead of Browser Settings and to NOT take off the URL language code for that language.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

tkuschel
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed May 30, 2012 2:22 pm
Location: Wien, Austria
Contact:

Re: BUG when "remove url language code" is on

Post by tkuschel » Wed Dec 11, 2013 3:11 pm

Hi guys,
@ Joomla 2.5.16
I had the same problems here at my site http://www.loytec.com; and there is really a big problem, when switching to the other not default page.

I debugged the problem and I figured it out; now it works.
Our default language is en-US and we have a second language de-DE, and we enabled the
"Remove URL Language Code" as option in the Plug-in Language Filter.
e.g. http://www.loytec.com/de/produkte/linx is a German page and the English counterpart is build with either
http://www.loytec.com/en/products/linx
or
http://www.loytec.com/products/linx

Using the last link from being on the German http://www.loytec.com/de/produkte/linx page, gave an error 404, because it has built "www.loytec.com/de/products/linx" - and that site does not exist!
Please change the following line at
plugins/system/languagefilter/languagefilter.php : (line 250)

Code: Select all

// redirect if sef does not exists and language is not the default one
					if (!isset(self::$sefs[$sef]) && $lang_code != self::$default_lang)
					{
						
						//LOYTEC patch TK++ 2013-12-11; if path =""; then switch to the next language
						// $sef = isset(self::$lang_codes[$lang_code]) ? self::$lang_codes[$lang_code]->sef : self::$default_sef;
						$sef = (isset(self::$lang_codes[$lang_code]) && empty($path)) ? self::$lang_codes[$lang_code]->sef : self::$default_sef;
						
Now it works at my site. - only if you enter the naked site with http://www.loytec.com, it switches to your browser's language site; e.g. on a German browser, it switches to: http://www.loytec.com/de

You can try the old behavior at http://www2.loytec.com/de (only the next following days, ..) and compare it with http://www.loytec.com/de .
Where can I send that bug and solution to?

Thomas Kuschel, Tom oe1tkt, Austria

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: BUG when "remove url language code" is on

Post by infograf768 » Thu Dec 12, 2013 6:22 am

@tkuschel

This looks indeed like solving the 404s issue when a lang cookie is set and one clicks on an url with no languagecode. Tested on both 2.5.x and master/3.2.x.

I am getting other testers now and will make the patches for both versions if confirmed.

Will post here the urls to the tracker.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: BUG when "remove url language code" is on

Post by infograf768 » Thu Dec 12, 2013 7:19 am

Here is the tracker

http://joomlacode.org/gf/project/joomla ... 41&start=0

Please comment.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: BUG when "remove url language code" is on

Post by infograf768 » Fri Dec 13, 2013 9:04 am

This has now been committed for 2.5.17 and 3.2.1

Thanks a lot. That was an old problem.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

Jarod545
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Fri May 25, 2012 10:25 am
Contact:

Re: BUG when "remove url language code" is on

Post by Jarod545 » Tue Dec 17, 2013 9:24 pm

Thanks for this patch, that worked for me no more 404 error


Locked

Return to “Language - Joomla! 3.x”