' . money_format('%.2n', $amount) . ''; } public static function formatCredits($amount) { return '' . (is_numeric($amount) ? number_format($amount, 1) : $amount) . ' LBC'; } public static function translate($token, $language = null) { $language = $language === null ? static::$language : $language; if (!isset(static::$translations[$language])) { $path = ROOT_DIR . '/data/i18n/' . $language . '.yaml'; static::$translations[$language] = file_exists($path) ? Spyc::YAMLLoadString(file_get_contents($path)) : []; } $scope = static::$translations[$language]; foreach(explode('.', $token) as $level) { if (isset($scope[$level])) { $scope = $scope[$level]; } else { $scope = []; } } if (!$scope && $language != 'en') { return static::translate($token, 'en'); } return $scope ?: $token; } }