| |
|
| :: |
| Author |
Message |
jonli447
Joined: 31 Oct 2007 Posts: 17
|
Posted: Sat Jul 19, 2008 9:48 pm Post subject: Language Problem |
|
|
Hello all,
I just installed this mod, and I found an issue with the XSL transformation. On my site, the US language, en_us, is installed as the default. I was testing out this mod, and I noticed that the sitemap was not being transformed.
I took a look at the HTTP headers, and noticed that "http://forum.example.com/gym_sitemaps/gym_style.php?action-google,type-xsl,lang-en_us,theme_id-2
" is being called for the XSL transformation.
I manually opened the above url in my browser, and the gym_style.php outputs nothing and dies (no output is sent to the browser). I modified the url, so that the "lang" was "lang-en" (for British English) instead of "lang-en_us" (US English). gym_style.php displayed the XSL output fine.
As a result, I think there's a bug whereas if the default language has iso language tag like "en_us" rather than the normal two letter tags, i.e. "en" or "de", the gym_style.php crashes. I was going to look into this further, but I thought it was best not to hack this otherwise brilliant mod.
Thanks for your help.
Jon a.k.a. jonli447 |
|
|
| Back to top |
|
 |
|
 |
jonli447
Joined: 31 Oct 2007 Posts: 17
|
Posted: Sat Jul 19, 2008 11:18 pm Post subject: Re: Language Problem |
|
|
Okay, I fixed the regular expression for the lang tag. Here's the following changes I did. Someone can double check my expression, but I think it's sound. It'll return the standard two letter iso tag if the language in question contains it, or the special xx_xx tag, i.e. en_us, if the language contains it.
Open gymsitemaps/gym_sitemaps/gym_style.php:
Find:
| Code: | | preg_match('`action-(rss|google),type-(xsl),lang-([a-z]+),theme_id-([0-9]+)`', $qs, $matches ); |
And change line to:
| Code: | | preg_match('`action-(rss|google),type-(xsl),lang-([a-z]+[_]?[a-z]?[a-z]?),theme_id-([0-9]+)`', $qs, $matches ); |
I believe this fixes my problem completely, but I'll dig forward. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14327
|
Posted: Sun Jul 20, 2008 12:33 pm Post subject: Re: Language Problem |
|
|
Thanks for reporting, it's a real, but not to big, bug.
As you saw, this comes from the RegEx used to grab the language code, we need to do it like this because FF only accepts escaped &'s (&) where IE and Opera will only accept un-escaped &'s in the xml xsl style sheet's link
The proper RegEx though, would rather just be :
| Code: | | preg_match('`action-(rss|google),type-(xsl),lang-([a-z_]+),theme_id-([0-9]+)`i', $qs, $matches ); |
yours works, but is a bit less efficient, which of course in our case does not matter, but ...
I as well added the i option to be able to match upper cases too, since we never knwo ...
Thanks again for reporting
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
jonli447
Joined: 31 Oct 2007 Posts: 17
|
Posted: Sun Jul 20, 2008 3:40 pm Post subject: Re: Language Problem |
|
|
Thanks for confirming the bug.
FYI, it was late yesterday, and I couldn't remember how to add the "_" to the pattern. I just did it the lazy way, and I figured someone would remember and correct me.  |
|
|
| Back to top |
|
 |
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|