Quickstart: render one text in two languages
The shortest way from “the plugin is installed” to “one and the same source line reads German on the German page and English on the English one”. Three steps, about ten minutes.
Prerequisites
wki18nis installed and enabled in the Extension Manager.- The wiki is laid out by language: the language is the first namespace of a page id, so
de:wiki:startanden:wiki:start. If your language segment sits deeper, setlangPositionto that index instead of moving every page. - You may create pages.
Step 1: declare the languages
Admin → Configuration, section wki18n:
enabled = 1 languages = de,en defaultLang = de langPosition = 0
languages decides which top-level namespace counts as a language at all. A namespace that is not in this list stays an ordinary namespace, so a page internal:notes is not at risk.
Step 2: create two pages
Create de:wiki:start and en:wiki:start. For now they need no content beyond step 3.
Step 3: write the translated text
Write the same line into both pages:
de:Willkommen|en:Welcome
Whitespace around the pipes is ignored, so de:Willkommen | en:Welcome is equally valid and easier to read.
Check the result
de:wiki:startshows Willkommen,en:wiki:startshows Welcome. One source line, two outputs.- Look at DokuWiki's own labels on the same page — the Edit this page button, the search field, the trace. On the English page they are English too. The plugin sets the interface language from the page; without it an English text would sit inside a German interface.
- Where the current language has no translation, the
defaultLangversion appears — not a blank.
Next step
- wkacmenu — translated menu labels.
- wkopengraph — one preview card serving every language.
- wki18n (German) — the package page: translating configuration values, the forced-language form
…, the helper for your own code.
en/wiki/dwe/wki18n/quickstart.txt · Last modified: by 0.0.0.0