Wikini

WakkaLocalization

PagePrincipale :: DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur :: Vous êtes ec2-54-163-72-86.compute-1.amazonaws.com

Needs of internationalization


We intend to make WakkaFr usability and development open to everybody. It mean that WakkaFr engine and WakkaFr web site has to be translated.

Be careful ! this page is focused on interface translation. Tranlations and language choice of the contents are the responsability of the editors, not the engine.


Functionnal use cases


We discribe here the fonctionnal use cases which are modified by internationalization.

I. -- Installation of WakkaFr

  1. - the technical administrator decompress WakkaFr archive
  2. - the technical administrator upload the resulting directory on his web site via ftp
  3. - the technical administrator open WakkaFr home page in his browser
  4. - the system detect that it is the first consultation of the site [fixme : there is also a detection when version number differs]
  5. - the system ask the technical administrator to choose a language for WakkaFr installation
  6. - the technical administrator choose a language
  7. - the system ask the technical administrator (in the language he choosed) to fill the datas which are needed for the site configuration :
    • the name of the site
    • the prefix of the database tables
    • [... to be completed ...]
    • the available languages
    • the default language
  8. - the technical administrator fill the datas
    1. - [Alternative case] the technical administrator doesn't fill all parameters needed
    2. - the system inform the technical administrator that he didn't fill all the datas [jump to 7]
  9. - the system save the configuration


II. -- The user modifies his personnal parameters

  1. - the user ask to change his personnal parameters
  2. - the system recognize the user and establishes the language of the page
  3. - the system recover the read rights of the page
  4. - the system detect all languages available for the site interface
    1. - [alt] the system inform the user that he doesn't have the rights to see this page
  5. - the system propose to the user to fill his personnal parameters
    • the password
    • the choice to automaticaly view or not the comments
    • the language used for the interface of the site (between all available languages)
  6. - the user fill the parameters
    1. - [alt] the user doesn't fill all parameters [back to 5]
  7. - the system save the parameters for this users


III. -- The user sees a page

  1. - the user ask for a page
  2. - the system recognize the user and establishes the language of the page
  3. - the system recover the read rights of the page
  4. - the system show the page with an interface in the established language
    1. - the system inform the user that he doesn't have the rights to see the page


IV. -- The system recognize the user and establish the language of the page

  1. - the system recognize the user
  2. - the system select for this page the language choosed by the user
    1. - [alt] the system select for this page the first language selected in the browser [fixme : see in IE and Mozilla how it is called] wich match with one of the available languages of the site (choosen by the technical administrator)
      1. - [alt] the system select for this page the default language of the site (choosen by the technical administrator)


Data model


Common datas


User datas




Three ways of technical solutions


1. Create, manualy, every page a different version for each language.

Pros : good performances (equal to solution 3) ; simple : nothing to learn.
Cons : multiplication of files ; difficult to maintain : when a file is modified, it has to be modified for each language.

2. Generation on the fly.

In this option, when a page is asked in french (interface), a php code generate the page in french.
Pros : less files ; simplest to manage existing translations ad to create new ones.
Cons : need to be computed by the host ; readability of code.
Possible tools to do so :

3. Off-line generation of localized files.

In this option, common source files are used to generate localized files off-line. Then, this localized files are used on-line.
Pros : good performances (equal to solution 1).
Cons : a tool must be found or developed (that's out of the goals of the project).
Possible tools (to be adapted) :


Realization of the chosen solution(s)


I. -- Installation of WakkaFr

Proposition Ia. This part is done only one time for a site and doesn't require high performances. So the localization of the installation should be generated on the fly.
Proposition Ia1?. To be easily readable, the code for translation should be placed at the beginning of each file.

Cases I. 5-6
Reminder:
5) - the system ask the user to choose a language for WakkaFr installation
6) - the technical administrator choose a language
Proposition Ia2?.

<?php

// To be done

?>



Cases I. 7-9
Reminder:
7) - the system ask the technical administrator (in the language he choosed) to fill the datas which are needed for the site configuration :
8) - the technical administrator fill the datas
  1. - [alt] the technical administrator doesn't fill all parameters needed
  2. - the system inform the technical administrator that he didn't fill all the datas [jump to 7]
9) - the system save the configuration

Proposition Ia3?. The available languages and the default language of the site are stored at the same time, in the same file as other configuration parameters : wakka.config.php.
Proposition Ia4?. The available languages are stored in an array called available_languages. The default language is store in a constant called "defaut_language".

<?php

// To be done

?>



II. -- The user modifies his personnal parameters


  1. - the system detect all languages available for the site interface
  2. - the system propose to the user to fill his personnal parameters
    • the password
    • the choice to automaticaly view or not the comments
    • the language used for the interface of the site (between all available languages)
  3. - the user fill the parameters
    1. - [alt] the user doesn't fill all parameters [back to 5]
  4. - the system save the parameters for this users

Proposition IIa1. All this case is done with the files /actions/usersettings.php (form), /wakka.php (database access), /wakka.config.php (available languages of the site).

Option IIa2a : the language choosen is stored in a session variable.
Option IIa2b : the language choosen is stored in a "users" table field.

<?php

// To be done

?>



IV. -- The system recognize the user and establish the language of the page

  1. - the system recognize the user
  2. - the system select for this page the language choosed by the user
    1. - [alt] the system select for this page the first language selected in the browser [fixme : see in IE and Mozilla how it is called] wich match with one of the available languages of the site (choosen by the technical administrator)
      1. - [alt] the system select for this page the default language of the site (choosen by the technical administrator)

Proposition IVa. Here is a proposition of code by DavidDelon (slightly rewritten by CharlesNepote) :

<?php
// start session
session_start();

// Add this code after session_start(); in /wakka.php (and default_lang in wakka.config.php)

// Select the language requested by the user in last page
$lg=$_REQUEST["lang"];
// Else, select the language memorised in session
if(!$lg) { $lg=$_SESSION["lang"]; }
// [TODO : Else, select the prefered browser language]
// ..........
// Else, select the default language of the site (choosen by the technical admin.)
if(!$lg) { $lg $wakkaConfig["default_lang"]; }

// Save in session the present used language
$_SESSION["lang"]=$lg;

?>


The $lg is the result of the code.


III. -- The user sees a page

  1. - the system recognize the user and establishes the language of the page
  2. - the system show the page with an interface in the established language
    1. - the system inform the user that he doesn't have the rights to see the page


Solution IIIa

This solution, proposed by DavidDelon, correspond to two of the ways to solve the problem :
-- pages manualy created
-- off-line generation of the localized pages (it doesn't include the process of generating)
This solution use the $lg variable which has been completed in the precedent process (proposition IVa).

<?php
// If a language have been selected
if($lg){
    
//
    
$wakkaConfig["action_path"]  .= "/"$lg;
    
$wakkaConfig["handler_path"] .= "/"$lg;
    
// [TODO : select the right "navigation links"]
}
?>


The file hierarchy will have to be :
Example : david.delon.free.fr/wakka :
-- I translated the headers (Vous etes ..., You are ..., Du bist ...)
-- I added the navigations links translated... done by separate config files for each language.
-- DavidDelon (CharlesNepote's translation)


Solution IIIb


This solution use the $lg variable which has been completed in the precedent process (proposition IVa).
Example (not complete) for /actions/footer.php

<?php
switch ($lg) {
    case 
"" :
        
define ("txt_Text_search""TextSearch");
        
define ("txt_clic_to_edit""Clic to edit page");
        
define ("txt_edit_this_page""Edit this page");
        
define ("txt_clic_to_see_modifications""Clic to see last page modifications");
        
define ("txt_owner""Owner");
        
define ("txt_edit_acls""Edit ACLs");
        break;
    case  
"fr" :
        
define ("txt_Text_search""RechercheTexte");
        
define ("txt_clic_to_edit""Cliquez pour editer cette page");
        
define ("txt_edit_this_page""&Eacute;ditez cette page");
        
define ("txt_clic_to_see_modifications""Cliquez pour voir les dernières modifications sur cette page");
        
define ("txt_owner""Propri&eacute");
        
define ("txt_edit_acls""&Eacute;diter ACLs");
        break;
    }
?>

<div class="footer">
<?php echo  $this->FormOpen(""txt_Text_search"get");
    echo  
$this->HasAccess("write") ? "<a href=\"".$this->href("edit")."\" title=\"".txt_clic_to_edit."\">".txt_edit_this_page."</a> ::\n" "";
    echo  
$this->GetPageTime() ? "<a href=\"".$this->href("revisions")."\" title=\"".txt_clic_to_see_modifications."\">".$this->GetPageTime()."</a> ::\n" "";
        
// if this page exists
        
if ($this->page)
        {
            
// if owner is current user
            
if ($this->UserIsOwner())
            {
                print 
txt_owner " :: <a href=\"".$this->href("acls")."\">".txt_edit_acls."</a> :: <a href=\"".$this->href("deletepage")."\">Supprimer</a> :: ";
            }
            else
            {
                if (
$owner $this->GetPageOwner())
                {
                    print 
"Propriétaire : ".$this->Format($owner);
                }
                else
                {
                    print(
"Inconnu".($this->GetUser() ? " (<a href=\"".$this->href("claim")."\">Take Ownership</a>)" ""));
                }
                print(
" :: ");
            }
        }
    
?>
    <a href="<?php echo  $this->href("referrers"?>" title="Cliquez pour voir les URLs faisant référence à cette page.">
    References</a> ::
    Recherche : <input name="phrase" size="15" class="searchbox" />
<?php echo  $this->FormClose(); ?>
</div>


<div class="copyright">
<a href="http://validator.w3.org/check/referer">Valid XHTML 1.0</a> ::
<a href="http://jigsaw.w3.org/css-validator/check/referer">Valid CSS</a> ::
-- powered by <?php echo  $this->Link("WakkaWiki:WakkaWiki""""Wakka ".$this->GetWakkaVersion()) . "\n" ?>
</div>


<?php
    
if ($this->GetConfigValue("debug"))
    {
        print(
"<span class=\"debug\"><b>Query log:</b><br />\n");
        foreach (
$this->queryLog as $query)
        {
            print(
$query["query"]." (".$query["time"].")<br />\n");
        }
        print(
"</span>");
    }
?>


</body>
</html>

-- CharlesNepote


References


RomanIvanov said he realised an international version of WakkaWiki.
See, his description page (in russian).
-- CharlesNepote



Thank to Charles for announce.

This page is better now. R2 includes full support for interfaces/actions localization. Site administrator can choose default language and any registered user can change this for himself.

WackoWiki now has 4 translations: Russian, English, German and Dutch. Details can be found on http://wiki.oversite.ru/WackoLocalizations.

And you can see that I trying to integrate changes from WikiNi to WackoWiki. Thank you all for good pieces of code :-)

-- RomanIvanov

http://www.mysql.com/doc/en/Charset-Unicode.html shows that MySql 4.1 is ready for UTF-8, how many hosting company are ready ? (have to check tuxfamily.org and free.fr...) -- BenoitAudouard 20031221
Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]