Summary: Translator-oriented edit form, easing the internationalization (i18n) of a wiki
Version: 20110907
Prerequisites: PmWiki 2.2.17
Status: Experimental
Maintainer: Petko
Users: (view? / edit)
Discussion: i19-Talk
License: GPL3+ (i19), MIT (unverse.js)


An edit form for translators, easing the internationalization (i18n) of a wiki. The recipe was created for pmwiki.org, in order to help with the translation and maintenance of the documentation in languages other than English. It can be adapted and used for other multi-lingual wikis.

On PmWiki.org a page PmWikiFr.PmWikiPhilosophy is a French translation of the page PmWiki.PmWikiPhilosophy in English. The recipe is automatically enabled for this page. While editing it, an author can switch between the regular edit form and a special interface to compare the original wiki text with the translation, line by line.


  • Copy i19.php to your pmwiki/cookbook/ directory.
  • Create a directory pmwiki/pub/i19 and copy there i19.js and unverse.js.
  • Add to config.php such a line:
    if($action == 'edit') $PostConfig["$FarmD/cookbook/i19.php"] = 200;


The array $SourceNamePatterns contains the replacement rules needed to "guess" the original page name from the current page name. The default setting is this (used on PmWiki.org):

  $SourceNamePatterns = array(
    '/^(PmWiki|Cookbook)(\\w\\w|\\w\\w\\w\\w)\\.\\1\\2$/'=> '$1.$1',
    '/^(PmWiki|Cookbook)(\\w\\w|\\w\\w\\w\\w)(\\..*)$/'    => '$1$3'

In the example, the first rule says that the "source" for a Group HomePage like PmWikiFr.PmWikiFr will be PmWiki.PmWiki ; the second rule says that the "source" for a page like PmWikiFr.Installation will be PmWiki.Installation. The rules are Regular expressions, if you need assistance creating your own, ask on the talk page.


The recipe will only be enabled if an "original" pagename can be guessed, and if such page exists. First, the normal edit form is displayed, with a link "Translate" over the right border of the main text area. This link switches on/off the translation interface.

The normal edit form, click on 'Translate'.

The translation interface contains two smaller text areas, the first with a line from the original page, the second with the same line from the translation, that is the currently edited page.

The translator interface.

Between the text areas, a number of buttons help manipulating the display and the translation:

  • with < and > you can open for editing the previous and next lines; alternatively you can use the keyboard shortcuts Ctrl+UpArrow and Ctrl+DownArrow
  • with ↑↑↑ and ↓↓↓ you can Shift up or down the translation lines in case an additional line breaks the alignment after it
  • with ++ you can join to the current line the line that follows; to break a line in two, just press Enter: the part after the Enter will become a new line
  • the button "Edit source" opens the original source page for editing in an overlaid window, without leaving your translation; saving the source page automatically updates the source text in the translation interface.

You can switch between the translation interface and the normal edit form; you can use the Summary line, the buttons "Preview", "Save and edit", "Cancel", exactly like in the normal wiki editing.

Demo: the recipe is enabled for the documentation on PmWiki.org, edit any page in a non-English wiki group.


  • The recipe is experimental, if we find easier and more intuitive ways to translate a wiki, we can change it.
  • Authors need recent browsers with JavaScript enabled.

Change log / Release notes

  • 20110907 minor fixes
  • 20110905 first release, ready to be tested

See also


Recipe written by Petko, includes the library UnverseJS.


See discussion at i19-Talk

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.