21. How to add a new language to MediaLibrary 3.5.x Shop

This article will describe how MediaLibrary 3.5.x handles languages and how to add a new language file to the MediaLibrary 3.5.x component for Joomla 3.6.x.

MediaLibrary 3.5.x Shop and language behavior

The MediaLibrary 3.5.x Shop component for Joomla comes with full language support: English, German, French, Dutch, Russian and Spanish language files. What does this mean?

  • All MediaLibrary language variables are stored in one file.
  • That file can be translated to add other languages.
  • Once you have put a language file into MediaLibrary, the language chosen as default in Joomla will be picked up by MediaLibrary automatically.
  • On multilingual sites with JoomFish, MediaLibrary will pick the chosen language up in the frontend automatically.

Yes, we know... the current language files in MediaLibrary 3.5.x Shop are done the "old fashioned" way, as it used to be in Joomla 1.0.x. Later Joomla 1.5.x uses translations through .ini files, split between admin area and frontend area.

The reason we kept the old way for now is because it gives us less problems maintaining different translation methods for the two Joomla versions.

Obtaining or creating language files

A lot of Language files for the MediaLibrary 3.5.x Shop component (if they are not included in the Shop version) can be obtained from the website. But if your language isn't there yet, you can translate MediaLibrary by yourself and add it. Once you have it, please share it on the website to help others!

How to translate MediaLibrary language variables

First, find the file english.php in your installation or in the zip archive of the component. Or download the latest English language file for MediaLibrary 3.5.x Shop from the MediaLibrary languages section of the website. It is located in the directory /components/com_medialibrary/language/ of the MediaLibrary installation . Next, make a copy of english.php and rename it to your own language, for example dutch.php. Now open dutch.php by the text editor which is capable to handle UTF-8. We recommend PSPad if you use a Windows OS.

All Joomla 3.x files need to be saved as UTF-8. WordPad or Notepad can NOT handle UTF-8, so they are NOT FIT to create or edit these files with!

Try PSPad instead (http://www.pspad.com/) and set it under [Format] to UTF-8 before you edit and save your files. A partial example of what you will see:



* @package MediaLibrary

* @copyright 2008 Andrey Kvasnevskiy-OrdaSoft

* Homepage: http://www.ordasoft.com/

* @version: 3.5 Shop $

* English Language File (EN) - UTF-8


// components/com_MediaLibrary


DEFINE('_MediaLibrary_DESC','Our library with suggestions for Medias for you to enjoy.');

DEFINE('_MediaLibrary_SEARCH_DESC1', 'Search Medias');

DEFINE('_MediaLibrary_SEARCH_DESC2', 'Search Medias');

DEFINE('_MediaLibrary_SUBMIT_Media','Submit a Media');

DEFINE('_Media_EXIST','There is already a Media with that ISBN/ASIN.');


You translate the text parts only, ONLY the parts between the single quotes. Example translation for Dutch (NL) would look like this:



* @package MediaLibrary

* @copyright 2008 Andrey Kvasnevskiy-OrdaSoft, Rob de Cleen

* Homepage: http://www.ordasoft.com/

* @version: 3.5 Shop $

* Dutch Language File (NL) - UTF8

* Dutch translation by Rob de Cleen


// components/com_MediaLibrary


DEFINE('_MediaLibrary_DESC','Onze bibliotheek met suggesties voor boeken die je misschien leuk en nuttig vindt.');

DEFINE('_MediaLibrary_SEARCH_DESC1', 'Boek zoeken');

DEFINE('_MediaLibrary_SEARCH_DESC2', 'Boek zoeken');

DEFINE('_MediaLibrary_SUBMIT_Media','Boek inbrengen');

DEFINE('_Media_EXIST','Er is al een boek met dat ISBN/ASIN.');


Continue to translate all language variables in your language.

When you run the language file you will see row: $LangLocal = array('lang_code'=>'nl-NL', 'title'=>'Dutch'); so lang_code - must be exactly as use joomla for your lang, in this case for Dutch language and for dutch.php file!

You can use accented letters and special characters like é, ô, ü, ç, ñ, ¿. ©, ß etc inside the files, with ONE exception: you cannot use single quotes inside the language variables.
Please replace all single quotes ( ' ) with back-accents ( ` ). For example French "l'emprunt" inside a language variable needs to be written "l`imprunt" because single quotes are part of the PHP code normally. The back-accent will be ignored by PHP and interpreted as normal text.

Adding your language file to the MediaLibrary installation

You can do the operations on the component archive and then rezip and install, or edit the necessary files inside an existing installation.

  • Put your language file inside the directory /components/com_MediaLibrary/language/ using an FTP client or similar (if you are in a shared hosting account, please use internal Joomla FTP or QuiXplorer or similar to preserve the file ownership).
  • Add the language entry for your language to the file MediaLibrary.xml, which is in the directory /components/com_MediaLibrary/. This goes right after the entry language/english.php. So if you use for example Dutch and Spanish on your site you would add these:
  • To ensure that the languages you use are visible inside the dropdown boxes in the administration part for selecting, you need to add the language entries to every language file useв in your installation. Find the part marked //Languages in each language file and add your language there.
    DEFINE('_MediaLibrary_LANGUAGE_NOT_USED', 'Not specified');
    DEFINE('_MediaLibrary_LANGUAGE_ENG', 'English');
    DEFINE('_MediaLibrary_LANGUAGE_DUT', 'Dutch');
    DEFINE('_MediaLibrary_LANGUAGE_GER', 'German');
    DEFINE('_MediaLibrary_LANGUAGE_FRE', 'French');
    DEFINE('_MediaLibrary_LANGUAGE_ITA', 'Italian');
    DEFINE('_MediaLibrary_LANGUAGE_SPA', 'Spanish');
  • Save each file. Remember to translate the entries according to the language file you are editing. That's it, you're done!

Sharing your created language files with the community
Once you have a working translation for MediaLibrary 3.5.x Shop ready, please share it on the website to help others! You will receive full credits for your work in the MediaLibrary Languages Section and a link to your website.

Submitting language files for MediaLibrary can be done in two ways by registered users:

  • You can upload your language file from User Menu -> Upload file.
  • You can attach the file in a forum post

When submitting your language file, please mention:

  • Version of MediaLibrary for the language translation
  • Your name is mentioned in the credits as you want it
  • The website you want mentioned in the credits

Thanks a lot for sharing your efforts with the rest of the MediaLibrary users!