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


PHP I18n::load方法代码示例

本文整理汇总了PHP中I18n::load方法的典型用法代码示例。如果您正苦于以下问题:PHP I18n::load方法的具体用法?PHP I18n::load怎么用?PHP I18n::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在I18n的用法示例。


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

示例1: action_edit

 public function action_edit()
 {
     if ($this->_auth->logged_in('technical')) {
         if ($this->request->param('id')) {
             $translation = ORM::factory('Translations', $this->request->param('id'));
             $translation_array = I18n::load($translation->language_symbol);
             $this->template->content = View::factory('template/admin/translations/edit');
             $this->template->content->bind('structure', $this->_structure_translation)->bind('category', $this->_category_translations)->bind('translation', $translation_array)->bind('translation_detail', $translation);
             if (isset($_POST['update_translation'])) {
                 try {
                     $this->_generate_translation_file($this->request->post('language_symbol'), $this->_generate_translation_array($this->request->post()));
                     sleep(3);
                     if (!is_file(DOCROOT . $this->_director . $this->request->post('language_symbol') . '.php')) {
                         $this->_set_message('error', __('ERORR_GENERATE_TRANSLATION_FILE'));
                     }
                     if (!empty($this->request->post('language_symbol'))) {
                         if (!$this->_compare_file_names($translation->language_symbol, $this->request->post('language_symbol'))) {
                             unlink(DOCROOT . $this->_director . $translation->language_symbol . '.php');
                         }
                     }
                     $translation->language = $this->request->post('language');
                     $translation->language_symbol = $this->request->post('language_symbol');
                     $translation->version = $this->request->post('version');
                     $translation->date_change = date("Y-m-d H:i:s");
                     $translation->user_id = $this->_auth->get_user()->pk();
                     $translation->save();
                     $this->_set_message('success', __('NO_ERROR_TRANSLATION_SUCCESS_EDIT'));
                     HTTP::redirect(URL::site($this->request->uri(), TRUE), 302);
                 } catch (ORM_Validation_Exception $e) {
                     $this->_set_message('error', $e->errors('avatar'));
                 }
             }
         }
     }
 }
开发者ID:rafalkowalski2,项目名称:cmsmilestone,代码行数:35,代码来源:Translations.php

示例2: runlevel3

 private static function runlevel3(){
     Logger::enter_group('Runlevel 4');
     Logger::debug('Loading Application-Variables');
     require_once(APP_ROOT . '/defaults.php');
     I18n::load();
     Logger::leave_group();
 }
开发者ID:reddragon010,项目名称:RG-ServerPanel,代码行数:7,代码来源:Bootloader.php

示例3: action_index

 public function action_index()
 {
     /*
     $lbl = array();
     $lbl['cancel'] = __('Cancel');
     $lbl['import_loading_text'] = __('Importing new files.');
     
     $lbl['login'] = __('Login');
     $lbl['username'] = __('Username');
     $lbl['password'] = __('Password');
     $lbl['remember'] = __('Remember me');
     
     $lbl['validator_messages']["required"] = __("This field is required.");
     		$lbl['validator_messages']['remote'] = __('Please fix this field.');
     		$lbl['validator_messages']['email'] = __('Please enter a valid email address.');
     		$lbl['validator_messages']['url'] = __('Please enter a valid URL.');
     		$lbl['validator_messages']['date'] = __('Please enter a valid date.');
     		$lbl['validator_messages']['dateISO'] = __('Please enter a valid date (ISO).');
     		$lbl['validator_messages']['number'] = __('Please enter a valid number.');
     		$lbl['validator_messages']['digits'] = __('Please enter only digits.');
     		$lbl['validator_messages']['creditcard'] = __('Please enter a valid credit card number.');
     		$lbl['validator_messages']['equalTo'] = __('Please enter the same value again.');
     		$lbl['validator_messages']['accept'] = __('Please enter a value with a valid extension.');
     		$lbl['validator_messages']['maxlength'] = __('Please enter no more than {0} characters.');
     		$lbl['validator_messages']['minlength'] = __('Please enter at least {0} characters.');
     		$lbl['validator_messages']['rangelength'] = __('Please enter a value between {0} and {1} characters long.');
     		$lbl['validator_messages']['range'] = __('Please enter a value between {0} and {1}.');
     		$lbl['validator_messages']['max'] = __('Please enter a value less than or equal to {0}.');
     		$lbl['validator_messages']['min'] = __('Please enter a value greater than or equal to {0}.');
     */
     $this->json(I18n::load(I18n::$lang));
 }
