WvdS.DokuWiki.i18n Plugin

Plugin: wvdsi18n
Version: 1.0.0
Namespace: lib/plugins/wvdsi18n/
Author: Wolfgang van der Stille zeljko.petrusic@outlook.de
License: GPL 2


Migration from wvdslang: This plugin replaces the old wvdslang plugin. Redirect functionality has been moved to the wvdscond plugin (Separation of Concerns).

Definition

The wvdsi18n plugin provides internationalization functions for multilingual content:

  • Translation keys - From CSV file
  • Inline translations - de:Text|en:Text
  • Config values - With multilingual parsing
  • Template values - With multilingual parsing

Use Cases

  • Multilingual navigation - Menu texts in different languages
  • Translatable UI elements - Buttons, labels, notices
  • Template integrations - Sidebar, footer, header
  • Centralized translations - All texts in one CSV file

Syntax

Translation Key

Home
Contact

Loads value from i18n.csv based on current language.

Explicit Language

Startseite
Home

Forces a specific language, regardless of browser.

Inline Translation

de:Ja|en:Yes|sl:Da
de:Speichern|en:Save|sl:Shrani

Direct translation without CSV file.

Config Value

conf:title
conf:tagline

Reads DokuWiki configuration with multilingual parsing.

Template Config

tpl:footerText
tpl:topSidebarTitle

Reads template configuration with multilingual parsing.


CSV Format

Translations are stored in lib/plugins/wvdsi18n/i18n.csv:

key,de,en,sl,it,hr
menu_home,Startseite,Home,Domov,Home,Početna
menu_contact,Kontakt,Contact,Kontakt,Contatto,Kontakt
button_save,Speichern,Save,Shrani,Salva,Spremi
Column Description
key Unique key
de German translation
en English translation
Additional languages

Language Detection

Language is determined in the following order:

  1. Namespace path - de:start → de
  2. Browser header - Accept-Language: de-DE → de
  3. DokuWiki language - $conf['lang']
  4. Plugin default - defaultLang configuration

Configuration

Option Default Description
enabled 1 Enable plugin
languages de,en,sl,it,hr Available languages
defaultLang en Default language (fallback)
langPosition 0 Language position in namespace (0 = first level)

Examples

Example 1: Navigation

===== menu_navigation =====
  * [[.:start|Home]]
  * [[.:docs:index|Project Documentation]]
  * [[.:contact|Contact]]

Result (browser: en):

  • Home
  • Documentation
  • Contact

Example 2: Inline in Buttons

<button>de:Absenden|en:Submit|sl:Pošlji</button>

Example 3: Footer with Template Config

<footer>
tpl:footerText
</footer>
Languages: [[.:de:start|Startseite]] |
           [[.:en:start|Home]] |
           [[.:sl:start|Domov]]

Result:

  • Languages: Startseite | Home | Domov

Integration in Templates

PHP Usage

<?php
// Load helper
$helper = plugin_load('helper', 'wvdsi18n');
 
if ($helper) {
    // Get translation
    echo hsc($helper->get('menu_home'));
 
    // Explicit language
    echo hsc($helper->get('menu_home', 'en'));
 
    // Parse inline
    echo hsc($helper->parseMultilang('de:Ja|en:Yes'));
 
    // Template config
    echo hsc($helper->getTplConfig('footerText'));
}
?>

Migration from wvdslang

Old (wvdslang) New (wvdsi18n) Status
lang_key key Syntax changed
de_key key Syntax changed
en:Y Y Syntax changed
redirect redirect Moved to wvdscond

Search and Replace

Old: {{wvds:lang>
New: {{wvds:i18n>

Old: {{wvds:lang:
New: {{wvds:i18n:

Version Notes

Version Date Changes
1.0.0 2026-01-29 Initial release (successor to wvdslang)

See Also


Technical Reference

Class: syntax_plugin_wvdsi18n

File: lib/plugins/wvdsi18n/syntax.php

Method Description
getType() Returns substition
getSort() Returns 100
connectTo($mode) Registers i18n patterns
handle($match, …) Parses syntax and extracts content
render($mode, …) Returns translated text

Class: helper_plugin_wvdsi18n

File: lib/plugins/wvdsi18n/helper.php

Method Description
get($key, $lang) Gets translation for key
parseMultilang($value, $lang) Parses de:X|en:Y format
getConfig($key, $lang) Gets DokuWiki config with parsing
getTplConfig($key, $lang) Gets template config with parsing
detectLanguage() Detects current language
getLanguages() Returns configured languages

wvdsi18n PluginAudit bestanden • 2026-03-30

Diskussion

Geben Sie Ihren Kommentar ein. Wiki-Syntax ist zugelassen:
 
Zuletzt geändert: on 2026/01/29 at 07:52 PM