当前位置: 首页>>代码示例>>PHP>>正文


PHP I18n::getTranslation方法代码示例

本文整理汇总了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);
 }
开发者ID:Metrakit,项目名称:dynamix,代码行数:13,代码来源:Option.php

示例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";
//.........这里部分代码省略.........
开发者ID:glial,项目名称:glial,代码行数:101,代码来源:MailBox.php

示例3: description

 public function description()
 {
     return I18n::getTranslation($this->i18n_description);
 }
开发者ID:Metrakit,项目名称:dynamix,代码行数:4,代码来源:Image.php


注:本文中的I18n::getTranslation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。