# Making plugins translatable

Author | Timo A. Hummel
Created | 5th November 2003
Audience | Plugin Developers
Applies to | Contenido 4.4 or later

## The plugin's configuration

If your plugin has actions which needs to be translatable (of course :)), you need a plugin configuration file.
This file needs to be placed in the "includes"-Directory of your plugin and needs to be named config.plugin.php.
Example:
<?php
/* Config file for the TEST plugin */
$lngAct["test_dosomething"] = i18n("Does something useful", "test");
?>
Note that the plugin developer doesn't need to take care of the i18n domain binding; all that is done during initialisation.

## Letting Contenido know about foreign "domains"

A "domain" in terms of the GNU gettext library defines in which path a specific translation can be found. For plugins, the domain is automatically set to the plugin's directory. All you need to do is to create a directory structure similar to Contenido's locale directory, and place .po files in it (note: The .po-Files need to be named like your plugin's name and plugin directory, e.g. the plugin "test" should reside in the directory "test" and the .po-Files have to be named "test.po").

## Translating plugins

To create a translated string in the plugin itself, you need to use i18n("TEXT","<DOMAIN>");. In the example above, we would write i18n("TEXT","test");. Note that domain names are case sensitive.

## Where's the magic?

Originally, the "magic" (including the plugin's configuration and i18n domain bindings) took place in the file config.php. As config.php is included even if we don't have a backend language (in fact, the information about the backend language is never available in the config file), the magic happens in cfg_language_de.inc.php. This is the only place where the proper initialisation of the plugin's config.plugin.php file can be guaranteed.