DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:translator

Translator Plugin

Compatible with DokuWiki

2009-07-30

plugin MySQL based translation tool

Last updated on
2011-01-07
Provides
Syntax, Admin, Action

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with database, language, mysql

:!: This plugin requires Database Connector Plugin.

Download and Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Documentation

Translator — Manage your project translations

The Translator plugin helps developers to create translations for multi-language setups of their programs. The data is completely stored in a MySQL Database.

You simply translate the same values (key and value have to be exactly the same on import) only once to have them updated in other categories.

Translators can display all, not translated and translated values to concentrate on either currently empty values or (spell) checking existing values.

The input of the language files must have the following format:

# Key = Value
# e.g.

dialog.OK = OK
dialog.Cancel = Cancel
$data['create'] = Create new Page

Configuration

You will have to edit some settings in the DokuWiki Configuration Manager in order to use the translator. Here you can define the “Master Language” – which is English by default. You can also enter the connection data to your database system containing the translation data.

Prequisite: you need an MySQL database up and running and your PHP has to have the mysqli extension. You'll need to create a database prior to using the plugin.

Administration

User

After having set up the database connection you can access the administration GUI for the translator plugin (from the admin menu) and add translation rights to your users. The List will display all users in your DokuWiki together with an input field where you can add language shortcuts which will be used as identifiers for the languages, e.g. de|es|it.

Hit update to save your changes.

Categories

Next you'll want to create categories. A category consists of a unique identifier and a file pattern with the shortcut ”[LANG]” within the name, which will be replaced with the language abbreviations. Later on, the system checks if imported files really belong to a category by matching the file to the pattern.

For example:

  • Pattern: LanguageResources[LANG].properties
  • You can import files with:
    • LanguageResources.properties (this is the Master Language)
    • LanguageResources_en.properties (also the Master Language if set to en)
    • LanguageResources_de.properties (Language is de)
    • LanguageResources_zh_CN.properties (Language is zh_CN)

Import

When you create your first category the admin page offers a new fieldset with an upload form. There you can choose a category, as well as insert the version you want to create (this version is only needed for a Master Language) and upload the files.

Hint: If you have a modern browser supporting HTML5 (e.g Safari 4+ or the latest Chrome editions), you can select multiple files to be imported at once.

Export

The Export Manager offers all categories and available languages of the system. Hitting the export button downloads a language file where the filename is matches the category pattern.

Syntax

The following syntax code has to be inserted into the page that you want to have the public translator. It will display the status of the current translations and the translation matrix for users who are logged in and have the right to edit a translation.

~~TRANSLATOR~~
plugin/translator.txt · Last modified: 2018-06-06 00:16 by Klap-in