/** * ACTION which is used to clear all languages cache. * * @access public * @since 1.2.0-dev * @version 1.2.0-dev */ public function actionReloadCache() { try { I18nTools\Core::reloadCache(); $msg = __('Cache has been successfully reloaded.'); $msgType = 'success'; } catch (Exception\Fatal\I18n $e) { $msg = '<b>Error occured while reloading translation cache:</b> <br />' . $e->getMessage(); $msgType = 'danger'; } $sURL = Route::factory('backend')->url(['controller' => 'i18n', 'action' => 'index']); Session::flash($sURL, $msg, $msgType); }
/** * Translating method. * * @author Krzysztof Trzos * @access public * @param string $toTranslate * @param array $params * @param array $options * @return string * @since 1.0.0-alpha * @version 1.0.0-alpha */ function __($toTranslate, $params = [], $options = []) { $output = $toTranslate; if (Router::hasModule('i18n')) { $output = I18n\Core::get($toTranslate, $options); } foreach ($params as $sParamName => $aParamValue) { $output = str_replace(':' . $sParamName, $aParamValue, $output); } return $output; }