Dolphin Languages
New language creation
This manual is for Dolphin 7.0.x.
The manual for Dolphin 6 is available here
Translating newly installed Dolphin sites
To translate Dolphin's language file you need to:
- Install the latest Dolphin
- Uninstall all available modules from Dolphin Admin Panel -> Tools -> Modules
- Go to the Dolphin administration panel -> Settings -> Languages Settings. In the 'Language Files' block you need to export the necessary language file by clicking the 'Export' link.
- The downloaded file will have the following structure
<?php $aLangInfo=array ( 'Name' => 'en', 'Flag' => 'gb', 'Title' => 'English', ); $aLangContent=array ( '_add' => 'add', '_bottom_text' => '2002-{0}. Product of <a class="bottom_text" href="http://www.boonex.com/">BoonEx Group</a>.', '_copyright' => 'Copyright © {0} Your Company.', 'test_key' => 'Key\'s string', ... ); ?>
- You need to change the 'Name', 'Flag' and 'Title' in accordance with the language you are translating to. Note. You need to use International Language Codes for 'Name' and 'Flag'. You may read more about this using the following link http://www.boonex.com/unity/txt/extension_requirements#LanguageFiles7
- If you use the (') sign in the language string you need to escape it by replacing it with (\'). Take a look at the example above -> 'test_key' language key.
- It is necessary that you open and save this file in UTF-8 format. Otherwise non-latin symbols will not be correctly displayed.
- It exports only the system language file, but not modules language files, which are translated a bit differently.
- Translate the language file in each module located in modules/boonex/*/install/langs/en.php. The Forum has 2 language files - first in the regular location and another one in the modules\boonex\forum\integrations\base\langs\en.php. Use the same language code for translated files like in the 'Name' field in the system language file.
- Put all translated files in a folder with all modules structure and exported system language in the root of the folder. The name of the folder must be named with the vendor name, language name and version of the translation. So it may look like this:
Org-Russian-v.1.3 modules boonex ads install langs ru.php articles install langs ru.php ... forum install langs ru.php integrations base langs ru.php ... wall install langs ru.php lang-ru.php readme.txt
Don't forget to put a readme.txt file into the archive with language file info, compatibility with Dolphin and installation instructions. Pack the resulting folder in a zip archive.
Installation instructions
- Unpack the zip archive
- Go to the Dolphin Admin Panel -> Settings -> Languages Settings, and in the Create New block switch tabs to Import. Browse for your system language file (in the root of this folder, like lang-ru.php) and click Import. If everything is OK, you should see the new language in the Language Files block.
- Copy the whole modules directory from the folder you created it in (in our example it's the folder Org-Russian-v.1.3) to your dolphin root directory - it will create the language file in each module.
- Go to the Dolphin Admin Panel -> Tools -> Modules, and scroll down to the Installed Modules block. Select all modules and click the Recompile Language(s) button.
- Go to the Modules -> Orca Forum, click [L[Compile Lang:]]ru link to compile new language file specifically for orca forum.
Translating sites with existing members and content
If you want to translate a site which already has registered members who added some content, it will be dangerous for your site to un-install modules to translate them.
In this case, you should act a little bit differently.
NOTE: Only the default language keys will get translated. If you added any language keys after installation, you will get them un-translated.
- Extract the default language file from the original Dolphin package.
The file's location in the archive is install/langs/lang-en.php.
Translate this file in a UTF-8 format. This program will be very useful for you to edit your files created in many encodings and convert them to UTF-8 (Encoding -> Convert to UTF-8 without BOM).
- The steps 4-6 of the previous Translating newly installed Dolphin sites instructions should be repeated right in the way they were written above.
Translating splash block
This manual is for Dolphin 7.1.x.
To translate the splash block, you'll need to make some code changes. These changes will affect only your current template while the base template will remain intact.
- So, navigate to Admin Panel -> Settings -> Basic Settings -> Splash.
- Edit the HTML code so the text you wish to translate would have underscores before it (to make sure you won't translate anything you don't want to). For example: _Join, _Login, _Welcome to the community!
- Open the file templates/base/scripts/BxBaseFunctions.php and copy the signature and body of the function genSiteSplash:
function genSiteSplash() { $sVisibility = getParam('splash_visibility'); $bLogged = getParam('splash_logged') == 'on'; if($sVisibility == BX_DOL_SPLASH_VIS_DISABLE || ($sVisibility == BX_DOL_SPLASH_VIS_INDEX && !defined('BX_INDEX_PAGE')) || ($bLogged && isLogged())) return ''; return DesignBoxContent('', getParam('splash_code'), 3); }
Open the file templates/YOUR_TMPL_NAME/scripts/BxTemplFunctions.php (where YOUR_TMPL_FOLDER is the folder of your current template, for example tmpl_alt).
Paste the copied code after:
function BxTemplFunctions() { parent::BxBaseFunctions(); }
Modify the pasted code this way:
function genSiteSplash() { $sVisibility = getParam('splash_visibility'); $bLogged = getParam('splash_logged') == 'on'; if($sVisibility == BX_DOL_SPLASH_VIS_DISABLE || ($sVisibility == BX_DOL_SPLASH_VIS_INDEX && !defined('BX_INDEX_PAGE')) || ($bLogged && isLogged())) return ''; $result = str_replace('_Join', _t('_Join'), getParam('splash_code')); $result = str_replace('_Login', _t('_Login'), $result); $result = str_replace('_Welcome to the community!', _t('_Welcome to the community!'), $result); return DesignBoxContent('', $result, 3); }
Save the file.
- Now you only need to make sure that the language keys _Join, _Login and _Welcome to the community! exist in the database. Navigate to Admin Panel -> Settings -> Language Settings -> enter the name of the key in the field Filter, click Apply. If the key doesn't exist, create it clicking Add Key.
The keys _Join and _Login are already present in the database. The key _Welcome to the community! should be created.