Plugin: wvdsi18n
Version: 1.0.0
Namespace: lib/plugins/wvdsi18n/
Author: Wolfgang van der Stille zeljko.petrusic@outlook.de
License: GPL 2
wvdslang plugin.
Redirect functionality has been moved to the wvdscond plugin (Separation of Concerns).
The wvdsi18n plugin provides internationalization functions for multilingual content:
de:Text|en:TextHome Contact
Loads value from i18n.csv based on current language.
Startseite Home
Forces a specific language, regardless of browser.
de:Ja|en:Yes|sl:Da de:Speichern|en:Save|sl:Shrani
Direct translation without CSV file.
conf:title conf:tagline
Reads DokuWiki configuration with multilingual parsing.
tpl:footerText tpl:topSidebarTitle
Reads template configuration with multilingual parsing.
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 is determined in the following order:
de:start → deAccept-Language: de-DE → de$conf['lang']defaultLang 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) |
===== menu_navigation ===== * [[.:start|Home]] * [[.:docs:index|Project Documentation]] * [[.:contact|Contact]]
Result (browser: en):
<button>de:Absenden|en:Submit|sl:Pošlji</button>
<footer> tpl:footerText </footer>
Languages: [[.:de:start|Startseite]] |
[[.:en:start|Home]] |
[[.:sl:start|Domov]]
Result:
<?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')); } ?>
Old: {{wvds:lang>
New: {{wvds:i18n>
Old: {{wvds:lang:
New: {{wvds:i18n:
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | 2026-01-29 | Initial release (successor to wvdslang) |
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 |
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 |