Commit 03ff102a authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Language-ifying the strings in the primary school theme (Bug 1362871)



Currently there is no way for themes to come with their own language
files - but sometimes a theme may have some text it wants to display
that is unique to that theme - like when it has a homeinfo.tpl file

I've added the checks to the lang path for checking a theme's lang file

To use it in a template you need to indicate the section is a theme by
going:

{str tag=stringtoget section=theme.nameoftheme}

and this will look for the lang file in:
./theme/nameoftheme/lang/langtype/nameoftheme.php

Change-Id: I16d5273ee94ad2c066f7de5922253edde325fbed
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent a0e5a33a
......@@ -468,21 +468,28 @@ function get_string_location($identifier, $section, $variables, $replacefunc='fo
$langdirectory = 'lang/';
}
else {
$extras = plugin_types(); // more later..
foreach ($extras as $tocheck) {
if (strpos($section, $tocheck . '.') === 0) {
$pluginname = substr($section ,strlen($tocheck) + 1);
if ($tocheck == 'blocktype' &&
strpos($pluginname, '/') !== false) { // it belongs to an artefact plugin
$bits = explode('/', $pluginname);
$langdirectory = 'artefact/' . $bits[0] . '/blocktype/' . $bits[1] . '/lang/';
$section = 'blocktype.' . $bits[1];
}
else {
$langdirectory = $tocheck . '/' . $pluginname . '/lang/';
if (false === strpos($section, 'theme.')) {
$extras = plugin_types(); // more later..
foreach ($extras as $tocheck) {
if (strpos($section, $tocheck . '.') === 0) {
$pluginname = substr($section ,strlen($tocheck) + 1);
if ($tocheck == 'blocktype' &&
strpos($pluginname, '/') !== false) { // it belongs to an artefact plugin
$bits = explode('/', $pluginname);
$langdirectory = 'artefact/' . $bits[0] . '/blocktype/' . $bits[1] . '/lang/';
$section = 'blocktype.' . $bits[1];
}
else {
$langdirectory = $tocheck . '/' . $pluginname . '/lang/';
}
}
}
}
else {
$bits = explode('.', $section);
$langdirectory = 'theme/' . $bits[1] . '/lang/';
$section = $bits[1];
}
}
// First check all the normal locations for the string in the current language
......
<?php
/**
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
defined('INTERNAL') || die();
$string['findfriends'] = 'Find friends';
$string['mygroups'] = 'My groups';
$string['updateprofile'] = 'Update profile';
$string['discuss'] = 'Discuss';
$string['uploadfiles'] = 'Upload files';
$string['createpages'] = 'Create pages';
$string['writejournal'] = 'Write a journal entry';
$string['sharepages'] = 'Share pages';
$string['logintoexplore'] = 'Login to explore!';
$string['clickonactivity'] = 'Click on an activity above';
\ No newline at end of file
......@@ -2,20 +2,20 @@
<div id="home-info" class="home-info-table{if $USER->is_logged_in()} loggedin{/if}">
<div id="homebox">
{if $USER->is_logged_in()}
<div class="btn-findfriends"><a href="{$WWWROOT}user/find.php" alt="Find Friends">Find Friends</a></div>
<div class="btn-mygroups"><a href="{$WWWROOT}group/mygroups.php" alt="My Groups">My Groups</a></div>
<div class="btn-updateprofile"><a href="{$WWWROOT}artefact/internal/index.php" alt="Update Profile">Update Profile</a></div>
<div class="btn-discuss"><a href="{$WWWROOT}group/topics.php" alt="Discuss">Discuss</a></div>
<div class="btn-uploadfiles"><a href="{$WWWROOT}artefact/file/index.php" alt="Upload Files">Upload Files</a></div>
<div class="btn-createpages"><a href="{$WWWROOT}view/index.php" alt="Create Pages">Create Pages</a></div>
<div class="btn-writejournal"><a href="{$WWWROOT}artefact/blog/index.php" alt="Write Journal">Write Journal</a></div>
<div class="btn-sharepages"><a href="{$WWWROOT}view/share.php" alt="Share Pages">Share Pages</a></div>
<div class="btn-findfriends"><a href="{$WWWROOT}user/find.php" alt="{str tag="findfriends" section="theme.primaryschool"}">{str tag="findfriends" section="theme.primaryschool"}</a></div>
<div class="btn-mygroups"><a href="{$WWWROOT}group/mygroups.php" alt="{str tag="mygroups" section="theme.primaryschool"}">{str tag="mygroups" section="theme.primaryschool"}</a></div>
<div class="btn-updateprofile"><a href="{$WWWROOT}artefact/internal/index.php" alt="{str tag="updateprofile" section="theme.primaryschool"}">{str tag="updateprofile" section="theme.primaryschool"}</a></div>
<div class="btn-discuss"><a href="{$WWWROOT}group/topics.php" alt="{str tag="discuss" section="theme.primaryschool"}">{str tag="discuss" section="theme.primaryschool"}</a></div>
<div class="btn-uploadfiles"><a href="{$WWWROOT}artefact/file/index.php" alt="{str tag="uploadfiles" section="theme.primaryschool"}">{str tag="uploadfiles" section="theme.primaryschool"}</a></div>
<div class="btn-createpages"><a href="{$WWWROOT}view/index.php" alt="{str tag="createpages" section="theme.primaryschool"}">{str tag="createpages" section="theme.primaryschool"}</a></div>
<div class="btn-writejournal"><a href="{$WWWROOT}artefact/blog/index.php" alt="{str tag="writejournal" section="theme.primaryschool"}">{str tag="writejournal" section="theme.primaryschool"}</a></div>
<div class="btn-sharepages"><a href="{$WWWROOT}view/share.php" alt="{str tag="sharepages" section="theme.primaryschool"}">{str tag="sharepages" section="theme.primaryschool"}</a></div>
{else}
<div class="btn-logintoexplore">Login to explore!</div>
<div class="btn-logintoexplore">{str tag="logintoexplore" section="theme.primaryschool"}</div>
{/if}
</div>
</div>
{if $USER->is_logged_in()}<p>Click on an activity above</p>
{if $USER->is_logged_in()}<p>{str tag="clickonactivity" section="theme.primaryschool"}</p>
{/if}
<div class="cb"></div>
</div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment