Do not load translations from a relative path
When the application is installed outside of the document root, loading translations will not work.
This commit is contained in:
@@ -10,13 +10,6 @@ namespace Kanboard\Core;
|
||||
*/
|
||||
class Translator
|
||||
{
|
||||
/**
|
||||
* Locale path
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const PATH = 'app/Locale';
|
||||
|
||||
/**
|
||||
* Locale
|
||||
*
|
||||
@@ -171,9 +164,13 @@ class Translator
|
||||
* @param string $language Locale code: fr_FR
|
||||
* @param string $path Locale folder
|
||||
*/
|
||||
public static function load($language, $path = self::PATH)
|
||||
public static function load($language, $path = '')
|
||||
{
|
||||
$filename = $path.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'translations.php';
|
||||
if ($path === '') {
|
||||
$path = self::getDefaultFolder();
|
||||
}
|
||||
|
||||
$filename = implode(DIRECTORY_SEPARATOR, array($path, $language, 'translations.php'));
|
||||
|
||||
if (file_exists($filename)) {
|
||||
self::$locales = array_merge(self::$locales, require($filename));
|
||||
@@ -190,4 +187,15 @@ class Translator
|
||||
{
|
||||
self::$locales = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default locales folder
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public static function getDefaultFolder()
|
||||
{
|
||||
return implode(DIRECTORY_SEPARATOR, array(__DIR__, '..', 'Locale'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user