DokuWiki is capable of making a multil language site. This functionality is not installed in new DokuWiki installations by default. In order to get the multi language functionality to work, you will need to use the “Multilingual Plugin“.
The “Multilingual Plugin” does not translate your pages into a language. The plugin makes namespaces particular to the language so pages can be created in a specific language namespace. This plugin is completely different than changing the admin interface language. For information on how to change teh admin interface language in DokuWiki, please click here.
When the namespaces are created, different links are placed in your site that allow visitors to switch to a different language version of your site. The following steps will explain how to use the “Multilingual Plugin” for DokuWiki.
Important! This tutorial is based off of the “DokuWiki” theme. If you are editing a different theme, the location where you place the code may change.
Steps to install the Multilingual Plugin
Go to the following link and get the link for the plugin.
https://www.dokuwiki.org/plugin:multilingual
Unless the version changes, you should have a link like the following:
https://snorriheim.dnsdojo.com/redmine/attachments/download/29/multilingual-1.0.1.tar.gz
Log into DokuWiki. Go to Admin > Manage Plugins. Paste the URL in the “Download and Install a new plugin” box.
Click Download.
Create a file called “show_languages.html” on your server in the following location of your DokuWiki installation directory:
/lib/tpl/dokuwiki
Add the following code in the “show_languages.html” file:
<?php $multi_lingual_plugin = &plugin_load('syntax','multilingual');
if ( $multi_lingual_plugin ) {
if ( !plugin_isdisabled($multi_lingual_plugin->getPluginName() ) ) {
print $multi_lingual_plugin->_showTranslations(); } } ?>
Save the file.Next, edit your
lib/tpl/dokuwiki/tpl_header.php
. Add the following code towards the end of the file before the<hr class="ally" />
.
<div style="float:left;"><?php @include(dirname(__FILE__).'/show_languages.html')?></div>
Your file should look like the image to the right.Save the changes.
Go back to your DokuWiki admin section and select Configuration Settings. Scroll towards the bottom and you will see the configuration settings for the multilingual plugin. In the first box that says “plugin»multilingual»enabled_langs“, enter the languages you want separated by commas. See the image to the right.
Note! For a list of language codes, see the article on Language code list for PHP programs. Not all languages work with DokuWiki. Unfortunately, there is no list of language codes that work specific with DokuWiki. You will need to trial and error on languages that are not as common.
When finished, click save at the bottom of the page.
Now when you go to your home DokuWiki page, The language options will show as links towards the top left of your site. Each language has its own namespace created. When clicking the links they will take you to the language namespace. For example, German will have the
de:start
namespace.
For information on changing the administrator interface language in DokuWiki, please see our tutorial on How to change the DokuWiki admin language.