Back End:
DropDown Main Menu
The first thing need to take care is the main menu. In the drop down vertical menu, each item accords to one component installed, and each component has one item linking with it in the menu:
We've already explained that the data for this drop down menu is stored in data table '#__components' in MySQL. So if you want to change the text label, just update the corresponding record directly:
We would not waste time here.
Horizental Sub Menu:
That menu is generated by the code in 'admin.joomsport.php':
// Load the submenu.
addSubmenu(JRequest::getCmd('task', 'joomsport'));
function addSubmenu($vName)
{
JSubMenuHelper::addEntry(
JText::_('BLBE_TOURNAMENT'),
'index.php?option=com_joomsport&task=tourn_list',
$vName == 'tourn_list' || $vName == 'tour_edit' || $vName == ''
);
JSubMenuHelper::addEntry(
JText::_('BLBE_SEASON'),
'index.php?option=com_joomsport&task=season_list',
$vName == 'season_list' || $vName == 'season_edit'
);
........
The text 'BLBE_TOURNAMENT' is just a key in some kind of 'language file', which stores key-value pair, and the value of that key will be evaluated in the expression and shown in HTML finally. So, now search for words ‘BLBE_TOURNAMENT’ through out the whole project:
The four highlighten files have the same content, after trying one by one, the file under 'administrator/language/en-GB/' is the right one. Change its content:
BLBE_TT_LASTNAME="Enter Last Name"
BLBE_NICKNAME="Nickname"
BLBE_TT_NICKNAME="Enter Nickname"
BLBE_TOURNAMENT="賽事"
BLBE_TOURNAMENTNAME="Tournament name"
BLBE_SELTOURNAMENT="Select Tournament"
BLBE_TT_SELTOURNAMENT="Select Tournament to assign the Season"
BLBE_SEASON="Season"
BLBE_SEASONNAME="Season name"
Then go the the administration page again:
It's done. Under directory 'administrator/components/com_joomsport/Language', there is one folder named 'BE', it should stand for 'Back End', and the 'FE' should stand for 'Front End'.
Front End
As we know, Joomla! let user has the capability to specify languages for front end and back end separately. And the language for front end is generally designed for end user level. Joomsport takes this issue into account, and it has a panel for that at back end.
But so far we have no idea about where does the language file reside. Change some words in the new created language file and search the words through the project.
But Eclipse return 0 result. Have to change the way of thinking. Take a look at front end firstly:
And, this view is 'ltable' with leyout 'default'. We should go to and open file '/components/com_joomsport/views/ltable/tmpl/default.php'.
<th width="20" class="sort asc" axis="int" id="tblrank_id">
<?php echo $this->bl_lang['BL_TBL_RANK'];?>
</th>
And in '/components/com_joomsport/views/ltable/view.html.php':
class bleagueViewltable extends JView
{
function display($tpl = null)
{
......
require_once(JPATH_ROOT.DS.'components'.DS.'com_joomsport'.DS.'bl_lang.php');
$this->assignRef('bl_lang', $bl_lang);
......
The variable '$bl_lang' should come from 'bl_lang_php'. Open 'bl_lang_php':
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
$db =& JFactory::getDBO();
require_once ( JPATH_ROOT.'/media/bearleague/languages/default.php' );
$query = "SELECT lang_file FROM #__bl_languages WHERE is_default = 1";
$db->setQuery($query);
$lang_file = $db->loadResult();
if ($lang_file)
{
if (preg_match("/[0-9a-z]/", $lang_file))
{
//dumpMessage('reach here in preg');
//$filelink = JPATH_ROOT.'/media/bearleague/languages/'.$lang_file.'.php';
//dump($filelink, 'filelink');
//$ex = file_exists($filelink);
//dump($ex, 'file exist?');
require_once ( JPATH_ROOT.'/media/bearleague/languages/'.$lang_file.'.php' );
}
}
?>
It is a little wierd that put the language file under 'media/../'. This script load the default language file, and then get the language file currently in use, and then load it. The '#__bl_languages' table is:
And put some 'dump' statement to trace the intrim variables, according to the output, that the file 'Traditional Chinese.php' does exist! But why can't find it.
In fact the reason is that Eclipse will not actively, automatically refresh the project, even you close your Eclipse, you need to refresh by yourself mannually.
Localising The Whole Site
At this point, we have localised the joomsport component, but not Joomla! stie yet. It is pretty simple to add language (other than English of course), go to the official site for language package distribution, and download language pack file:
http://joomlacode.org/gf/project/jtranslation/frs/?action=FrsReleaseView&release_id=324
REFS:
http://kb.siteground.com/article/How_to_install_a_new_language_in_Joomla_15.html
http://help.joomla.org/content/view/1651/243/