[pmwiki] Re: [Pmwiki-users] Idea: page fallbacks

Bernhard Weichel in pmwiki-users pmwiki-users at b-weichel.2in.de
Fri May 16 03:12:07 CDT 2003


I guess the approach can also be used for switching languages.

So we probably should somehow generalize the approach. I Quote John's
contribution and manipulate it somehow

Another option would be to allow pages to have hierarchical properties such
as 'versions', 'language'. Here is how this
might work, in a way that could be done as a local customisation.

Consider a page called CourseX and you want to have multiple versions in
various languages The general markup would be CourseX~VersionN~languageY
(the ~ character is for illustration).
On the CourseX page, an author would write:

CourseX versions:
* ~Version1~en
* ~Version1~de
* ~Version2~en
* ~Version2~de
* ~Version2~fr
* ~Version3~en
* ~Version3~de

Impressum is available without versions
* Impressum~~de
* Impressum~~en
* Impressum~~fr


and so on.

The customization specifies the fallback approach:

$PageProperties=array("$Version", "$Lang")  // this maps variables to
positions
$PageFallback=array(("last")),               // refer to the lexical first
one
                    ("$Lang", "en", "de", "fr")
                   )

PmWiki would then interpret

CourseX~Version1~en                 CourseX version1 en
CourseX~Version1~de                 CourseX version1 de
CourseX~Version1                    CourseX version1 en   // en is default

CourseX                             CourseX version3 en   // the default

   then link to

 $Group/$Page~Version1~de           CourseX version 1 de
   then link to
 Impressum~~$Lang                  Impressum version1 in the language de
                                       cause it was called from a page which

                                       itself was called in lang "de"
   then link to
 CourseX~~$Lang                    CourseX version3 (the last one)
                                       in the language de
                                       cause it was called from a page which
                                       itself was called in lang "de"
   then link to
 CourseX~~fr                       CourseX vesion3 (the last one)
                                     in the language en (no fr -> fallback
to en)

   then link to
 Impressum                           Impressum~~fr
                                     because previous page was called via fr


I am not really familiar with PHP. perhaps it can also be implemented with
parameters,
so with the customization above:

$Group/$Page?version="Version1"&Lang="$Lang" ...

Then it would not be necessary to invent a new parameter syntax. But one can
use as many properties as desired, due to the fallback it will always find a
page.

The fallbacks are resolved left to right. In this case version precedes
language.

Such feature would really be great:

 * multilingual sites
 * first step into a page workflow thus making wiki more like a content
management.


As an aside, an administrator could, now that I think about it, also use
this
to implement 'redirect' markup for any wiki page...

Yes


Bernhard Weichel (based on proposal by John Rankin)





More information about the pmwiki-users mailing list