Project

General

Profile

« Previous | Next » 

Revision 1926

Added by darkviper over 11 years ago

TranslateAdaptorWbOldStyle now also accepts modified admin directory names

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
10 Jun-2013 Build 1926 Werner v.d.Decken(DarkViper)
15
! TranslateAdaptorWbOldStyle now also accepts modified admin directory names
14 16
09 Jun-2013 Build 1925 Werner v.d.Decken(DarkViper)
15 17
! set default rights to dissabled for new installed modules
16 18
08 Jun-2013 Build 1924 Werner v.d.Decken(DarkViper)
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1925');
54
if(!defined('REVISION')) define('REVISION', '1926');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/TranslateAdaptorWbOldStyle.php
45 45
	{
46 46
		$this->sAddon = $sAddon;
47 47
		$this->sFilePath = str_replace('\\', '/', dirname(dirname(__FILE__)).'/'.$sAddon);
48
		$this->sFilePath = rtrim($this->sFilePath, '/').'/languages/';
49 48
	}
50 49
/**
51 50
 * Load languagefile
......
54 53
 */
55 54
	public function loadLanguage($sLangCode)
56 55
	{
56
		$this->_getAddonPath();
57 57
		$aTranslations = array();
58 58
		$sLangFile = strtolower($sLangCode.'.php');
59 59
		if( ($aDirContent = scandir($this->sFilePath)) !== false) {
......
76 76
 */
77 77
	public function findFirstLanguage()
78 78
	{
79
		$this->_getAddonPath();
79 80
	// search for first available and readable language file
80 81
		$sRetval = '';
81 82
		if(is_readable($this->sFilePath)) {
......
92 93
		return $sRetval;
93 94
	}
94 95
/**
96
 * set path to translation files
97
 * @throws TranslationException
98
 */
99
	private function _getAddonPath()
100
	{
101
		$sAddon   = str_replace('\\', '/', $this->sAddon);
102
		$sDirname = str_replace('\\', '/', dirname(dirname(__FILE__))).'/';
103
		$this->sFilePath = $sDirname.$sAddon.'/languages/';
104
		if(!is_readable($this->sFilePath) && (strpos('admin', $this->sAddon) === 0)) {
105
		// correct modified admin directory
106
			$sTmp = trim(WbAdaptor::getInstance()->AcpDir);
107
			$this->sFilePath = $sDirname.preg_replace('/^admin/', $sTmp, $sAddon).'/languages/';
108
			if(!is_readable($this->sFilePath)) {
109
				throw new TranslationException('missing language definitions in: '.$sAddon.'/languages');
110
			}
111
		}
112
	}
113
/**
95 114
 * Import language definitions into array
96 115
 * @param string load language from filename
97 116
 * @return array contains all found translations

Also available in: Unified diff