multilingual static page feature request
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
multilingual static page feature request
Hi guys, the static pages plugin with multilingual support is something that seems to have been asked about for a long time, and I know very significant progress has been made, but can I request the following changes which I think most users of these two plugins would really appreciate.
1. Can the startpage in the static pages plugin be set by language. So a German site visitor would see the german startpage, and an english visitor would see the english startpage. At present only one startpage can be set. I'm thinking a simple language check could be added which then identifies all pages with the startpage setting and simply displays the first page that satisfies both language and startpage set. I hope this isn't too much effort.
2. Could the static pages sidebar plugin be configured to show only pages from the specific language of the user, or if there aren't any pages then default to the serendipity default language (the one set in the configuration screen of admin). I know this isn't easy, and I also know that many users have been recommended to use the multilingual html nugget, but frankly this is a double effort, and requires some knowledge of html, whereas the excellent static pages sidebar plugin already does what users need it to do, just not multi-lingually.
Thanks guys, Carl
1. Can the startpage in the static pages plugin be set by language. So a German site visitor would see the german startpage, and an english visitor would see the english startpage. At present only one startpage can be set. I'm thinking a simple language check could be added which then identifies all pages with the startpage setting and simply displays the first page that satisfies both language and startpage set. I hope this isn't too much effort.
2. Could the static pages sidebar plugin be configured to show only pages from the specific language of the user, or if there aren't any pages then default to the serendipity default language (the one set in the configuration screen of admin). I know this isn't easy, and I also know that many users have been recommended to use the multilingual html nugget, but frankly this is a double effort, and requires some knowledge of html, whereas the excellent static pages sidebar plugin already does what users need it to do, just not multi-lingually.
Thanks guys, Carl
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Sadly this is not very trivial to achieve. I just have prepared this patch for your first wish:
Can you tell me if that works out for you?
About your second wish, as I read the code of the current staticpage plugin list:
This already fetches a list of the current language to the user?! In which regard does that not work?
I'm not working often with the static pages, and Falk is loaded with work, so please excuse me if I get fundamental parts wrong. :-/
Best regards,
Garvin
Sadly this is not very trivial to achieve. I just have prepared this patch for your first wish:
Code: Select all
Index: serendipity_event_staticpage.php
===================================================================
RCS file: /cvsroot/php-blog/additional_plugins/serendipity_event_staticpage/serendipity_event_staticpage.php,v
retrieving revision 1.89
diff -u -r1.89 serendipity_event_staticpage.php
--- serendipity_event_staticpage.php 1 Oct 2006 15:35:41 -0000 1.89
+++ serendipity_event_staticpage.php 10 Oct 2006 07:34:38 -0000
@@ -67,7 +67,7 @@
$propbag->add('page_configuration', $this->config);
$propbag->add('type_configuration', $this->config_types);
$propbag->add('author', 'Marco Rinck, Garvin Hicking, David Rolston, Falk Doering');
- $propbag->add('version', '3.36');
+ $propbag->add('version', '3.37');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
@@ -1239,6 +1239,9 @@
$q = 'SELECT pagetitle
FROM '.$serendipity['dbPrefix'].'staticpages
WHERE is_startpage = 1
+ AND (language = \'' . $serendipity['lang'] . '\'
+ OR language = \'all\'
+ OR language = \'\')
ORDER BY id DESC
LIMIT 1';
$page = serendipity_db_query($q, true, 'assoc');
About your second wish, as I read the code of the current staticpage plugin list:
Code: Select all
$q = 'SELECT id, headline, parent_id, permalink, pagetitle
FROM '.$serendipity['dbPrefix'].'staticpages
WHERE showonnavi = 1
AND publishstatus = 1
AND (language = \''.$serendipity['lang'].'\'
OR language = \'\'
OR language = \'all\')';
I'm not working often with the static pages, and Falk is loaded with work, so please excuse me if I get fundamental parts wrong. :-/
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Uhm, I did not yet submit the patch because I wanted you to try it out.
I've uploaded the pasted code here:
http://rafb.net/paste/results/8mqD6G51.html
Regards,
Garvin
Uhm, I did not yet submit the patch because I wanted you to try it out.
I've uploaded the pasted code here:
http://rafb.net/paste/results/8mqD6G51.html
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
Thanks Garvin, unfortunately it doesn't seem to work, its still only producing the english version as the startpage, and when I use the multilingual sidebar to select german the default overview pages are appearing instead of the german language static page which has been configured as startpage. I also changed the order of the static pages so that the german page was in front of hte english page and it still didn't work.
You're right about the static pages sidebar plugin, and I need to really study this more because it doesn't seem to be reliable.
You're right about the static pages sidebar plugin, and I need to really study this more because it doesn't seem to be reliable.
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
Ok, its taken me a while to retest Garvin's patch, and I can now confirm that in fact it does work as requested.
Its not perfect, let me tell you how it does work. If the browser /computer language is set to German then the patch works flawlessly.
However if the language is set to any other language and the user tries to see the german pages using the multilingual sidebar selector (drop down to choose language) then it doesn't work, and reason for this is that the dropdown selector automatically refers the user to 'index.php?user_language=en (or whichever language has been selected), and for some reason index.php simply brings up the default blog entries forht elanguage chosen, but what it should be doing is checking to see if a static page has been selected as the startpage for the language. I guess this is not trivial, so is it possible to place a static link into the template that changes the language and links to a static page?
Thanks, BTW Garvin, I think it might be safe to commit your patch for the static page startpage in different languages, we just need to figure out why the multilingual plugin isn't doing what is requested.
Carl
Its not perfect, let me tell you how it does work. If the browser /computer language is set to German then the patch works flawlessly.
However if the language is set to any other language and the user tries to see the german pages using the multilingual sidebar selector (drop down to choose language) then it doesn't work, and reason for this is that the dropdown selector automatically refers the user to 'index.php?user_language=en (or whichever language has been selected), and for some reason index.php simply brings up the default blog entries forht elanguage chosen, but what it should be doing is checking to see if a static page has been selected as the startpage for the language. I guess this is not trivial, so is it possible to place a static link into the template that changes the language and links to a static page?
Thanks, BTW Garvin, I think it might be safe to commit your patch for the static page startpage in different languages, we just need to figure out why the multilingual plugin isn't doing what is requested.
Carl
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
Hi jude, I tried that, and it doesn't seem to work.
What I found is that if I use index.php?user_language=de/pages/staticpage.html - I get redirected to the blog overview page with no language selected
index.php?user_language=de?/pages/staticpage.html - same as above
index.php/pages/staticpage.html?user_language=de - I get the blog overview page again, but the language has changed to german.
You are probably right, but what am I missing, why can;t I have the static poage load, and also change the language to german?
Carl
What I found is that if I use index.php?user_language=de/pages/staticpage.html - I get redirected to the blog overview page with no language selected
index.php?user_language=de?/pages/staticpage.html - same as above
index.php/pages/staticpage.html?user_language=de - I get the blog overview page again, but the language has changed to german.
You are probably right, but what am I missing, why can;t I have the static poage load, and also change the language to german?
Carl
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
No that didn't work either, the problem seems to be that if the browser/os language is set differently, then you can either have the language and the blog entries, or the static page in the default language but not both. Seems to be a fundamental flaw in the way the language settings are defined. I know I'm probably the only person making the request, but multilingual s9y installs are popping up all ove rhte place and I think this is one of those features that probaly needs to be thought about. So many of us use static pages now.
Don't you just love 'ancient' threads being dragged into daylight again?
Fear not, I'm on this topic. The flaw is very minor, as a matter of fact the static page plugin is perfectly able to handle multiple start pages for different languages. It just has an error in the way the start page is checked for...
Now that I've found it, I'll try to fix it tonight...
Fear not, I'm on this topic. The flaw is very minor, as a matter of fact the static page plugin is perfectly able to handle multiple start pages for different languages. It just has an error in the way the start page is checked for...
Now that I've found it, I'll try to fix it tonight...
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
Ok, I'm a liar
The mistake is somewhere else and I couldn't wait until tonight...
The mistake is actually in functions_permalinks.inc.php, in function serendipity_currentURL.
There's a line:
Now if there is no query string (read $qst is empty), there should be no '?' in the url, right?
So it should be something like this one:
The above mentioned error with the static start pages for different languages is fixed with that, can't rule out possible side effects though...
Garvin, your opinion on that?
The mistake is actually in functions_permalinks.inc.php, in function serendipity_currentURL.
There's a line:
Code: Select all
$url = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?' . $uri['path'] . $qst;So it should be something like this one:
Code: Select all
if (!empty($qst)) {
$url = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?' . $uri['path'] . $qst;
} else {
$url = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'];
}Garvin, your opinion on that?
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
Now that I read my own code, it should probably check both $uri['path'] and $qst for being empty...
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html