27. How to add a new language to Book Library, ebook library manager

This article will describe how to add a new language file to the Book Library component for Joomla

Obtaining or creating language files

Many Language files for the Joomla Book Library component (if not already included in the Pro version) can be obtained from the OrdaSoft website. But if your language isn't there yet, you can translate Book Library yourself and add your language. Once you have it, please share it on the OrdaSoft website to help others!

How to translate language variables of Book Library, eBook library manager

If you find your language in language pack of Book Library (and you use free version of BL), to translate component you should:

  1. Download language pack for Book Library
  2. Unzip it, choose needed language and upload it in your_website/components/com_booklibrary/language
  3. Go to Book Library -> Language Manager and click on button Load languages.

Component will be translated to the language of website (if several languages is uploaded).

If you can't find your language in the pack, you can translate component by yourself.

First, find the file called english.php, either in your installation(it located {your site}/components/com_booklibrary/language/) or in the zip archive of the component(it located /site/language/). Or download the latest English language file for Book Library from the Book Library languages section of the website. In the BookLibrary installation it is located in the directory /components/com_booklibrary/language/.

Next, make a copy of english.php and rename it to your own language, for example dutch.php. Now open dutch.php with a text editor which is capable of handling UTF-8. We recommend PSPad if you are on a Windows operating system.

WARNING: All Joomla 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-8before you edit and save your files.

A partial example of what you will see:

* @package BookLibrary
* @copyright Andrey Kvasnevskiy-OrdaSoft( This e-mail address is being protected from spambots. You need JavaScript enabled to view it ); Rob de Cleen( This e-mail address is being protected from spambots. You need JavaScript enabled to view it );
* Homepage: http://www.ordasoft.com
* @version: 3.5 FREE
if (!defined('_VALID_MOS') && !defined('_JEXEC')) die('Direct Access to ' . basename(__FILE__) . ' is not allowed.');
$LangLocal = array('lang_code'=>'en-GB', 'title'=>'English');
$constLang = array();
$constLang[] = array('const'=>'_BOOKLIBRARY_TITLE', 'value_const'=>'BookLibrary');
$constLang[] = array('const'=>'_BOOKLIBRARY_DESC', 'value_const'=>'Our library with suggestions for books for you to enjoy.');
$constLang[] = array('const'=>'_BOOKLIBRARY_SEARCH_DESC1', 'value_const'=>'Search books');

You translate the text portions only, so ONLY the parts between the single quotes (marked with this color).
Language tag should be changed in format xx-XX, see all language tags here

Example translation for Dutch (NL) would look like this:

* @package BookLibrary
* @copyright Andrey Kvasnevskiy-OrdaSoft( This e-mail address is being protected from spambots. You need JavaScript enabled to view it ); Rob de Cleen( This e-mail address is being protected from spambots. You need JavaScript enabled to view it );
* Homepage: http://www.ordasoft.com
* @version: 3.5 FREE
if (!defined('_VALID_MOS') && !defined('_JEXEC')) die('Direct Access to ' . basename(__FILE__) . ' is not allowed.');
$LangLocal = array('lang_code'=>'nl-NL', 'title'=>'Dutch');
$constLang = array();
$constLang[] = array('const'=>'_BOOKLIBRARY_TITLE', 'value_const'=>'BookLibrary');
$constLang[] = array('const'=>'_BOOKLIBRARY_DESC', 'value_const'=>'Onze bibliotheek met suggesties voor boekendie je misschien leuk en nuttig vindt.');
$constLang[] = array('const'=>'_BOOKLIBRARY_SEARCH_DESC1', 'value_const'=>'Boek zoeken');

Continue to translate all language variables in your language.

REMARK: 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 ( ` ) So for example French "l'emprunt" inside a language variable needs to be written "l`imprunt".This is because single quotes are part of the PHP code normally. The ` or back-accent will be ignored by PHP and interpreted as normal text.

Adding your language file to the Joomla Book Library installation

You can either do the operations on the component archive and then re zip and install, or edit the necessary files in place inside an existing installation.

  1. Place your language file inside the directory
    /components/com_booklibrary/language/ using an FTP client or similar(if you are on a shared hosting account, please use internal Joomla FTP or eXplorer or similar to preserve the file ownership).
  2. Please file: /language/en-GB/en-GB.com_booklibrary.sys.ini
    rename and copy to your language
    For example for Dutch, on your site you would add like this:
    Exactly same you will need add for /administrator/language/en-GB/en-GB.com_booklibrary.sys.ini
    or in install archive you will need add it to folder: language, and re zip it.
  3. In the file booklibrary_j3.xml in the directory: /administrator/components/com_booklibrary/ add the language entry for your language.
    This goes right after the entryen-GB/en-GB.com_booklibrary.sys.ini. So if you use for example Dutch and Spanish on your site you would add those, like this:
    You need add this 2 times for admin and frontend parts
  4. To ensure the languages you use are visible inside the dropdown boxes in the administration part for selecting, you will need to add the language entries to every language file in use in your installation. In each language file, find the part marked //Languages and add your language there.
  5. Example:
  6. Save each file.
    Remember to translate the entries according to the language file you are editing. That's it, you're done!
  7. For translate Bool Library menu in admin part, You need in booklibrary_j3.xml - find below code and translate it.
    <menu img="class:dm_component" >Book Library</menu>
    <menu img="class:module" >Books</menu>
    <menu img="class:dm_credits" link="option=com_booklibrary&section=categories">Categories</menu>
    <menu img="class:move" task="lend_requests">Lend Requests</menu>
    <menu img="class:writemess" task="users_lend_history">Users Lend History</menu>
    <menu img="class:writemess" link="option=com_booklibrary&section=language_manager">Language Manager</menu>
    <menu img="class:download" task="show_import_export">Import/Export</menu>
    <menu img="class:config" task="config_frontend">Settings Frontend</menu>
    <menu img="class:config" task="config_backend">Settings Backend</menu>
    <menu img="class:info" task="about">About</menu>
    For add change to menu - you will need reinstall component with new booklibrary_j3.xml Before edit every file, Please backup it.

Sharing your created language files with the community

Once you have a working translation for Book Library ready, please share it on the website to help others! You will receive full credits for your work in the Book Library Languages Section, as well as a link to your website.

Submitting language files for Joomla Book Library can be done in way of attaching the file in a forum post. When submitting your language file, please mention:

  1. version of Book Library the language translation is for
  2. your name as you want it mentioned in the credits
  3. the website you want mentioned in the credits

Thank you in advance for sharing your efforts with the rest of the Book Library users!