multilingual static page feature request
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Uhm, no, this code piece just makes sure to append the already possibly existing query string to a URL formed "pretty URL" querystring, like "index.php?/pages&mycustom_argument1=skljd" etc. This is important to add all existing URL variables to the next permalink.
We cannot apply your fix because it would then loose all possible user-added input strings to a query.
Maybe if you can more exactly explain what that fix does (how the URL looks before, and what it should look like using your patch) I can think about how to solve this without affecting other parts?
Regards,
Garvin
Uhm, no, this code piece just makes sure to append the already possibly existing query string to a URL formed "pretty URL" querystring, like "index.php?/pages&mycustom_argument1=skljd" etc. This is important to add all existing URL variables to the next permalink.
We cannot apply your fix because it would then loose all possible user-added input strings to a query.
Maybe if you can more exactly explain what that fix does (how the URL looks before, and what it should look like using your patch) I can think about how to solve this without affecting other parts?
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/
But it will still append all possible query strings/paths to the url, unless there are no query strings/paths to append. Only in that case will it not print a '?' between index file and query data.
The problem is, the current code returns index.php? as the current location. The language selector uses this a parameter which is checked by the static page plugin. And 'index.php' != 'index.php?', so it fails to find other start pages...
The problem is, the current code returns index.php? as the current location. The language selector uses this a parameter which is checked by the static page plugin. And 'index.php' != 'index.php?', so it fails to find other start pages...
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
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
The better fix would be to check in the plugin if preg_match('@' . $serendipity['indexFile'] . '\??$@', $yoururl) instead.
This has to advantages:
1. People don't need to upgrade to serendipity 1.2 to benefit from a working fix.
2. Existing plugins that REQUIRE "index.php?" instead of "index.php" will not be broken.
Best regards,
Garvin
The better fix would be to check in the plugin if preg_match('@' . $serendipity['indexFile'] . '\??$@', $yoururl) instead.
This has to advantages:
1. People don't need to upgrade to serendipity 1.2 to benefit from a working fix.
2. Existing plugins that REQUIRE "index.php?" instead of "index.php" will not be broken.
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/
Alright, I'll check this out and will have a look at the static pages plugin... (regexp and me, we ain't big friends, you know)
I'm probably still missing the bigger picture of s9y's code sometimes, but I'll continue chasing bugs, whenever I find one...
I'm probably still missing the bigger picture of s9y's code sometimes, but I'll continue chasing bugs, whenever I find one...
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
Alright, it's working as can be seen on http://tool.ormus.info/
(serendipity_event_staticpage.php, old code commented)
Code: Select all
//if ((empty($args) || trim($args) == $serendipity['indexFile']) && empty($serendipity['GET']['subpage'])) {
if ((empty($args) || preg_match('@' . $serendipity['indexFile'] . '\??$@', trim($args))) && empty($serendipity['GET']['subpage'])) {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
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Thanks a lot, I just committed your fix!
Regards,
Garvin
Thanks a lot, I just committed your fix!
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/
On a related topic:
I'm currently changing the static page plugin to improve the multi-language capabilities. Next one is: static pages should be displayed depending on the current $serendipity['lang'] setting.
Example: You just link to pages/about.html. The code checks the language setting (be it a general setting or set by the language picker) and serves you the best possible language version. The same way it works with the startpage...
Any pointers where to start looking? I've checked the database, duplicate permalinks for static pages are allowed, so it should be sufficient to create static pages with identical permalinks. And check for the language when selecting the static page from the db. I'm just not sure where to check it, which function/hook is called by s9y when a permalink is requested?
I'm currently changing the static page plugin to improve the multi-language capabilities. Next one is: static pages should be displayed depending on the current $serendipity['lang'] setting.
Example: You just link to pages/about.html. The code checks the language setting (be it a general setting or set by the language picker) and serves you the best possible language version. The same way it works with the startpage...
Any pointers where to start looking? I've checked the database, duplicate permalinks for static pages are allowed, so it should be sufficient to create static pages with identical permalinks. And check for the language when selecting the static page from the db. I'm just not sure where to check it, which function/hook is called by s9y when a permalink is requested?
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
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Maybe you can have a look at the serendipity_event_multilingual event plugin. This one does what you want to do to static pages to entries, so you might be able to transfer sets of code?
Beware - this multilanguage stuff gets complicated.
Regards,
Garvin
Maybe you can have a look at the serendipity_event_multilingual event plugin. This one does what you want to do to static pages to entries, so you might be able to transfer sets of code?
Beware - this multilanguage stuff gets complicated.
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/
Sadly the multilingual event plugin is not of much help, as it handles the language settings via entryproperties table, while the static page plugin stores the language setting in it's staticpage table.
However: I've tried some magic and managed to enable multilanguage for static pages by just adjusting some sql statements in the plugin. It seems to work, but it looks to trivial to trust it
. Need to investigate that a little more tonight.
Only works for [subpage]=pagetitle links though, not for permalinks (it's depending on the GET parameter, which is absent when using permalinks). One has to use identic pagetitles for language versions, making the dropdown list in the backend somewhat useless...
FYI, here's what I've changed:
As you can see, still some question marks around, but it IS working. Stay tuned (or comment).
However: I've tried some magic and managed to enable multilanguage for static pages by just adjusting some sql statements in the plugin. It seems to work, but it looks to trivial to trust it
Only works for [subpage]=pagetitle links though, not for permalinks (it's depending on the GET parameter, which is absent when using permalinks). One has to use identic pagetitles for language versions, making the dropdown list in the backend somewhat useless...
FYI, here's what I've changed:
Code: Select all
file: serendipity_event_staticpage.php
function: getPageID() and selected() (not sure if getPageID needs to be adjusted)
Select id from bla where pagetitle=subpage or permalink=subpage (pseudocode ;) )
changed to:
select id from bla where (pagetitle=subpage or permalink=subpage) and (language = $serendipity['lang'] or language='all' or language='')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
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Actually, that code modification does look decent to me. I think that should work
Regards,
Garvin
Actually, that code modification does look decent to me. I think that should work
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/
Seriously, I have no idea why it's working with permalinks as well 
The sidebar plugin is updated as well... So it looks pretty good. Still can't believe, that it is THAT easy. We should update the backend though, because the dropdown list is rather useless. And we should mention in the help comments, that identical permalinks/pagetitles have to be used.
The sidebar plugin is updated as well... So it looks pretty good. Still can't believe, that it is THAT easy. We should update the backend though, because the dropdown list is rather useless. And we should mention in the help comments, that identical permalinks/pagetitles have to be used.
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
Sorry I couldn't resist, but this is apparently *the* thread that covers my problem ...ormus7577 wrote:Don't you just love 'ancient' threads being dragged into daylight again?![]()
Well ... from reading this thread I still don't quite understand the way the whole system is supposed to workAnd we should mention in the help comments, that identical permalinks/pagetitles have to be used.
Is there any place, that the intended behaviour of the "multi-lingual-feature" of the static-pages-plugin is described in depth ?
From my current tests it looks like this:
- In Administration/Configuration/General Settings I have "Language" set to English and "Use visitor's browser language as default" set to Yes
- I have 2 static pages setup ...
- "Willkommen"(headline)
/infos/welcome.html(permalink)
German(language) - "Welcome"(headline)
/infos/welcome.html(permalink)
English(language)
- "Willkommen"(headline)
- In both pages I have set "Make this page the frontpage of Serendipity" to Yes
I have made 2 other static pages(not set to be the frontpage), but with the same permalink and again in german and english, but here the behaviour is even more confusing. While the first-mentioned pages appear in the desired language within the list of static pages in the sidebar .. it is vice-versa with the second 2 pages. In the "german" browser I see the english headline in the sidebar, where the "english" browser shows the german headline of that page. A click on either link brings me to the german content of that static page.
Can anyone report any similar behaviour?
I'd be willing to try and find a solution myself, but before I start, I would like to know if anyone else is currently working on this issue?
Should I decide to start, you will have to admit some time, because I am still pretty new to s9y and will have to spend some time, to get used to the way things work here
And to make a long story even longer, I would also like to know if anyone would also like to see a "super-default-language"-feature for the static pages? I think of a special "default-language" for static pages that should define which "language-set" of static pages would appear to a visitor that comes along with an "uncovered" language.
In my special case I want to offer static pages in german and english, where english should be the "super-default". Like this a visitor with a "german" browser would only see the german pages, an "english visitor" sees the english pages and all other users would also see the english ones.
Currently any visitor with a language, that doesn't hava any corresponding static-pages doesn't see any of them at all.
I'm looking forward to your feedback ...
Manfred.
Try not. Do or do not. There is no try. (YODA)
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Sadly I can only reply to your question, that I'm not currently working on this issue. But I'd be interested in your findings, if you can spare the time
I also think it would be nice to set a "default" language for a staticpage, in case no staticpage exists for a wanted language!
Regards,
Garvin
Sadly I can only reply to your question, that I'm not currently working on this issue. But I'd be interested in your findings, if you can spare the time
I also think it would be nice to set a "default" language for a staticpage, in case no staticpage exists for a wanted language!
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/
Hi Garvin,garvinhicking wrote:I also think it would be nice to set a "default" language for a staticpage, in case no staticpage exists for a wanted language!
to start getting into the s9y-code and because I need that "default-language"-feature, I would try and start off with that.
I have looked through the code and found 2 interesting variables
- $serendipity['lang']
- $serendipity['autolang']
Can you(or anyone else) confirm, that $serendipity['lang'] is *the* variable to look at, when I'm trying to find out which language is active for the current user ?
Thanks,
Manfred.
Try not. Do or do not. There is no try. (YODA)
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
The multilingual plugin itself uses other variables too, though, to indicate content language. $serendipity['lang'] is basically only used to indicate which lang/serendipity_lang_XX file with constants was loaded.
Regards,
Garvin
That's true! $serendipity['lang'] is the variable all s9y functions rely on.I have looked through the code and found 2 interesting variablesI would guess, that when used in a plugin, that $serendipity['lang'] will actually contain the value of the currently used language, no matter if it comes from the main blog-configuration, automatic detection or from the "Choose Language"-plugin ??
- $serendipity['lang']
- $serendipity['autolang']
The multilingual plugin itself uses other variables too, though, to indicate content language. $serendipity['lang'] is basically only used to indicate which lang/serendipity_lang_XX file with constants was loaded.
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/