开发者ID:ragchuck,项目名称:ra-Log,代码行数:32,代码来源:i18n.php

示例4: get_plural

 public static function get_plural($string, $count)
 {
     // Load the translation table
     $table = I18n::load(I18n::$lang);
     $key = I18n::get_plural_key(I18n::$lang, $count);
     // Return the translated string if it exists
     return isset($table[$string][$key]) ? $table[$string][$key] : $string;
 }
开发者ID:googlecode-mirror,项目名称:s7ncms,代码行数:8,代码来源:I18n.php

示例5: get

 public static function get($string, $lang = NULL)
 {
     if (!$lang) {
         $lang = I18n::$lang;
     }
     $table = I18n::load($lang);
     return isset($table[$string]) ? $table[$string] : $string;
 }
开发者ID:azhai2015,项目名称:weixin,代码行数:8,代码来源:I18n.php

示例6: get

 /**
  * Returns translation of a string. If no translation exists, the original
  * string will be returned.
  *
  * @param   string   text to translate
  * @return  string
  */
 public static function get($string)
 {
     if (!isset(I18n::$_cache[I18n::$lang])) {
         // Load the translation table
         I18n::load(I18n::$lang);
     }
     // Return the translated string if it exists
     return isset(I18n::$_cache[I18n::$lang][$string]) ? I18n::$_cache[I18n::$lang][$string] : $string;
 }
开发者ID:ascseb,项目名称:core,代码行数:16,代码来源:i18n.php

示例7: get

 /**
  * @param string $text text to translate
  * @param string $lang
  *
  * @return  string
  */
 public static function get($text, $lang = NULL)
 {
     if (!$lang) {
         $lang = I18n::$lang;
     }
     $table = I18n::load($lang);
     $alternative = I18n::load('en-us');
     return isset($table[$text]) ? $table[$text] : (isset($alternative[$text]) ? $alternative[$text] : $text);
 }
开发者ID:creat2012,项目名称:hustoj_official,代码行数:15,代码来源:I18n.php

示例8: get

 /**
  * Returns translation of a string. If no translation exists, the original
  * string will be returned. No parameters are replaced.
  *
  *     $hello = I18n::get('Hello friends, my name is :name');
  *
  * @param   string   text to translate
  * @param   string   target language
  * @return  string
  */
 public static function get($string, $lang = NULL)
 {
     if (!$lang) {
         // Use the global target language
         $lang = I18n::$lang;
     }
     // Load the translation table for this language
     $table = I18n::load($lang);
     // Return the translated string if it exists
     return isset($table[$string]) ? $table[$string] : $string;
 }
开发者ID:Tidwell,项目名称:HMXSongs-PHP-API,代码行数:21,代码来源:i18n.php

示例9: __construct

 public function __construct($request)
 {
     parent::__construct($request);
     $this->template = View::factory('hmo_masterpage');
     $config = Kohana_Config::instance()->load("config");
     $this->site = $config['app_path'];
     $this->session = Session::instance();
     if ($this->authenticate) {
         $this->authenticate();
     }
     $this->message = I18n::load('en-us');
 }
开发者ID:samjiks,项目名称:semedng,代码行数:12,代码来源:ccontroller.php

示例10: get

 /**
  * Get value from db table
  * @param string $string
  * @param string $lang
  * @return string 
  */
 public static function get($string, $lang = null)
 {
     if (Kohana::$environment == Kohana::DEVELOPMENT) {
         if (!$lang) {
             // Use the global target language
             $lang = I18n::$lang;
         }
         // Load the translation table for this language
         $table = I18n::load($lang);
         // Return the translated string if it exists
         return isset($table[I18n::$view . '|' . $string]) ? $table[I18n::$view . '|' . $string] : I18n::add($string);
     } else {
         return parent::get($string, $lang);
     }
 }
开发者ID:raku,项目名称:MorCMS,代码行数:21,代码来源:i18n.php

示例11: get

 public static function get($string, $lang = NULL)
 {
     if (!$lang) {
         // Use the global target language
         $lang = I18n::$lang;
     }
     // Load the translation table for this language
     $table = I18n::load($lang);
     // Если нет слова в словаре, добавляем его
     if (!isset($table[$string])) {
         self::append($string, $lang);
     }
     // Return the translated string if it exists
     return isset($table[$string]) ? $table[$string] : $string;
 }
开发者ID:g-a-g,项目名称:its2015,代码行数:15,代码来源:I18n.php

示例12: module_i18n

 /**
  * Edit module interface
  * (internationalization module)
  */
 protected function module_i18n()
 {
     if (!isset($this->cms_modules[$this->config_mod['cms_module']])) {
         return false;
     }
     $data = Arr::get($_POST, 'data', []);
     if ($this->request->is_post()) {
         $path = $this->cms_modules[$this->config_mod['cms_module']] . 'i18n' . DS . $this->language . EXT;
         File::var_export($data, $path);
         Message::success(__('settings.changes_saved'));
         HTTP::redirect(Route::url(Request::get('routename'), ['controller' => Request::get('controller'), 'action' => 'i18n']));
     }
     $group = str_replace('cms_', '', $this->config_mod['cms_module']);
     foreach (I18n::load($this->language) as $key => $val) {
         if (preg_match('/^' . $group . '\\./', $key)) {
             $data[$key] = $val;
         }
     }
     $this->title = $this->config_mod['cms_module'] == 'cms_settings' ? __('settings.i18n_edit_global') : __('settings.i18n_edit_iface');
     $this->content = View::factory('backend/v_i18n', ['data' => $data]);
 }
开发者ID:eok8177,项目名称:shopCMS,代码行数:25,代码来源:Backend.php

示例13: get

 public static function get($string, $lang = NULL)
 {
     if (!$lang) {
         // Use the global target language
         $lang = I18n::$lang;
     }
     // Load the translation table for this language
     $table = I18n::load($lang);
     if (!isset($table[$string])) {
         $file = Kohana::find_file('i18n', 'nottranslated');
         //$f = fopen($file[0], 'r');
         $content = file_get_contents($file[0]);
         $lines = explode("\n", $content);
         if (!in_array($string, $lines)) {
             $lines[] = $string;
             $content = implode("\n", $lines);
             $f = fopen($file[0], 'w');
             fwrite($f, $content);
         }
     }
     // Return the translated string if it exists
     return isset($table[$string]) ? $table[$string] : $string;
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:23,代码来源:I18n.php

示例14: defined

<?php

defined('SYSPATH') or die('No direct script access.');
$GI18N = I18n::load(I18n::$lang);
?>
<table><caption>Applications list you have registered</caption><thead>
    <tr><th>API Key</th><th>API Secret</th><th>Redirect URI</th><th>Scope</th><th>SSH Key</th><th>OP</th></tr>
    </thead><tbody><?php 
foreach ($servers as $row) {
    ?>
<tr><td><a href="/server/register/<?php 
    echo $row['server_id'];
    ?>
"><?php 
    echo $row['client_id'];
    ?>
</a></td>
    <td><?php 
    echo $row['client_secret'];
    ?>
</td><td><?php 
    echo $row['redirect_uri'];
    ?>
</td>
    <td><?php 
    echo $row['scope'];
    ?>
</td><td><?php 
    echo $row['ssh_key'];
    ?>
</td><th>DEL</th></tr><?php 
开发者ID:hegelmax,项目名称:OAuth-2.0,代码行数:31,代码来源:oauth-server.php

示例15: date

 /**
  * Translate month and weekday names in the string
  *
  *
  * @uses    I18n::load
  * @uses    I18n::$lang
  * @param   string  string to translate
  * @return  string
  */
 public static function date($string)
 {
     static $translate = array();
     if (empty($string)) {
         return $string;
     }
     $string = (string) $string;
     // Create a new message list
     $messages = array();
     if (!isset($translate[I18n::$lang])) {
         $translate[I18n::$lang] = array_intersect_key(I18n::load(I18n::$lang), Kohana::message('date'));
     }
     return strtr($string, $translate[I18n::$lang]);
 }
开发者ID:greor,项目名称:satin-spb,代码行数:23,代码来源:i18n.php


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