本文整理匯總了PHP中I18n::getTranslation方法的典型用法代碼示例。如果您正苦於以下問題:PHP I18n::getTranslation方法的具體用法?PHP I18n::getTranslation怎麽用?PHP I18n::getTranslation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類I18n
的用法示例。
在下文中一共展示了I18n::getTranslation方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: translate
/**
* Additional Method
*
* @var string
*/
public static function translate($key, $locale_id = null)
{
$i18n_id = Config::get('option.i18n_' . $key);
if ($locale_id === null) {
$locale_id = App::getLocale();
}
return I18n::getTranslation($i18n_id, $locale_id);
}
示例2: mailbox
function mailbox($param)
{
$this->layout_name = "admin";
$this->data['options'] = array("all_mails", "inbox", "sent_mail", "trash", "compose", "msg");
$this->data['display'] = array("All mails", "Inbox", "Sent mail", "Trash", "Compose", "Message");
$this->data['request'] = $param[0];
$this->data['send_to'] = $param;
$db = $this->di['db']->sql(DB_DEFAULT);
$user = $this->di['auth']->getUser();
if (!in_array($param[0], $this->data['options'])) {
exit;
}
$sql = "SELECT * FROM user_main a\r\n\t\tINNER JOIN geolocalisation_country b ON a.id_geolocalisation_country = b.id\r\n\t\tINNER JOIN geolocalisation_city c ON a.id_geolocalisation_city = c.id\r\n\t\t\r\nwhere a.id ='" . $db->sql_real_escape_string($user->id) . "'";
$res = $db->sql_query($sql);
$dfgwdfwdf = $db->sql_to_array($res);
$this->data['user'] = $dfgwdfwdf[0];
$i = 0;
foreach ($this->data['options'] as $line) {
if ($line === $this->data['request']) {
$this->title = __($this->data['display'][$i]);
$this->ariane = "> <a href=\"" . LINK . "user/\">" . __("Members") . "</a> > " . '<a href="' . LINK . 'user/profil/' . $user->id . '">' . $user->firstname . ' ' . $user->name . '</a>' . ' > ';
$this->data['request'] != "all_mails" ? $this->ariane .= '<a href="' . LINK . 'user/mailbox/all_mails">' . __('Mailbox') . '</a>' : ($this->ariane .= __('Mailbox'));
$this->data['request'] != "all_mails" ? $this->ariane .= ' > ' . $this->title : "";
break;
}
$i++;
}
switch ($this->data['request']) {
case "compose":
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (!empty($_POST['mailbox_main']['id_user_main__to'])) {
$data = array();
$data['mailbox_main'] = $_POST['mailbox_main'];
$data['mailbox_main']['date'] = date('c');
$data['mailbox_main']['id_user_main__box'] = $user->id;
$data['mailbox_main']['id_user_main__from'] = $user->id;
$data['mailbox_main']['id_mailbox_etat'] = 2;
$data['mailbox_main']['id_history_etat'] = 1;
if ($db->sql_save($data)) {
$data['mailbox_main']['id_user_main__box'] = $_POST['mailbox_main']['id_user_main__to'];
if ($db->sql_save($data)) {
//send mail
I18n::SetDefault("en");
I18n::load("en");
$sql = "SELECT * FROM user_main WHERE id=" . $user->id;
$res = $db->sql_query($sql);
$ob = $db->sql_fetch_object($res);
$sql = "SELECT * FROM user_main WHERE id=" . $_POST['mailbox_main']['id_user_main__to'];
$res = $db->sql_query($sql);
$ob2 = $db->sql_fetch_object($res);
//send mail here
$subject = "[" . SITE_NAME . "] " . html_entity_decode($data['mailbox_main']['title'], ENT_COMPAT, 'UTF-8');
$msg = __('Hello') . ' ' . $ob2->firstname . ' ' . $ob2->name . ',<br />' . '<br /><br />' . '<a href="' . 'http://' . $_SERVER['SERVER_NAME'] . '/en/' . 'user/profil/inbox/' . $user->id . '">' . $ob->firstname . ' ' . $ob->name . '</a> sent you a message on Estrildidae.net.' . '<br /><br />' . '<b>Objet : ' . $data['mailbox_main']['title'] . '</b>' . '<br />' . '<b>Date : ' . date("F j, Y, H:i:s") . " CET</b>" . '<br /><br /><a href="' . 'http://' . $_SERVER['SERVER_NAME'] . '/en/' . 'user/mailbox/inbox/"><b>' . __('Click here to view the message') . '</b></a> ' . '<br /><br />' . __('You do not want to receive e-mails from Estrildidae member? Change notification settings for your account. Click here to report abuse.
Your use of Estrildidae is subject to the terms of use and privacy policy of Estrildidae! and the rules of the Estrildidae community.');
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
// En-tetes additionnels
$headers .= 'To: ' . $ob2->firstname . ' ' . $ob2->name . ' <' . $ob2->email . '>' . "\r\n";
$headers .= 'From: ' . $ob->firstname . ' ' . $ob->name . ' via Estrildidae.net (no-reply)<noreply@estrildidae.net>' . "\r\n";
$msg = I18n::getTranslation($msg);
mail($ob2->email, $subject, $msg, $headers) or die("error mail");
//end mail
I18n::SetDefault("en");
$msg = I18n::getTranslation(__("Your message has been sent."));
$title = I18n::getTranslation(__("Success"));
set_flash("success", $title, $msg);
header("location: " . LINK . "user/mailbox/inbox/");
exit;
} else {
die("Problem insertion boite 2");
}
} else {
die("Problem insertion boite 1");
}
}
}
$this->javascript = array("jquery.1.3.2.js", "jquery.autocomplete.min.js");
$this->di['js']->code_javascript[] = '$("#mailbox_main-id_user_main__to-auto").autocomplete("' . LINK . 'user/user_main/", {
mustMatch: true,
autoFill: false,
max: 100,
scrollHeight: 302,
delay:1
});
$("#mailbox_main-id_user_main__to-auto").result(function(event, data, formatted) {
if (data)
$("#mailbox_main-id_user_main__to").val(data[1]);
});
';
break;
case 'inbox':
$sql = "SELECT a.id,a.title,a.date,id_mailbox_etat,\r\n\t\t\t\t\tb.id as to_id, b.firstname as to_firstname, b.name as to_name, x.iso as to_iso,\r\n\t\t\t\t\tc.id as from_id, c.firstname as from_firstname, c.name as from_name, y.iso as from_iso\r\n\t\t\t\t\tFROM mailbox_main a\r\n\t\t\t\t\tINNER JOIN user_main b ON a.id_user_main__to = b.id\r\n\t\t\t\t\tINNER JOIN geolocalisation_country x on b.id_geolocalisation_country = x.id\r\n\t\t\t\t\tINNER JOIN user_main c ON a.id_user_main__from = c.id\r\n\t\t\t\t\tINNER JOIN geolocalisation_country y on c.id_geolocalisation_country = y.id\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tWHERE id_user_main__box = '" . $user->id . "'\r\n\t\t\t\t\t\tAND id_user_main__to = '" . $user->id . "'\r\n\t\t\t\t\t\t\tAND id_history_etat = 1\r\n\t\t\t\t\t\t\tORDER BY date DESC";
$res = $db->sql_query($sql);
$this->data['mail'] = $db->sql_to_array($res);
break;
case 'sent_mail':
$sql = "SELECT a.id,a.title,a.date,id_mailbox_etat,\r\n\t\t\t\t\tb.id as to_id, b.firstname as to_firstname, b.name as to_name, x.iso as to_iso,\r\n\t\t\t\t\tc.id as from_id, c.firstname as from_firstname, c.name as from_name, y.iso as from_iso\r\n\t\t\t\t\tFROM mailbox_main a\r\n\t\t\t\t\tINNER JOIN user_main b ON a.id_user_main__to = b.id\r\n\t\t\t\t\tINNER JOIN geolocalisation_country x on b.id_geolocalisation_country = x.id\r\n\t\t\t\t\tINNER JOIN user_main c ON a.id_user_main__from = c.id\r\n\t\t\t\t\tINNER JOIN geolocalisation_country y on c.id_geolocalisation_country = y.id\r\n\t\t\t\t\t\tWHERE id_user_main__box = '" . $user->id . "'\r\n\t\t\t\t\t\tAND id_user_main__from = '" . $user->id . "'\r\n\t\t\t\t\t\t\tAND id_history_etat = 1\r\n\t\t\t\t\t\t\tORDER BY date DESC";
//.........這裏部分代碼省略.........
示例3: description
public function description()
{
return I18n::getTranslation($this->i18n_description);
}