Linking to documentation-pages in other languages


Since we have more then one language now, we should think about the necessary links between the pages.

My thought was something like http://www.openformats.org, i.e. you have a list of other languages shown somewhere in the page.

My solution would be an action, like otherlanguages which you would insert into a page only once and which would display the links to the other pages.

Comments?



The 'quick and dirty' openformats approach

Openformats.org adopts alphanumeric tags for identifying nodes and their language: for instance en, fr, it, *es, are the top level nodes in English, French, Italian and Spanish; en0 is the first subnode of the English version, it20 is the first subsubnode of the third subnode of the Italian version etc.
There are also a bunch of pages whose tags are camelcase-formatted, but they follow the same convention:
enLinking is the English altlang of frLinking etc.

I post here for reference the modifications I made to Wikka at openformats to support horizontal links between corresponding pages in different languages (in ODPian jargon they are called altlangs). This is definitely
not a suggestion for an action to implement on this server (the code is dirty and tailored to the conventions in use at OF), but just a possible source of inspiration.

1. Store language definitions in your wiki
Create an ordinary page called Languages containing language names and their code:

de Deutsch
en English
fr Fran├žais
it Italiano
mg Malagasy


2. Create the action to automatically build altlangs
Add the lang.php action to ./actions:

  1. <?php
  2. //get current page
  3. $cpage = $this->GetPageTag();
  4. $ctag = substr($cpage, 0, 2); #extract tag
  5. $cnode = substr($cpage, 2); #extract node
  6. if ($cpage=="main") {
  7.     $ctag = "en";
  8.     $cnode = "";  
  9. }
  10.  
  11. $page = $this->LoadPage('Languages');
  12. $output = $this->Format($page["body"]);
  13. $couples = explode("\n" , $output);  
  14. if (ereg("[A-Z](.*)", $ctag)) { #all public pages in openformats start with a lowercase letter
  15.     // page is not public
  16.     // display default menu bar
  17.     foreach ($couples as $language) {
  18.             $l = explode(" " , $language);
  19.             $tag = strip_tags($l[0]);
  20.             $lang = strip_tags($l[1]);
  21.             print $this->Format("[[".$tag." ".$lang."]]")." ";
  22.         }
  23. } else {
  24.     // page is public
  25.     // display navigation menu
  26.     foreach ($couples as $language) {
  27.         $l = explode(" " , $language);
  28.         $tag = strip_tags($l[0]);
  29.         $lang = strip_tags($l[1]);
  30.         if ($tag == $ctag) {
  31.             print $this->Format("**".$lang."**")." ";
  32.         } else {
  33.             print $this->Format("[[".$tag.$cnode." ".$lang."]]")." ";
  34.         }
  35.     }
  36. }
  37. ?>


3. Modify the header action

Add the following code to ./actions/header.php at the end of the code, immediately after the closing </div>:

<div class="lang">
<?php
include("lang.php");
?>
</div>


MAIN PAGE LANGUAGES

* SpanishLanguage
* FrenchLanguage



CategoryDevelopmentDocumentation CategoryDevelopmentActions
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki