In order to improve the I18N of Wikka, it could be a good idea to add support for different interface translations. The best way to handle this kind of translations is using gettext which is a mature, widely used (wordpress, phpwiki) localization framework. It is pretty much the defacto standard in the open source/free software realm.

Download
You can download the testing package with gettext support, some directories have been removed in order to reduce the file size.
It should be installed like the normal Wikka, the only additional option in the setup process is the language selection. There are 2 languages available right now: Catalan and English. You can try to install it in catalan to see that the final result is a Wikka site, but in catalan (there are some missing strings).

wikka-1.1.5.3-gettext.tar.gz (140k) Updated on October 6, 2004

Tasks
  1. gettext support -- done
  1. different domains (wikka and wikka-setup) -- done
  1. locale selection from the installer -- done
  1. script to update po files -- done
  1. make strings translatable -- 142 strings so far

Known problems
Hardcoded WikiPages
actions/textsearch.php:22 TextSearchExpand
actions/footer.php:3 TextSearch
actions/usersettings.php:118 MyPages
actions/usersettings.php:119 MyChanges
actions/category.php:8 Category Category

If we want to let users choose their preferred language from usersettings, we can't translate hardcoded WikiPages. These are always the same, since they are on the database and were translated in the setup process. Possible solutions:

Php Gettext, a class that can read directly mo files
At http://savannah.nongnu.org/projects/php-gettext/ , you can find a class consisting of 2 files that can read mo files even if you don't have gettext support installed. It doesn't require anything other than PHP, and its size is absolutely small. I (-- DotMG --) was not a fan of Gettext until I found this class. It is GPL-licensed.

FAQ
How to make strings translatable with gettext?
It is simple, just use the _() or gettext() function.

Example (simple):
<?php
    print(_("Hello Wikka!"));
?>

Example (formatted):
<?php
    $here = $this->Format('[[PasswordForgotten | '._("here").']]');
    printf(_("If you need a temporary password, click %s."), $here);
?>


What do we gain with gettext?

Categories
CategoryDevelopmentI18n
There are 30 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki