• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Languages类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getAllWebSiteLanguage

 public function getAllWebSiteLanguage()
 {
     $languageSelect = new Languages();
     $select = $languageSelect->select();
     $languageData = $languageSelect->fetchAll($select);
     return $languageData;
 }
开发者ID:anunay,项目名称:stentors,代码行数:7,代码来源:GetAllWebSiteLanguage.php


示例2: getMainform

 /**
  *
  */
 public function getMainform()
 {
     $this->setName('safinstances');
     $label = new Zend_Form_Element_Text('label');
     $label->setLabel('label');
     $label->setRequired(true);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Save');
     $submit->setAttrib('id', 'submitbuttona');
     $domain = new Zend_Form_Element_Text('domain');
     $domain->setLabel('Main domain name');
     $domain->setRequired(true);
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel('Description');
     $languagesId = new Zend_Form_Element_Select('languages_id');
     $options = new Languages();
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         $languagesId->addMultiOption($k, $v['mlabel']);
     }
     $languagesId->setLabel('Main language');
     $creationdate = new Zend_Form_Element_Text('creationdate');
     $creationdate->setLabel('Creation date');
     $offlinedate = new Zend_Form_Element_Text('offlinedate');
     $offlinedate->setLabel('Offline date');
     $active = new Zend_Form_Element_Checkbox('active');
     $active->setLabel('Is Active?');
     $offlinemessage = new Zend_Form_Element_Textarea('offlinemessage');
     $offlinemessage->setLabel('Offline message');
     $this->addElements(array($this->idb, $this->hashb, $label, $domain, $description, $languagesId, $creationdate, $offlinedate, $active, $offlinemessage));
     $this->addElements(array($submit));
     return $this;
 }
开发者ID:Cryde,项目名称:sydney-core,代码行数:35,代码来源:SafinstancesFormOp.php


示例3: constructRulesUsingCallBack

function constructRulesUsingCallBack($rules, \Languages $langs, $task)
{
    foreach ($rules as $fieldType => $rule) {
        foreach ($langs->all() as $lang) {
            $task($langRules, $fieldType, $lang, $rule);
        }
    }
    return $langRules;
}
开发者ID:JoshuaReneDalley,项目名称:php,代码行数:9,代码来源:callback.php


示例4: Show

 public function Show($parameters)
 {
     $output = "";
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $mainviewhelper = new Zend_View();
     $mainviewhelper->addBasePath(APPLICATION_PATH . '/modules/default/views/');
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['code'])) {
         $code = $parameters['code'];
     } else {
         return "";
     }
     // Get the products
     $data = Products::GetProductsByGroupCode($code, $languageID);
     // Check the existence of the mandatories attributes
     if (!empty($data['attributes'][0])) {
         $view->attributes = $data['attributes'];
     }
     // Check if there are values set for the group of the product selected
     if (!empty($data['attributes_values'][0])) {
         $view->values = $data['attributes_values'];
     }
     // Get the products
     if (!empty($data['products'][0])) {
         $view->products = $data['products'];
     }
     $view->mainviewhelper = $mainviewhelper;
     // Path of the template
     return $view->render('productsattributes.phtml');
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:33,代码来源:Productlistattributes.php


示例5: _initLanguages

 protected function _initLanguages()
 {
     $this->languages = \Languages::findByPublished(true);
     if (sizeof($this->languages) < 2) {
         $this->currentLang = $this->languages[0];
         return;
     }
     $currentLangCode = $this->request()->get('lang');
     if (!$currentLangCode) {
         $currentLangCode = Factory::getCookie()->read('lang');
     }
     if (!$currentLangCode) {
         $this->currentLang = \Languages::findOneByDefault(true);
         $currentLangCode = $this->currentLang->getLangCode();
     }
     Factory::getCookie()->write('lang', $currentLangCode);
     if (Factory::getRouter()->getUrl() == '/' && !$this->request()->get('lang')) {
         $this->redirect($currentLangCode);
     }
     if (!$this->currentLang) {
         $this->currentLang = \Languages::findOneByLangCode($currentLangCode);
     }
     $translator = Translator::getInstance();
     $translator->setLocale($currentLangCode);
     Cms::$currentLang = $this->currentLang;
 }
