File "ThemeTranslations.php"
Full Path: /home/pumpbmko/public_html/wp-content/themes/momota/lib/colibriwp/src/ThemeTranslations.php
File size: 674 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
namespace ColibriWP\Theme;
use ColibriWP\Theme\Core\Hooks;
class ThemeTranslations {
protected static $texts = array();
public static function load() {
$texts = require_once Theme::rootDirectory() . '/inc/theme-translations.php';
self::$texts = Hooks::prefixed_apply_filters( 'theme_translations', $texts );
}
public static function get( $key, $params = array() ) {
$text = "__[{$key}]__";
if ( isset( static::$texts[ $key ] ) ) {
$text = static::$texts[ $key ];
}
$params = (array) $params;
if ( empty( $params ) ) {
return $text;
}
array_unshift( $params, $text );
return call_user_func_array( 'sprintf', $params );
}
}