How to make your plugin translatable

Create an xml file with your strings

Admidio uses for translations the Android string resource. This is a very compact xml format that should contain every string you use in your plugin.

The format looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <string name="UNIQUE_IDENTIFIER">Your string</string>
</resources>

Therefore each string contains a unique identifier. Use for your strings a prefix that belong to your plugin e.g. PLG_MY_PLUGIN and then a short text that refers to your string. So for example if you want an identifier for House then you got PLG_MY_PLUGIN_HOUSE.

So your file may look like this:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <string name="PLG_MY_PLUGIN_HOUSE">House</string>
    <string name="PLG_MY_PLUGIN_DOG">Dog</string>
    <string name="PLG_MY_PLUGIN_LONG_TEXT">This is a very long text where it's not possible to get a good identifier.</string>
</resources>

Now create a folder called languages within your plugin folder and save this file with the ISO code of the language that you have used in your plugin. The you will find the supported languages and their ISO codes within the folder adm_program/languages/languages.xml. :!: It's not possible to use a language within your plugin that is not supported by Admidio.

You may now have the following file in your plugin folder plugin_folder/languages/en.xml.

For more information about the language file itself have a look at this documentation.

Use language files within your plugin

Also in Plugins own language files can be integrated and accessed to existing Admidio language files. Access to the Admidio language files is done relatively easily over the already used syntax in Admidio itself.

$gL10n->get('SYS_ALL')


If someone wants to use new unused texts in the plugin, so it must be created an own language file for the plugin. For this, a folder is created in the plugin folder languages, where then a newly language file is to be created ,example de.xml. The structure of this language file must match from the section XML language file. This new folder will be made known via the following call at the beginning of the plugin:

$gL10n->addLanguagePath(PLUGIN_PATH '/'.$ plugin_folder.'/languages/');

Now, using the familiar syntax texts from these language files of plugins are accessible. There is no special adaptation necessary.

$gL10n->get('PLG_LOGIN_ACTIVE_SINCE')

Find translators for your language file

Now that you have created a language file it's possible to translate these strings to several other languages. You can do that by yourself or search for people who will do this but it's also possible to add your file to the Admidio Project at Transifex. We have already people who translate Admidio into another language and maybe they could also translate the strings of your plugin.

  • en/entwickler/how_to_make_your_plugin_translatable.txt
  • Last modified: 2016/12/03 15:17
  • by ximex