30 lines
703 B
PHP
30 lines
703 B
PHP
<?php
|
|
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: Micha
|
|
* Date: 13.10.2016
|
|
* Time: 22:17
|
|
*/
|
|
class PHPFileRegionalizedTextProvider implements RegionalizedTextProvider
|
|
{
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $textsArray;
|
|
|
|
public function __construct($locale) {
|
|
$filePath = rtrim(__DIR__,'/') . '/resources/localized_strings.' . $locale . '.php';
|
|
if (file_exists($filePath) && is_readable($filePath) && is_file($filePath)) {
|
|
$this->textsArray = include($filePath);
|
|
}
|
|
}
|
|
|
|
public function getRegionalizedText($name)
|
|
{
|
|
return array_key_exists($name,$this->textsArray) ? $this->textsArray[$name] : $name;
|
|
}
|
|
|
|
|
|
} |