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


PHP Translator::getLocale方法代码示例

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


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

示例1: testSetGetLocale

 public function testSetGetLocale()
 {
     $translator = new Translator('en', new MessageSelector());
     $this->assertEquals('en', $translator->getLocale());
     $translator->setLocale('fr');
     $this->assertEquals('fr', $translator->getLocale());
 }
开发者ID:ronaldlunaramos,项目名称:webstore,代码行数:7,代码来源:TranslatorTest.php

示例2: editorReplace

 /**
  * @return string
  */
 public function editorReplace()
 {
     $toolbar = new Toolbar($this->urlGenerator, $this->toolbarSet, $this->config);
     $toolbar->setLanguage($this->translator->getLocale());
     $config = $toolbar->getConfig();
     $javascript = $this->toJavascript($config);
     $html = "<script>\n           CKEDITOR.replace('" . $this->name . "',\n               {$javascript}\n           );\n           </script>";
     return $html;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:12,代码来源:Editor.php

示例3: testSetValidLocale

 /**
  * @dataProvider getValidLocalesTests
  */
 public function testSetValidLocale($locale)
 {
     $translator = new Translator($locale, new MessageSelector());
     $translator->setLocale($locale);
     $this->assertEquals($locale, $translator->getLocale());
 }
开发者ID:Viduc,项目名称:tiremoidlaold,代码行数:9,代码来源:TranslatorTest.php

示例4: getLocale

 public function getLocale()
 {
     return $this->translator->getLocale();
 }
开发者ID:JoshyPHP,项目名称:flarum-core,代码行数:4,代码来源:LocaleManager.php

示例5: setHeaderParameters

 /**
  * Set header parameters
  */
 private function setHeaderParameters()
 {
     $_course = api_get_course_info();
     $_configuration = $this->app->getConfiguration();
     $this_section = $this->app['this_section'];
     $nameTools = $this->title;
     $navigation = $this->navigation_array;
     $this->menu_navigation = $navigation['menu_navigation'];
     $this->assign('system_charset', api_get_system_encoding());
     $this->assign('online_button', Display::return_icon('online.png'));
     $this->assign('offline_button', Display::return_icon('offline.png'));
     // Get language iso-code for this page - ignore errors
     $this->assign('document_language', $this->translator->getLocale());
     $course_title = isset($_course['name']) ? $_course['name'] : null;
     $title_list = array();
     $title_list[] = api_get_setting('platform.institution');
     $title_list[] = api_get_setting('platform.site_name');
     if (!empty($course_title)) {
         $title_list[] = $course_title;
     }
     if ($nameTools != '') {
         $title_list[] = $nameTools;
     }
     $title_string = '';
     for ($i = 0; $i < count($title_list); $i++) {
         $title_string .= $title_list[$i];
         if (isset($title_list[$i + 1])) {
             $item = trim($title_list[$i + 1]);
             if (!empty($item)) {
                 $title_string .= ' - ';
             }
         }
     }
     $this->assign('title_string', $title_string);
     // Setting the theme and CSS files.
     $this->setCssFiles();
     $this->setJsFiles();
     // Implementation of prefetch.
     // See http://cdn.chamilo.org/main/img/online.png for details
     $prefetch = '';
     if (!empty($_configuration['cdn_enable'])) {
         $prefetch .= '<meta http-equiv="x-dns-prefetch-control" content="on">';
         foreach ($_configuration['cdn'] as $host => $exts) {
             $prefetch .= '<link rel="dns-prefetch" href="' . $host . '">';
         }
     }
     $this->assign('prefetch', $prefetch);
     $this->assign('text_direction', api_get_text_direction());
     $this->assign('section_name', 'section-' . $this_section);
     $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_PATH) . 'favicon.ico" type="image/x-icon" />';
     /*if (isset($_configuration['multiple_access_urls']) &&
             $_configuration['multiple_access_urls']) {
                 $access_url_id = api_get_current_access_url_id();
                 if ($access_url_id != -1) {
                     $url_info = api_get_current_access_url_info();
                     $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url']));
                     $clean_url = api_replace_dangerous_char($url);
                     $clean_url = str_replace('/', '-', $clean_url);
                     $clean_url .= '/';
                     $homep = api_get_path(REL_PATH).'home/'.$clean_url; //homep for Home Path
                     $icon_real_homep = api_get_path(SYS_PATH).'home/'.$clean_url;
     
                     //we create the new dir for the new sites
                     if (is_file($icon_real_homep.'favicon.ico')) {
                         $favico = '<link rel="shortcut icon" href="'.$homep.'favicon.ico" type="image/x-icon" />';
                     }
                 }
             }*/
     //$this->assign('favico', $favico);
     $this->setHelp();
     $notification = $this->returnNotificationMenu();
     $this->assign('notification_menu', $notification);
     // Profile link.
     $this->assign('is_profile_editable', api_is_profile_readable());
     $visibility = api_is_allowed_to_create_course() ? \SystemAnnouncementManager::VISIBLE_TEACHER : \SystemAnnouncementManager::VISIBLE_STUDENT;
     $announcements = \SystemAnnouncementManager::getAnnouncements($visibility, null, 'resumed', false, 50);
     $this->assign('news_counter', count($announcements));
     $this->assign('news_list', $announcements);
     $profile_link = null;
     if (api_get_setting('social.allow_social_tool') == 'true') {
         $profile_link = $this->urlGenerator->generate('root') . 'social/home.php';
     } else {
         if (api_is_profile_readable()) {
             $profile_link = $this->urlGenerator->generate('root') . 'auth/profile.php';
         }
     }
     $this->assign('profile_link', $profile_link);
     $this->assign('settings_link', $this->urlGenerator->generate('root') . 'auth/profile.php');
     // Message link.
     $messageUrl = null;
     if (api_get_setting('message.allow_message_tool') == 'true') {
         $messageUrl = $this->urlGenerator->generate('root') . 'messages/inbox.php';
     }
     $this->assign('message_link', $messageUrl);
     $institution = api_get_setting('platform.institution');
     $portal_name = empty($institution) ? api_get_setting('platform.site_name') : $institution;
     $this->assign('portal_name', $portal_name);
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:Template.php


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