本文整理匯總了PHP中Translate::t方法的典型用法代碼示例。如果您正苦於以下問題:PHP Translate::t方法的具體用法?PHP Translate::t怎麽用?PHP Translate::t使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Translate
的用法示例。
在下文中一共展示了Translate::t方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: t
function t($key)
{
echo Translate::t($key);
}
示例2: Translate
// define('APP_LANG', 'fr');
// setlocale(LC_ALL, 'fr_FR');
// AUTO LOAD MODELS
include 'models/helpers.php';
include 'models/class.phpmailer.php';
include 'models/class.smtp.php';
include 'models/rb.php';
spl_autoload_register(function ($class) {
if (file_exists("models/{$class}.php")) {
include "models/{$class}.php";
}
});
// LOAD TRANSLATION
$lang = new Translate();
// APPLICATION SETTINGS
define('APP_NAME', $lang->t('app|name'));
define('APP_DESC', $lang->t('app|desc'));
define('APP_AUTHOR', 'Elinore Tenorio (elinore.tenorio@gmail.com)');
define('APP_MODE', 'development');
// set to 'production' if site is live, affects RedBean not being frozen if not in correct mode
define('APP_THEME', 'default');
// set to the theme folder name you are using, found in /views directory
// TIMEZONE
date_default_timezone_set($lang->t('app|timezone'));
/*
****************************************************
* USER SETTINGS
* You are free to modify the settings below
* to suit your needs
****************************************************
*/
示例3: Translate
<?php
$page_content = ob_get_contents();
ob_end_clean();
$translate = new Translate($root_folder . 'translations/', Registry::getInstance()->getLanguage());
$newtext = $translate->t($page_content);
echo $newtext;
// $translate->getWords($yandex_translate_key);
if ($MV) {
mysqli_close($MV);
}