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


PHP i18n函数代码示例

本文整理汇总了PHP中i18n函数的典型用法代码示例。如果您正苦于以下问题:PHP i18n函数的具体用法?PHP i18n怎么用?PHP i18n使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了i18n函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: nm_search_with_placeholder

function nm_search_with_placeholder($placeholder = '')
{
    global $i18n;
    if (!$placeholder) {
        $placeholder = isset($i18n['news_manager/SEARCH_PLACEHOLDER']) ? $i18n['news_manager/SEARCH_PLACEHOLDER'] : $i18n['news_manager/SEARCH'] . ' ...';
    }
    $placeholder = htmlspecialchars($placeholder);
    $url = nm_get_url();
    ?>
  <form id="search" action="<?php 
    echo $url;
    ?>
" method="post">
    <input type="text" class="text" name="keywords" value="<?php 
    echo $placeholder;
    ?>
" onfocus="if (this.value=='<?php 
    echo $placeholder;
    ?>
') {this.value=''}" onblur="if (this.value=='') {this.value='<?php 
    echo $placeholder;
    ?>
'}" /><!--[if IE]><input type="text" style="display: none;" disabled="disabled" size="20"
    value="Ignore field. IE bug fix" /><![endif]--><input type="submit" class="submit" name="search" value="<?php 
    i18n('news_manager/SEARCH');
    ?>
" />
  </form>
  <?php 
}
开发者ID:sevenns,项目名称:alpremstroy,代码行数:30,代码来源:news_manager_addons.php

示例2: CreateHomeCalendar

/**
* Create a default home calendar for the user.
* @param string $username The username of the user we are creating relationships for.
*/
function CreateHomeCalendar($username)
{
    global $session, $c;
    if (!isset($c->home_calendar_name) || strlen($c->home_calendar_name) == 0) {
        return true;
    }
    $usr = getUserByName($username);
    $parent_path = "/" . $username . "/";
    $calendar_path = $parent_path . $c->home_calendar_name . "/";
    $dav_etag = md5($usr->user_no . $calendar_path);
    $qry = new AwlQuery('SELECT 1 FROM collection WHERE dav_name = :dav_name', array(':dav_name' => $calendar_path));
    if ($qry->Exec()) {
        if ($qry->rows() > 0) {
            $c->messages[] = i18n("Home calendar already exists.");
            return true;
        }
    } else {
        $c->messages[] = i18n("There was an error writing to the database.");
        return false;
    }
    $sql = 'INSERT INTO collection (user_no, parent_container, dav_name, dav_etag, dav_displayname, is_calendar, created, modified, resourcetypes) ';
    $sql .= 'VALUES( :user_no, :parent_container, :calendar_path, :dav_etag, :displayname, true, current_timestamp, current_timestamp, :resourcetypes );';
    $params = array(':user_no' => $usr->user_no, ':parent_container' => $parent_path, ':calendar_path' => $calendar_path, ':dav_etag' => $dav_etag, ':displayname' => $usr->fullname, ':resourcetypes' => '<DAV::collection/><urn:ietf:params:xml:ns:caldav:calendar/>');
    $qry = new AwlQuery($sql, $params);
    if ($qry->Exec()) {
        $c->messages[] = i18n("Home calendar added.");
        dbg_error_log("User", ":Write: Created user's home calendar at '%s'", $calendar_path);
    } else {
        $c->messages[] = i18n("There was an error writing to the database.");
        return false;
    }
    return true;
}
开发者ID:rossryan,项目名称:Calico,代码行数:37,代码来源:auth-functions.php

示例3: convert_tree_to_options_multi

 /**
  * Convert tree to options multi
  *
  * @param array $data
  * @param int $level
  * @param array $options
  * @param array $result
  */
 public static function convert_tree_to_options_multi($data, $level = 0, $options = [], &$result)
 {
     // convert to array
     if (!empty($options['skip_keys']) && !is_array($options['skip_keys'])) {
         $options['skip_keys'] = [$options['skip_keys']];
     }
     foreach ($data as $k => $v) {
         // if we are skipping certain keys
         if (!empty($options['skip_keys']) && in_array($k, $options['skip_keys'])) {
             continue;
         }
         // assemble variable
         $value = $v;
         $value['name'] = !empty($options['i18n']) ? i18n(null, $v[$options['name_field']]) : $v[$options['name_field']];
         $value['level'] = $level;
         if (!empty($options['icon_field'])) {
             $value['icon_class'] = html::icon(['type' => $v[$options['icon_field']], 'class_only' => true]);
         }
         if (!empty($options['disabled_field'])) {
             $value['disabled'] = !empty($v[$options['disabled_field']]);
         }
         $result[$k] = $value;
         // if we have options
         if (!empty($v['options'])) {
             self::convert_tree_to_options_multi($v['options'], $level + 1, $options, $result);
         }
     }
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:36,代码来源:tree.php

示例4: fatlady_phyinf

function fatlady_phyinf($prefix, $inf)
{
    /* Check the interface setting */
    if (query($prefix . "/inf/uid") != $inf) {
        /* internet error, no i18n(). */
        set_result("FAILED", $prefix . "/inf/uid", "INF UID mismatch");
        return;
    }
    /* Check PHYINF */
    $phy = query($prefix . "/inf/phyinf");
    $phyp = XNODE_getpathbytarget($prefix, "phyinf", "uid", $phy, 0);
    if ($phy == "" || $phyp == "") {
        /* internet error, no i18n(). */
        set_result("FAILED", $prefix . "/inf/phyinf", "Invalid phyinf");
        return;
    }
    /* Check MACADDR */
    $macaddr = query($phyp . "/macaddr");
    if ($macaddr != "" && PHYINF_validmacaddr($macaddr) != "1") {
        set_result("FAILED", $phyp . "/macaddr", i18n("Invalid MAC address"));
        return;
    }
    $type = query($phyp . "/type");
    if ($type == "eth") {
        $media = query($phyp . "/media/linktype");
        if ($media != "" && $media != "AUTO" && $media != "1000F" && $media != "1000H" && $media != "100F" && $media != "100H" && $media != "10F" && $media != "10H") {
            set_result("FAILED", $phyp . "/media/linktype", i18n("Invalid media type"));
            return;
        }
    }
    /* We only validate the 'macaddr' & 'media' here,
     * so be sure to save 'macaddr' & 'media' only at 'setcfg' */
    set($prefix . "/valid", 1);
    set_result("OK", "", "");
}
开发者ID:jhbsz,项目名称:DIR-850L_A1,代码行数:35,代码来源:phyinf.php

示例5: check_dmz_setting

function check_dmz_setting($path, $addrtype, $lan_ip, $mask)
{
    if (query($path . "/enable") == "1") {
        anchor($path);
        $hostid = query("hostid");
        if ($hostid == "") {
            set_result("FAILED", $path . "/hostid", i18n("DMZ IP Address cannot be empty."));
            return "FAILED";
        }
        if ($hostid <= 0) {
            set_result("FAILED", $path . "/hostid", i18n("DMZ IP Address is not a valid IP Address."));
            return "FAILED";
        }
        if ($addrtype == "ipv4") {
            $dmzip = ipv4ip($lan_ip, $mask, $hostid);
            if (INET_validv4host($dmzip, $mask) == 0) {
                set_result("FAILED", $path . "/hostid", i18n("DMZ IP Address is not a valid IP Address."));
                return "FAILED";
            }
        }
    } else {
        set($path . "/enable", "0");
    }
    return "OK";
}
开发者ID:jhbsz,项目名称:DIR-850L_A1,代码行数:25,代码来源:DMZ.NAT-1.php

示例6: exec

	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		if (!empty($args))
		{
			switch ($this->stage)
			{
				case 1:
					if (!login($this->username, $args))
					{
						$stderr = ucf(i18n("login failed")).". ".ucf(i18n("please try again"));
					}
					else
					{
						$system->triggerEventIntern("login", array());
						//$response->addScript("window.location.reload()");
						
						$user = new mUser();
						$user->setByUsername($this->username);
						
						$stdout = $user->name." ".i18n("logged in successfully");
					}
					
					$this->stage = 0;
					return true;
			}
			
			$this->username = $args;
			$stdout = ucf(i18n("password:"));
			$this->stage = 1;
			$system->addJSScript("document.getElementById('cmdline').type='password';");
			return false;
		}
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:34,代码来源:login.php

示例7: renderUpdateForm

    static function renderUpdateForm(SiteUser $user = null, $exclude_fields = array())
    {
        $settings = Vars::getSettings();
        $profile = $user ? $user->getProfile() : null;
        // get vars from form submission
        $nickname = isset($_POST['nickname']) ? strip_tags($_POST['nickname']) : (isset($profile) ? $profile->getNickname() : '');
        $mandatory_label = ' <span style="color: rgb(185,2,0); font-weight: bold;">*</span>';
        $avatar_field = '
  <div class="form-group" id="form-field-avatar" >
    <label for="avatar">' . i18n(array('en' => 'Avatar', 'zh' => '头像')) . ' <small style="font-weight: normal;"><i>(' . i18n(array('en' => 'optional', 'zh' => '可选')) . ')</i></small></label>
    ' . ($profile ? "<div><img src='" . $profile->getThumbnailUrl() . "' alt='" . $user->getUsername() . "' style='cursor: pointer;' /></div>" : '') . '
    <input type="file" id="avatar" name="avatar"' . ($profile ? ' style="display: none;"' : '') . ' />
    <small>' . i18n(array('en' => 'Max image file size: ' . round($settings['profile']['avatar_max_size'] / 1000000, 1) . 'MB', 'zh' => '最大图片上传尺寸: ' . round($settings['profile']['avatar_max_size'] / 1000000, 1) . 'MB')) . '</small>
  </div>
';
        $rtn = '
  <div class="form-group" id="form-field-nickname">
    <label for="nickname">' . i18n(array('en' => 'Nick name', 'zh' => '昵称')) . $mandatory_label . ' <small style="font-weight: normal;"><i>(' . i18n(array('en' => 'what others see you as', 'zh' => '其他用户看到的您的称呼')) . ')</i></small></label>
    <input type="text" class="form-control" id="nickname" name="nickname" value="' . $nickname . '" required placeholder="" />
  </div>' . (in_array('avatar', $exclude_fields) ? '' : $avatar_field) . '
  <script type="text/javascript">
    $("#form-field-avatar img").click(function(){
      $("#avatar").trigger("click");
    });
    $("#avatar").change(function(){
      //$("#form-field-avatar img").fadeOut();
      $(this).fadeIn();
    });
  </script>
';
        return $rtn;
    }
开发者ID:jeffreycai,项目名称:reader,代码行数:32,代码来源:SiteProfile.class.php

示例8: add

 function add($author)
 {
     # Get current time
     $now = time();
     # Remove dangerous stuff
     $_POST[article][content] = sanitize_variables($_POST[article][content]);
     $_POST[article][title] = sanitize_variables($_POST[article][title]);
     $_POST[article][category] = sanitize_variables($_POST[article][category]);
     # Implode the category array
     $savecats = implode(", ", $_POST[article][category]);
     # Enter it all into an array for use later
     $data = array("timestamp" => $now, "content" => stripslashes($_POST[article][content]), "title" => stripslashes($_POST[article][title]), "author" => stripslashes($author), "category" => stripslashes($savecats), "views" => "0");
     # hook to add custom fields here.
     #	$data = run_filters('admin-new-savedata', $data);
     if (defined("KNIFESQL")) {
         $dataclass = KArticles::connect();
         $write_sql = "INSERT INTO articles VALUES ('{$data['timestamp']}', '{$data['category']}', '{$data['author']}', '{$data['title']}', '{$data['content']}', '{$data['views']}')";
         $result = mysql_query($write_sql) or die('Query failed: ' . mysql_error());
         $statusmessage = i18n("generic_article") . " &quot;{$data['title']}&quot; " . i18n("write_published");
         return $statusmessage;
     } else {
         $dataclass = KArticles::connect();
         $dataclass->settings['articles'][$now] = $data;
         $dataclass->save();
         # Give the user a status message
         $statusmessage = i18n("generic_article") . " &quot;{$data['title']}&quot; " . i18n("write_published");
         return $statusmessage;
     }
 }
开发者ID:BackupTheBerlios,项目名称:ajfork-svn,代码行数:29,代码来源:class.articles.php

示例9: check_qos_setting

function check_qos_setting($path)
{
    $enable = query($path . "/device/qos/enable");
    $auto = query($path . "/device/qos/autobandwidth");
    if ($enable == "1") {
        if ($auto == "0") {
            if (isdigit(query($path . "/inf/bandwidth/upstream")) == "0" || query($path . "/inf/bandwidth/upstream") > 102400 || query($path . "/inf/bandwidth/upstream") < 1) {
                set_result("FAILED", $path . "/inf/bandwidth/upstream", i18n("The input uplink speed is invalid."));
                return "FAILED";
            } else {
                // Remove the leading zeros.
                $upstream_dec = strtoul(query($path . "/inf/bandwidth/upstream"), 10);
                set($path . "/inf/bandwidth/upstream", $upstream_dec);
            }
        } else {
            set($path . "/device/qos/autobandwidth", "1");
        }
        $type = query($path . "/inf/bandwidth/type");
        if ($type == "AUTO" || $type == "ADSL" || $type == "CABLE") {
        } else {
            set_result("FAILED", $path . "/inf/bandwidth/type", i18n("Unsupported Connection type be assigned."));
            return "FAILED";
        }
    } else {
        set($path . "/device/qos/enable", "0");
    }
    return "OK";
}
开发者ID:jhbsz,项目名称:DIR-850L_A1,代码行数:28,代码来源:QOS.php

示例10: exec

	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		if (!isAdmin())
		{
			$stderr = ucf(i18n("not enough rights to set initial metadata"));
			return true;
		}
		
		if (empty($args))
		{
			$stdout = "Usage: maddinit [class name] [metadata name] [value]\n";
			$stdout .= "Example: maddinit file_folder view thumbnail";
		}
		else
		{
			list($class_name, $name, $value) = splitArgs($args);
			
			$return = setInitialMetadata($class_name, $name, $value);
			
			if ($return === true)
				$stdout = "Updated metadata successfully";
			else
				$stderr = $return;
		}
		
		
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:28,代码来源:maddinit.php

示例11: api_user_login

function api_user_login()
{
    global $loginErrorMessage;
    $user = null;
    $pwd = null;
    if (isset($_POST['login'])) {
        $user = $_POST['login'];
    }
    if (isset($_POST['password'])) {
        $pwd = $_POST['password'];
    }
    // Check in database...
    // Get the main database
    $dbh_ident = get_local_auth_database();
    $stmt = $dbh_ident->prepare("SELECT * FROM pasteque_users WHERE can_login AND user_id = :user_id");
    $stmt->bindParam(':user_id', $user, \PDO::PARAM_STR);
    $stmt->execute();
    $result = $stmt->fetchAll();
    if (count($result) != 1) {
        // Bouh, invalid user
        $loginErrorMessage = \i18n("Unavailable user");
        return false;
    }
    $userDbData = $result[0];
    require_once 'PasswordHash.php';
    $hasher = new \PasswordHash(8, TRUE);
    if ($hasher->CheckPassword($pwd, $userDbData['password'])) {
        session_start();
        $_SESSION["user"] = $userDbData['user_id'];
        return true;
    } else {
        $loginErrorMessage = \i18n("Invalid user or password");
        return false;
    }
}
开发者ID:booko,项目名称:pasteque-server,代码行数:35,代码来源:module.php

示例12: i18n_gallery_supersized_edit

function i18n_gallery_supersized_edit($gallery)
{
    ?>
  <p>
    <label for="supersized-width"><?php 
    i18n('i18n_gallery/MAX_DIMENSIONS');
    ?>
</label>
    <input type="text" class="text" id="supersized-width" name="supersized-width" value="<?php 
    echo @$gallery['width'];
    ?>
" style="width:5em"/>
    x
    <input type="text" class="text" id="supersized-height" name="supersized-height" value="<?php 
    echo @$gallery['height'];
    ?>
" style="width:5em"/>
  </p>
  <p>
    <label for="supersized-interval"><?php 
    i18n('i18n_gallery/INTERVAL');
    ?>
</label>
    <input type="text" class="text" id="supersized-interval" name="supersized-interval" value="<?php 
    echo @$gallery['interval'];
    ?>
" style="width:5em"/>
  </p>
<?php 
}
开发者ID:elephantcode,项目名称:elephantcode,代码行数:30,代码来源:plugin_supersized.php

示例13: check_remote

function check_remote($entry)
{
    $port = query($entry . "/inf/web");
    if ($port != "") {
        if (isdigit($port) != "1") {
            set_result("FAILED", $entry . "/inf/web", i18n("Invalid port number"));
            return 0;
        }
        if ($port < 1 || $port > 65535) {
            set_result("FAILED", $entry . "/inf/web", i18n("Invalid port range"));
            return 0;
        }
    }
    $port = query($entry . "/inf/https_rport");
    if ($port != "") {
        if (isdigit($port) != "1") {
            set_result("FAILED", $entry . "/inf/https_rport", i18n("Invalid port number"));
            return 0;
        }
        if ($port < 1 || $port > 65535) {
            set_result("FAILED", $entry . "/inf/https_rport", i18n("Invalid port range"));
            return 0;
        }
    }
    $host = query($entry . "/inf/weballow/hostv4ip");
    if ($host != "") {
        if (INET_validv4addr($host) != "1") {
            set_result("FAILED", $entry . "/inf/weballow/hostv4ip", i18n("Invalid host IP address"));
            return 0;
        }
    }
    set_result("OK", "", "");
    return 1;
}
开发者ID:jhbsz,项目名称:DIR-850L_A1,代码行数:34,代码来源:HTTP.WAN-1.php

示例14: renderContactForm

    static function renderContactForm()
    {
        $mandatory_label = ' <span style="color: rgb(185,2,0); font-weight: bold;">*</span>';
        $rtn = Message::renderMessages() . '
<form role="form" action="" method="post" id="contact">
  <fieldset>
    <div class="form-group form-field-name">
      <label for="name">' . i18n(array('en' => 'Your name', 'zh' => '您的姓名')) . $mandatory_label . '</label>
      <input class="form-control" name="contact[name]" id="name" autofocus required="">
    </div>
    <div class="form-group form-field-email">
      <label for="email">' . i18n(array('en' => 'E-mail', 'zh' => '电子邮箱')) . $mandatory_label . '</label>
      <input class="form-control" type="email" name="contact[email]" id="email" required="">
    </div>
    <div class="form-group form-field-message">
      <label for="message">' . i18n(array('en' => 'Message', 'zh' => '留言')) . $mandatory_label . '</label>
      <textarea id="message" name="contact[message]" rows="5" class="form-control" required=""></textarea>
    </div>
    <div class="form-group" id="form-field-notice"><small><i>
      ' . $mandatory_label . i18n(array('en' => ' indicates mandatory fields', 'zh' => ' 标记为必填项')) . '
    </i></small></div>
    <input type="submit" name="submit" class="btn btn-success btn-block disabled" value="' . i18n(array('en' => 'Submit', 'zh' => '提交')) . '" />
    ' . Form::loadSpamToken('#contact', 'global contact form') . '
  </fieldset>
</form>
';
        return $rtn;
    }
开发者ID:jeffreycai,项目名称:ct21,代码行数:28,代码来源:Form.class.php

示例15: templateOption

 public function templateOption()
 {
     if ($this->page->canChangeTemplate()) {
         return $this->item('file-code-o', l('pages.show.template') . ': ' . i18n($this->page->blueprint()->title()), array('href' => $this->modalUrl('template'), 'data-modal' => true, 'data-shortcut' => 't'));
     } else {
         return false;
     }
 }
开发者ID:robinandersen,项目名称:robin,代码行数:8,代码来源:menu.php


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