本文整理汇总了PHP中I18n::t方法的典型用法代码示例。如果您正苦于以下问题:PHP I18n::t方法的具体用法?PHP I18n::t怎么用?PHP I18n::t使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类I18n
的用法示例。
在下文中一共展示了I18n::t方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
protected function getContent()
{
$content = '<ol class="breadcrumb">
<li><a href="' . ROOT_DIR . 'admin/courseadmin">' . I18n::t('courseoverview.title') . '</a></li>
<li><a href="' . ROOT_DIR . 'admin/lessonadmin/' . $this->course->getId() . '">' . $this->course->getName(I18n::getLang()) . '</a></li>
<li class="active">' . $this->lesson->getName(I18n::getLang()) . '</li>
</ol>';
$content .= '<form method="post"><input type="hidden" name="action" value="saveExercises" />
<table id="exercise-admin-table" class="table table-hover">
<thead>
<tr>
<th>' . I18n::t('admin.exerciseadmin.question') . '</th>
<th>' . I18n::t('admin.exerciseadmin.answer') . ' (EN)</th>
<th>' . I18n::t('admin.exerciseadmin.answer') . ' (DE)</th>
<th> </th>
</tr>
</thead>
<tbody>';
foreach ((array) Exercise::getMultipleExercises($this->lesson->getId(), 50, 0) as $exercise) {
$content .= '<tr><input type="hidden" name="exercise_id[]" value="' . $exercise->getId() . '" />
<td><input type="text" name="question[]" value="' . $exercise->getQuestion() . '" /></td>
<td><input type="text" name="answer_en[]" value="' . $exercise->getAnswer('en') . '" /></td>
<td><input type="text" name="answer_de[]" value="' . $exercise->getAnswer('de') . '" /></td>
</tr>';
}
$content .= '</tbody>
</table>
<table width="100%">
<tr><td width="50%" align="left"><button id="exercise-add-btn" class="btn btn-default" type="button">' . I18n::t('button.add') . '</button></td>
<td width="50%" align="right"><input type="submit" class="btn btn-default" value="' . I18n::t('button.save') . '" /></td></tr>
</table>
</form>';
return $content;
}
示例2: Index
public function Index()
{
if ($this->request->isPost()) {
if (Config::$authentication['authentication']) {
$server = isset(Config::$server['server']) && !empty(Config::$server['server']) ? Config::$server['server'] : Config::$server['host'] . ':' . Config::$server['port'];
$db = $this->request->getParam('db');
$options = array('username' => $this->request->getParam('username'), 'password' => $this->request->getParam('password'), 'db' => !empty($db) ? $db : 'admin');
$mongo = PHPMongoDB::getInstance($server, $options);
if ($mongo->getConnection()) {
$seesion = Application::getInstance('Session');
$seesion->isLogedIn = TRUE;
$seesion->server = $server;
$seesion->options = $options;
$this->request->redirect(Theme::URL('Index/Index'));
} else {
$this->message->error = $mongo->getExceptionMessage();
}
} else {
if ($this->request->getParam('username') == Config::$authentication['user'] && $this->request->getParam('password') == Config::$authentication['password']) {
$server = isset(Config::$server['server']) && !empty(Config::$server['server']) ? Config::$server['server'] : Config::$server['host'] . ':' . Config::$server['port'];
$seesion = Application::getInstance('Session');
$seesion->isLogedIn = TRUE;
$seesion->server = $server;
$seesion->options = array();
$this->request->redirect(Theme::URL('Index/Index'));
} else {
$this->message->error = I18n::t('AUTH_FAIL');
}
}
}
$data = array();
$this->display('index', $data);
}
示例3: isReadonly
public function isReadonly()
{
if (Application::isReadonly()) {
$this->message->error = I18n::t('I_A');
$this->request->redirect(Theme::URL('Index/Index'));
}
}
示例4: getContent
protected function getContent()
{
$content = '<ol class="breadcrumb">
<li><a href="' . ROOT_DIR . 'courseoverview">' . I18n::t('courseoverview.title') . '</a></li>
<li><a href="' . ROOT_DIR . 'course/' . $this->course->getId() . '">' . $this->course->getName(I18n::getLang()) . '</a></li>
<li><a href="' . ROOT_DIR . 'lesson/' . $this->lesson->getId() . '">' . $this->lesson->getName(I18n::getLang()) . '</a></li>
<li class="active">' . I18n::t('exercises.title') . '</li>
</ol>';
$content .= '<h1>' . $this->lesson->getName(I18n::getLang()) . ': ' . I18n::t('exercises.title') . '</h1>
<p>
</p>
<form method="post" class="form-horizontal"><input type="hidden" name="action" value="evaluate" />
<div class="form-group">
<label for="inputPassword3" class="col-sm-3 control-label">' . $this->question . '</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="answer" placeholder="' . I18n::t('exercise.youranswer') . '">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<button type="submit" class="btn btn-default">' . I18n::t('button.submit') . '</button>
</div>
</div>
</form>';
return $content;
}
示例5: GetLogMessage
public function GetLogMessage($msgId, $params = "")
{
$message = isset($this->m_Messages[$msgId]) ? $this->m_Messages[$msgId] : constant($msgId);
$message = I18n::t($message, $msgId, 'eventlog');
$params = unserialize($params);
$result = vsprintf($message, $params);
return $result;
}
示例6: getGlossaryTypes
static function getGlossaryTypes()
{
# Type definition
$arr_types = array('lexicon' => (object) array('label' => I18n::t('Словник'), 'slug' => I18n::t('lexicon', 'URL slug')));
# Run filter
$arr_types = Apply_Filters('glossary_types', $arr_types);
return $arr_types;
}
示例7: addOptionsPage
static function addOptionsPage()
{
$handle = Add_Options_Page(I18n::t('Glossary Options'), I18n::t('Glossary'), 'manage_options', self::$page_slug, array(__CLASS__, 'printOptionsPage'));
# Add JavaScript to this handle
Add_Action('load-' . $handle, array(__CLASS__, 'loadOptionsPage'));
# Add option boxes
self::addOptionBox(__('General'), Core::$plugin_folder . '/options-page/box-general.php');
self::addOptionBox(I18n::t('Archive Url'), Core::$plugin_folder . '/options-page/box-archive-link.php', 'side');
}
示例8: forceClearance
public static function forceClearance($roles, $user, $params = array(), $error = 'error.insufficient_rights')
{
$app_url = Settings::getProtected('app_url');
$i18n = new I18n("../translations", Settings::getProtected('language'));
if (!self::verify($roles, $user, $params)) {
Utils::redirectToDashboard('', $i18n->t($error));
return false;
}
return true;
}
示例9: addDeleteConfirmation
public function addDeleteConfirmation()
{
$this->addContentBefore('<form method="post">
<a class="btn btn-default" href="' . ROOT_DIR . 'admin/courseadmin">' . I18n::t('button.cancel') . '</a>
<input type="hidden" name="action" value="deleteLesson" />
<input type="hidden" name="confirmed" value="true" />
<input type="hidden" name="lessonId" value="' . $_POST['lessonId'] . '" />
<input type="submit" class="btn btn-danger" value="' . I18n::t('button.delete') . '" />
</form>');
}
示例10: translate
/**
* Translate error message
*
* @param string $string String to translate
* @param array $opt Array of arguments to pass to the translation (like field name)
* @return string The translated string if exists else the original string
*/
protected function translate($string, $opt = array())
{
$args = !empty($this->fullName) ? array('name' => $this->fullName) : array('name' => $this->fieldName);
$args = array_merge($args, $opt);
$moduleName = get_module_name(get_class($this));
if ($moduleName !== null) {
$file = MODULES_DIR . DS . $moduleName . DS . 'i18n' . DS . 'rules.' . I18n::getLang() . '.xml';
} else {
$file = FW_DIR . DS . 'form' . DS . 'check' . DS . 'i18n' . DS . 'rules.' . I18n::getLang() . '.xml';
}
return I18n::t($file, $string, $args, 'en', 'rules', true);
}
示例11: SetLanguage
public function SetLanguage()
{
$this->isReadonly();
$language = $this->request->getParam('language');
$languages = Config::$language;
//$this->debug($languages);
if (array_key_exists($language, $languages)) {
$session = new Session();
$session->language = $language;
} else {
$this->message->error = I18n::t('LAN_NOT_AVA');
}
$this->request->redirect($_SERVER['HTTP_REFERER']);
}
示例12: Drop
public function Drop()
{
$this->isReadonly();
$db = $this->request->getParam('db');
if (!empty($db)) {
$response = $this->getModel()->dropDatabase($db);
if ($response['ok'] == 1) {
$this->message->sucess = I18n::t('D_D', $db);
} else {
$this->message->error = $response;
}
}
$this->gotoDatabse();
}
示例13: addNewCourseInput
public function addNewCourseInput()
{
$this->addContentAfter('<form method="post">
<input type="hidden" name="action" value="saveNewCourse" />
<table class="table">
<tr>
<td>' . I18n::t('text.new') . '</td>
<td><input type="text" name="nameEN" placeholder="Name EN" /></td>
<td><input type="text" name="nameDE" placeholder="Name DE" /></td>
<td><input type="submit" class="btn btn-default" value="' . I18n::t('button.save') . '" /></td>
</tr>
</table>
</form>');
}
示例14: validate
public function validate($val)
{
if (filter_var($val, FILTER_VALIDATE_EMAIL) === false) {
if (class_exists("I18n")) {
$err_msg = I18n::t("makiavelo.entities.errors.email");
} else {
$err_msg = " doesn't have a valid e-mail format";
}
$this->setErrorMsg($err_msg);
return false;
} else {
return true;
}
}
示例15: validate
public function validate($val)
{
Makiavelo::info("Validating if '{$val}' is numeric...");
if (!is_numeric($val)) {
if (class_exists("I18n")) {
$err_msg = I18n::t("makiavelo.entities.errors.integer");
} else {
$err_msg = " must be an integer";
}
$this->setErrorMsg($err_msg);
return false;
}
return true;
}