开发者ID:hosivan90,项目名称:toxotes,代码行数:26,代码来源:Controller.php


示例6: details

 /**
  * Show template details page
  *
  * @param void
  * @return null
  */
 function details()
 {
     if ($this->active_template->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     $template_data = $this->request->post('template');
     if (!is_array($template_data)) {
         $template_data = array('subject' => $this->active_template->getSubject(), 'body' => $this->active_template->getBody());
     }
     // if
     $this->smarty->assign(array('template' => $template, 'template_data' => $template_data, 'languages' => Languages::findAll()));
     if ($this->request->isSubmitted()) {
         $this->active_template->setAttributes($template_data);
         $save = $template->save();
         if ($save && !is_error($save)) {
             flash_success('Email template has been updated');
             $this->redirectTo('admin_settings_email_templates');
         } else {
             $this->smarty->assign('errors', $save);
         }
         // if
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:31,代码来源:EmailTemplatesAdminController.class.php


示例7: preDispatch

 /**
  * Load all the resources
  * @see Zend_Controller_Action::preDispatch()
  */
 public function preDispatch()
 {
     $module = $this->getRequest()->getModuleName();
     $controller = $this->getRequest()->getControllerName();
     // Get all the resources set in the layout.xml file
     $css = Shineisp_Commons_Layout::getResources($module, $controller, "css", "base");
     $js = Shineisp_Commons_Layout::getResources($module, $controller, "js", "base");
     $template = Shineisp_Commons_Layout::getTemplate($module, $controller, "base");
     $this->view->doctype('XHTML1_TRANSITIONAL');
     $this->view->addBasePath(PUBLIC_PATH . "/skins/setup/base/");
     $this->view->headTitle("ShineISP Setup");
     $this->view->headMeta()->setName('robots', "INDEX, FOLLOW");
     $this->view->headMeta()->setName('author', "Shine Software Company");
     $this->view->headMeta()->setName('keywords', "shine software, isp software");
     $this->view->headMeta()->setName('description', "This is the ShineISP setup configuration");
     $this->view->headLink()->headLink(array('rel' => 'icon', 'type' => 'image/x-icon', 'href' => "/skins/{$module}/base/images/favicon.ico"));
     $this->view->headTitle()->setSeparator(' - ');
     foreach ($js as $item) {
         $this->view->headScript()->appendFile($item['resource']);
     }
     foreach ($css as $item) {
         $this->view->headLink()->appendStylesheet($item['resource']);
     }
     $this->getHelper('layout')->setLayout('1column');
     $session = new Zend_Session_Namespace('setup');
     Languages::setDefaultLanguage(PUBLIC_PATH, $session->locale);
     if (empty($session->db)) {
         $this->_helper->redirector('index', 'database', 'setup');
     }
     if (empty($session->permissions) || $session->permissions == false) {
         $this->_helper->redirector('index', 'checker', 'setup');
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:37,代码来源:PreferencesController.php


示例8: init

 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'title', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Title'), 'class' => 'form-control'));
     $this->addElement('textarea', 'body', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Body'), 'class' => 'form-control col-lg-12'));
     $this->addElement('text', 'var', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('URL-Key'), 'description' => $translate->_('This is the name of the page. For multilanguages website you can create more page with the same Url-key with different languages.'), 'rows' => 5, 'class' => 'form-control'));
     $this->addElement('textarea', 'keywords', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Keywords'), 'rows' => 5, 'description' => $translate->_('separate each keyword by a comma'), 'class' => 'col-lg-12 form-control'));
     $this->addElement('textarea', 'blocks', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Blocks'), 'class' => 'form-control'));
     $this->addElement('textarea', 'xmllayout', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('XML Layout'), 'class' => 'form-control'));
     $this->addElement('checkbox', 'blog', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('is Blog post'), 'class' => 'form-control'));
     $this->addElement('select', 'parent_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Parent'), 'class' => 'form-control'));
     $this->getElement('parent_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getList(true));
     $this->addElement('select', 'layout', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Content layouts'), 'class' => 'form-control'));
     $this->getElement('layout')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getLayouts());
     $this->addElement('select', 'pagelayout', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Page layouts'), 'class' => 'form-control'));
     $this->getElement('pagelayout')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getPageLayouts());
     $this->addElement('multiselect', 'language_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Language'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 3', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4 col-sm-4'));
     $this->getElement('language_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Languages::getList());
     $this->addElement('checkbox', 'showinmenu', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Show in the navigation menu'), 'class' => 'form-control'));
     $this->addElement('checkbox', 'showonrss', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Publish on RSS Feed'), 'class' => 'form-control'));
     $this->addElement('checkbox', 'active', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Active'), 'class' => 'form-control'));
     $this->addElement('hidden', 'page_id');
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:25,代码来源:CmspagesForm.php


示例9: Iterator

 /**
  * Iterator
  * Get all the blocks and attach the content within the view called 
  * @param array $blocks
  * @param string $side
  */
 private function Iterator($blocks, $side)
 {
     $ns = new Zend_Session_Namespace('Admin');
     $languageID = Languages::get_language_id($ns->lang);
     if (!empty($blocks['side'])) {
         if ($blocks['side'] == $side) {
             $blocks = $blocks['block'];
             if (count($blocks) > 1) {
                 foreach ($blocks as $block) {
                     $block = CmsBlocks::findbyvar($block['name'], $languageID);
                     if (!empty($block[0]['body'])) {
                         echo $block[0]['body'];
                     }
                 }
             } else {
                 $block = CmsBlocks::findbyvar($blocks['name'], $languageID);
                 if (!empty($block[0]['body'])) {
                     echo $block[0]['body'];
                 } else {
                     echo $blocks['name'] . " block not found.";
                 }
             }
         }
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:31,代码来源:Blocks.php


示例10: instance

 private static function instance()
 {
     if (!self::$instance instanceof Languages) {
         self::$instance = new Languages();
     }
     return self::$instance;
 }
开发者ID:siimsoni,项目名称:languages,代码行数:7,代码来源:class.languages.php


示例11: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $this->setName('safinstances');
     $id = new Zend_Form_Element_Hidden('id');
     $hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $label = new Zend_Form_Element_Text('label');
     $label->setLabel('label');
     $domain = new Zend_Form_Element_Text('domain');
     $domain->setLabel('domain');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel('description');
     $rootpath = new Zend_Form_Element_Text('rootpath');
     $rootpath->setLabel('rootpath');
     $languagesId = new Zend_Form_Element_Select('languages_id');
     $options = new Languages();
     $languagesId->addMultiOption('', '----------');
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         $languagesId->addMultiOption($k, $v['mlabel']);
     }
     $languagesId->setLabel('languages_id');
     $database = new Zend_Form_Element_Text('database');
     $database->setLabel('database');
     $secdomains = new Zend_Form_Element_Text('secdomains');
     $secdomains->setLabel('secdomains');
     $creationdate = new Zend_Form_Element_Text('creationdate');
     $creationdate->setLabel('creationdate');
     $offlinedate = new Zend_Form_Element_Text('offlinedate');
     $offlinedate->setLabel('offlinedate');
     $active = new Zend_Form_Element_Checkbox('active');
     $active->setLabel('active');
     $offlinemessage = new Zend_Form_Element_Text('offlinemessage');
     $offlinemessage->setLabel('offlinemessage');
     $metatags = new Zend_Form_Element_Text('metakeywords');
     $metatags->setLabel('metakeywords');
     $pagMenusSafinstances = new PagmenuslistForm('PagmenusSafinstances');
     $pagMenusSafinstances->setLabel('PagmenusSafinstances');
     $safinstancesSafModules = new SafmoduleslistForm('SafinstancesSafmodules');
     $safinstancesSafModules->setLabel('SafinstancesSafmodules');
     $safinstancesUsers = new UserslistForm('SafinstancesUsers');
     $safinstancesUsers->setLabel('SafinstancesUsers');
     $this->addElements(array($id, $hash, $label, $domain, $description, $rootpath, $languagesId, $database, $secdomains, $creationdate, $offlinedate, $active, $offlinemessage, $safinstancestypeId, $metatags, $pagMenusSafinstances, $safinstancesSafModules, $safinstancesUsers));
     $this->addElements(array($submit));
 }
开发者ID:Cryde,项目名称:sydney-core,代码行数:47,代码来源:SafinstancesForm.php


示例12: init

 public function init()
 {
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $this->addElement('select', 'locale', array('decorators' => array('Bootstrap'), 'label' => 'Language', 'class' => 'form-control', 'multioptions' => Languages::getLanguageFiles(PUBLIC_PATH . "/languages")));
     $this->addElement('textarea', 'agreement', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'label' => 'Agreements', 'rows' => '10', 'value' => Shineisp_Commons_Utilities::readfile(PUBLIC_PATH . "/../LICENSE")));
     $this->addElement('select', 'chkagreement', array('decorators' => array('Bootstrap'), 'label' => 'I agree with the legal terms', 'class' => 'form-control', 'multioptions' => array(1 => 'YES, I agree with the legal terms', 0 => 'NO, I disagree with these legal terms')));
     $this->addElement('submit', 'submit', array('label' => 'Continue', 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary btn-lg'));
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:8,代码来源:LocalizationForm.php


示例13: DropDown

 public static function DropDown()
 {
     $res = array();
     foreach (Languages::model()->findAll() as $record) {
         $res[$record->idLanguages] = $record->LanguagesName;
     }
     return $res;
 }
开发者ID:upmunspel,项目名称:abiturient,代码行数:8,代码来源:Languages.php


示例14: execute

 public function execute()
 {
     if (!function_exists('memory_get_usage')) {
         $this->error("You must compile PHP with --enable-memory-limit", true);
     }
     $langtool = new Languages();
     $memlast = $memstart = memory_get_usage();
     $this->output("Base memory usage: {$memstart}\n");
     foreach ($langtool->getLanguages() as $langcode) {
         Language::factory($langcode);
         $memstep = memory_get_usage();
         $this->output(sprintf("%12s: %d\n", $langcode, $memstep - $memlast));
         $memlast = $memstep;
     }
     $memend = memory_get_usage();
     $this->output(' Total Usage: ' . ($memend - $memstart) . "\n");
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:17,代码来源:langmemusage.php


示例15: getTranslations

 /**
  * Get the list of the languages by page_id
  * 
  *  
  * @param integer $index
  */
 public static function getTranslations($pageid)
 {
     $items = array();
     $records = Doctrine_Query::create()->from('CmsPagesData')->where("page_id = ?", $pageid)->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     foreach ($records as $record) {
         $items[] = Languages::getLanguageLabel($record['language_id']);
     }
     return implode(", ", $items);
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:15,代码来源:CmsPagesData.php


示例16: executeLogin

 public function executeLogin()
 {
     $this->document()->title = t('Login');
     $this->setLayout('login');
     $this->setView('Login/default');
     /** @var CMSBackendAuth $backendAuth */
     $backendAuth = CMSBackendAuth::getInstance();
     $comeback = $this->get('r');
     $comeback = null != $comeback ? urldecode($comeback) : '/';
     if ($backendAuth->isCMSBackendAuthenticated()) {
         $this->redirect($comeback);
     }
     $display = $this->post('credential');
     if (!$display) {
         $display = Factory::getCookie()->read('username');
     }
     $languages = \Languages::getAllActiveLanguages('lang_code');
     $error = array();
     if ($this->request()->isPostRequest()) {
         //check captcha first
         $password = $this->post('password');
         $credential = $this->post('credential');
         //don't care display name
         $chosen_lang = $this->post('language');
         Factory::getCookie()->write('language', $chosen_lang);
         /*$captcha = $this->post('captcha');*/
         Factory::getCookie()->write('username', $credential);
         /*if(Math::check($captcha)==false) {
               $error[] = t('Sai rồi, tính nhẩm kém quá');
           }*/
         if (empty($error) && true === ($result = $backendAuth->authenticate($credential, $password))) {
             //authenticated, redirect to pre-page
             $this->redirect($comeback);
         } else {
             if (isset($result)) {
                 switch ($result) {
                     case CMSBackendAuth::ERROR_USER_NOT_ACCESS_ADMIN:
                         $error[] = t('Restricted area, no permission');
                         break;
                     case CMSBackendAuth::ERROR_CREDENTIAL_INVALID:
                         $error[] = t('Plz re-enter your email or your password');
                         break;
                     case CMSBackendAuth::ERROR_UNKNOWN_IDENTITY:
                         $error[] = t('Unknown identity');
                         break;
                     default:
                         $error[] = t('Login fail');
                 }
             }
         }
     }
     $this->view()->assign('display', $display);
     $this->view()->assign('error', $error);
     $this->view()->assign('current_lang', $this->currentLang ? $this->currentLang->getLangCode() : '');
     $this->view()->assign('languages', $languages);
     return $this->renderComponent();
 }
开发者ID:hosivan90,项目名称:toxotes,代码行数:57,代码来源:Login.php


示例17: Show

 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     // Generate the xml file in the public path /documents
     Reviews::getXMLDataMap($languageID);
     return $view->render('reviewsmap.phtml');
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:10,代码来源:ReviewsMap.php


示例18: init

 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'var', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Var'), 'class' => 'form-control'));
     $this->addElement('text', 'title', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Title'), 'class' => 'form-control'));
     $this->addElement('textarea', 'body', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Body'), 'class' => 'col-lg-12 form-control'));
     $this->addElement('multiselect', 'language_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Language'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
     $this->getElement('language_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Languages::getList());
     $this->addElement('hidden', 'block_id');
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:12,代码来源:CmsblocksForm.php


示例19: init

 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'language', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Language'), 'description' => $translate->_('Set the name of the language'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'locale', array('filters' => array('StringTrim'), 'label' => $translate->_('Locale'), 'description' => $translate->_('Write here the name of the locale (eg. en_US).'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'code', array('filters' => array('StringTrim'), 'label' => $translate->_('Code'), 'description' => $translate->_('Write here the name of the locale (eg. en). '), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => Languages::getLanguageFiles()));
     $this->addElement('checkbox', 'active', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Active'), 'class' => 'form-control'));
     $this->addElement('select', 'base', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Base'), 'class' => 'form-control', 'description' => $translate->_('Set the main translation language'), 'multioptions' => array(0 => 'NO', 1 => 'YES, It is the default language')));
     $this->addElement('hidden', 'language_id');
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:12,代码来源:LanguagesForm.php


示例20: _loadLanguage

 /**
  * load languages
  */
 private function _loadLanguage()
 {
     $i18nCfg = ConfigHandler::get('i18n');
     if (!$i18nCfg['enable']) {
         return null;
     }
     $current_lang_code = $this->get('lang');
     if (!$current_lang_code) {
         $current_lang_code = Factory::getCookie()->read('language');
     }
     if (!$current_lang_code) {
         $this->currentLang = \Languages::retrieveByDefault(1);
         $current_lang_code = $this->currentLang->getLangCode();
     } else {
         $this->currentLang = \Languages::retrieveByLangCode($current_lang_code);
     }
     if ($current_lang_code) {
         Factory::getCookie()->write('language', $current_lang_code);
     }
     //load message
     $translator = Translator::getInstance();
     $translator->setLocale($current_lang_code);
     if ($translator) {
         $translator->addLoader('yml', new YamlFileLoader());
         if (isset($i18nCfg['resource']) && is_array($i18nCfg['resource'])) {
             foreach ($i18nCfg['resource'] as $locale => $files) {
                 for ($i = 0, $size = sizeof($files); $i < $size; ++$i) {
                     $fileInfo = new \SplFileInfo($files[$i]);
                     $filename = $fileInfo->getFilename();
                     $ext = $fileInfo->getExtension();
                     if ($ext == 'yml') {
                         $domain = str_replace('.' . $fileInfo->getExtension(), '', $fileInfo->getFilename());
                         $translator->addResource('yml', $files[$i], $locale, $domain);
                     }
                 }
             }
         }
     }
 }
开发者ID:hosivan90,项目名称:toxotes,代码行数:42,代码来源:CMSBackendBase.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP LanguagesHelper类代码示例发布时间:2022-05-23
下一篇:
PHP Language_Pack_Upgrader类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap