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


PHP jLocale::getCurrentLang方法代码示例

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


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

示例1: getDictionary

 /**
  * Get JSON containing all translation for a given jelix property file.
  * @param string $property Name of the property file. Ex: map if searched file is map.UTF-8.properties
  * @param string $lang Language. Ex: fr_FR (optional)
  * @return binary object The image for this project.
  */
 function getDictionary()
 {
     $rep = $this->getResponse('json');
     // Get the property file
     $property = $this->param('property');
     $lang = $this->param('lang');
     if (!$lang) {
         $lang = jLocale::getCurrentLang() . '_' . jLocale::getCurrentCountry();
     }
     $data = array();
     $path = jApp::appPath() . 'modules/view/locales/' . $lang . '/' . $property . '.UTF-8.properties';
     if (file_exists($path)) {
         $lines = file($path);
         foreach ($lines as $lineNumber => $lineContent) {
             if (!empty($lineContent) and $lineContent != '\\n') {
                 $exp = explode('=', trim($lineContent));
                 if (!empty($exp[0])) {
                     $data[$exp[0]] = jLocale::get('view~dictionnary.' . $exp[0], null, $lang);
                 }
             }
         }
     }
     $rep->data = $data;
     return $rep;
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:31,代码来源:translate.classic.php

示例2: view

 /**
  *
  */
 function view()
 {
     $lang = jLocale::getCurrentLang();
     $name = $this->param('name');
     jLog::log("lang: {$lang} / name: {$name}");
     $rep = $this->getResponse('html');
     jLog::log("Name of fame: " . $this->param('name'));
     $articles = jClasses::getService('amigatlk~articles');
     jLog::log(" " . get_class($articles));
     $article = $articles->getArticle($this->param('name'));
     if (empty($article)) {
         $rep->body->assignZone('MAIN', 'amigatlk~notFound404');
         $rep->setHttpStatus('404', 'Not Found');
         return $rep;
     }
     $rep->title = $article->title;
     $rep->body->assignZone('MAIN', 'amigatlk~viewArticle', array('article' => $article));
     return $rep;
 }
开发者ID:brunonymous,项目名称:bubux-php-scripts,代码行数:22,代码来源:articles.classic.php

示例3: getContent

 public function getContent($name)
 {
     $tpl = new jTpl();
     $tpl->assign('lang', jLocale::getCurrentLang());
     $name = str_replace('-', '_', $name);
     $tplName = 'amigatlk~' . $name;
     try {
         $content = $tpl->fetch($tplName, 'text', true, false);
     } catch (Exception $e) {
         jLog::log("fetch() return: " . $e->getMessage());
         return;
     }
     $lines = explode("\n", $content);
     $item = new stdClass();
     $item->title = trim(array_shift($lines));
     $item->content = $lines;
     //jLog::dump($item);
     return $item;
 }
开发者ID:brunonymous,项目名称:bubux-php-scripts,代码行数:19,代码来源:content.class.php

示例4: index

 /**
  *
  */
 function index()
 {
     $lang = jLocale::getCurrentLang();
     if ($lang != 'fr') {
         $rep = $this->getResponse('redirect');
         $rep->action = "amigatlk~default:index";
         $rep->params = array('lang' => 'fr');
         return $rep;
     }
     $rep = $this->getResponse('html');
     $articles = jClasses::getService('amigatlk~articles');
     $article = $articles->getArticle('homepage');
     if (empty($article)) {
         $rep->body->assignZone('MAIN', 'amigatlk~notFound404');
         $rep->setHttpStatus('404', 'Not Found');
         return $rep;
     }
     $rep->body->assignZone('MAIN', 'amigatlk~viewArticle', array('article' => $article));
     return $rep;
 }
开发者ID:brunonymous,项目名称:bubux-php-scripts,代码行数:23,代码来源:default.classic.php

示例5: create

 /**
  * Create a jurl object with the given action data
  * @param jUrlAction $url  information about the action
  * @return jUrl the url correspondant to the action
  * @author      Laurent Jouanneau
  * @copyright   2005 CopixTeam, 2005-2006 Laurent Jouanneau
  *   very few lines of code are copyrighted by CopixTeam, written by Laurent Jouanneau
  *   and released under GNU Lesser General Public Licence,
  *   in an experimental version of Copix Framework v2.3dev20050901,
  *   http://www.copix.org.
  */
 public function create($urlact)
 {
     if ($this->dataCreateUrl == null) {
         $sel = new jSelectorUrlCfgSig(jApp::config()->urlengine['significantFile']);
         jIncluder::inc($sel);
         $this->dataCreateUrl =& $GLOBALS['SIGNIFICANT_CREATEURL'];
     }
     $url = new jUrl('', $urlact->params, '');
     $module = $url->getParam('module', jApp::getCurrentModule());
     $action = $url->getParam('action');
     // let's try to retrieve informations corresponding
     // to the given action. this informations will allow us to build
     // the url
     $id = $module . '~' . $action . '@' . $urlact->requestType;
     $urlinfo = null;
     if (isset($this->dataCreateUrl[$id])) {
         $urlinfo = $this->dataCreateUrl[$id];
         $url->delParam('module');
         $url->delParam('action');
     } else {
         $id = $module . '~*@' . $urlact->requestType;
         if (isset($this->dataCreateUrl[$id])) {
             $urlinfo = $this->dataCreateUrl[$id];
             if ($urlinfo[0] != 3 || $urlinfo[3] === true) {
                 $url->delParam('module');
             }
         } else {
             $id = '@' . $urlact->requestType;
             if (isset($this->dataCreateUrl[$id])) {
                 $urlinfo = $this->dataCreateUrl[$id];
             } else {
                 throw new Exception("Significant url engine doesn't find corresponding url to this action :" . $module . '~' . $action . '@' . $urlact->requestType);
             }
         }
     }
     /*
     urlinfo =
       or array(0,'entrypoint', https true/false, 'handler selector', 'basepathinfo')
       or array(1,'entrypoint', https true/false,
               array('year','month',), // list of dynamic values included in the url
               array(true, false..), // list of integers which indicates for each
                                     // dynamic value: 0: urlencode, 1:urlencode except '/', 2:escape
               "/news/%1/%2/", // the url
               true/false, // false : this is a secondary action
               array('bla'=>'whatIWant' ) // list of static values
               )
       or array(2,'entrypoint', https true/false), // for the patterns "@request"
       or array(3,'entrypoint', https true/false), // for the patterns "module~@request"
       or array(4, array(1,...), array(1,...)...)
     */
     if ($urlinfo[0] == 4) {
         // an action is mapped to several urls
         // so it isn't finished. Let's find building information
         // into the array
         $l = count($urlinfo);
         $urlinfofound = null;
         for ($i = 1; $i < $l; $i++) {
             $ok = true;
             // verify that given static parameters of the action correspond
             // to those defined for this url
             foreach ($urlinfo[$i][7] as $n => $v) {
                 // specialStatic are static values for which the url engine
                 // can compare not only with a given url parameter value, but
                 // also with a value stored some where (typically, a configuration value)
                 $specialStatic = !empty($v) && $v[0] == '$';
                 $paramStatic = $url->getParam($n, null);
                 if ($specialStatic) {
                     // special statique value
                     $typePS = $v[1];
                     $v = substr($v, 2);
                     if ($typePS == 'l') {
                         if ($paramStatic === null) {
                             $paramStatic = jLocale::getCurrentLang();
                         } else {
                             if (preg_match('/^(\\w{2,3})_\\w{2,3}$/', $paramStatic, $m)) {
                                 // if the value is a locale instead of lang, translate it
                                 $paramStatic = $m[1];
                             }
                         }
                     } elseif ($typePS == 'L') {
                         if ($paramStatic === null) {
                             $paramStatic = jApp::config()->locale;
                         } else {
                             if (preg_match('/^\\w{2,3}$/', $paramStatic, $m)) {
                                 // if the value is a lang instead of locale, translate it
                                 $paramStatic = jLocale::langToLocale($paramStatic);
                             }
                         }
                     }
//.........这里部分代码省略.........
开发者ID:medali1990,项目名称:medsite,代码行数:101,代码来源:significant.urls.php

示例6: __construct

 function __construct()
 {
     $this->charset = jApp::config()->charset;
     $this->lang = jLocale::getCurrentLang();
     parent::__construct();
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:6,代码来源:jResponseXmlFeed.class.php

示例7: _prepareTpl

 /**
  * Initialization of the jTpl object
  */
 protected function _prepareTpl()
 {
     $lang = jLocale::getCurrentLang();
     $this->_tpl->assign('lang', $lang);
 }
开发者ID:brunonymous,项目名称:bubux-php-scripts,代码行数:8,代码来源:mainMenu.zone.php

示例8: create

 public function create($urlact)
 {
     if ($this->dataCreateUrl == null) {
         $sel = new jSelectorUrlCfgSig(jApp::config()->urlengine['significantFile']);
         jIncluder::inc($sel);
         $this->dataCreateUrl =& $GLOBALS['SIGNIFICANT_CREATEURL'];
     }
     $url = new jUrl('', $urlact->params, '');
     $module = $url->getParam('module', jContext::get());
     $action = $url->getParam('action');
     $id = $module . '~' . $action . '@' . $urlact->requestType;
     $urlinfo = null;
     if (isset($this->dataCreateUrl[$id])) {
         $urlinfo = $this->dataCreateUrl[$id];
         $url->delParam('module');
         $url->delParam('action');
     } else {
         $id = $module . '~*@' . $urlact->requestType;
         if (isset($this->dataCreateUrl[$id])) {
             $urlinfo = $this->dataCreateUrl[$id];
             if ($urlinfo[0] != 3 || $urlinfo[3] === true) {
                 $url->delParam('module');
             }
         } else {
             $id = '@' . $urlact->requestType;
             if (isset($this->dataCreateUrl[$id])) {
                 $urlinfo = $this->dataCreateUrl[$id];
             } else {
                 throw new Exception("Significant url engine doesn't find corresponding url to this action :" . $module . '~' . $action . '@' . $urlact->requestType);
             }
         }
     }
     if ($urlinfo[0] == 4) {
         $l = count($urlinfo);
         $urlinfofound = null;
         for ($i = 1; $i < $l; $i++) {
             $ok = true;
             foreach ($urlinfo[$i][7] as $n => $v) {
                 $specialStatic = $v[0] == '$';
                 $paramStatic = $url->getParam($n, null);
                 if ($specialStatic) {
                     $typePS = $v[1];
                     $v = substr($v, 2);
                     if ($typePS == 'l') {
                         if ($paramStatic === null) {
                             $paramStatic = jLocale::getCurrentLang();
                         } else {
                             if (preg_match('/^(\\w{2,3})_\\w{2,3}$/', $paramStatic, $m)) {
                                 $paramStatic = $m[1];
                             }
                         }
                     } elseif ($typePS == 'L') {
                         if ($paramStatic === null) {
                             $paramStatic = jApp::config()->locale;
                         } else {
                             if (preg_match('/^\\w{2,3}$/', $paramStatic, $m)) {
                                 $paramStatic = jLocale::langToLocale($paramStatic);
                             }
                         }
                     }
                 }
                 if ($paramStatic != $v) {
                     $ok = false;
                     break;
                 }
             }
             if ($ok) {
                 $urlinfofound = $urlinfo[$i];
                 break;
             }
         }
         if ($urlinfofound !== null) {
             $urlinfo = $urlinfofound;
         } else {
             $urlinfo = $urlinfo[1];
         }
     }
     $url->scriptName = jApp::config()->urlengine['basePath'] . $urlinfo[1];
     if ($urlinfo[2]) {
         $url->scriptName = jApp::coord()->request->getServerURI(true) . $url->scriptName;
     }
     if ($urlinfo[1] && !jApp::config()->urlengine['multiview']) {
         $url->scriptName .= jApp::config()->urlengine['entrypointExtension'];
     }
     if (in_array($urlact->requestType, array('xmlrpc', 'jsonrpc', 'soap'))) {
         $url->clearParam();
         return $url;
     }
     if ($urlinfo[0] == 0) {
         $s = new jSelectorUrlHandler($urlinfo[3]);
         $c = $s->resource . 'UrlsHandler';
         $handler = new $c();
         $handler->create($urlact, $url);
         if ($urlinfo[4] != '') {
             $url->pathInfo = $urlinfo[4] . $url->pathInfo;
         }
     } elseif ($urlinfo[0] == 1) {
         $pi = $urlinfo[5];
         foreach ($urlinfo[3] as $k => $param) {
             $typeParam = $urlinfo[4][$k];
//.........这里部分代码省略.........
开发者ID:havefnubb,项目名称:havefnubb,代码行数:101,代码来源:significant.urls.php


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