getLocale() public method

public getLocale ( )
 public function testSetGetLocale()
 {
     $translator = new Translator('en', new MessageSelector());
     $this->assertEquals('en', $translator->getLocale());
     $translator->setLocale('fr');
     $this->assertEquals('fr', $translator->getLocale());
 }
Esempio n. 2
0
 /**
  * @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;
 }
Esempio n. 3
0
 /**
  * @dataProvider getValidLocalesTests
  */
 public function testSetValidLocale($locale)
 {
     $translator = new Translator($locale, new MessageSelector());
     $translator->setLocale($locale);
     $this->assertEquals($locale, $translator->getLocale());
 }
Esempio n. 4
0
 public function getLocale()
 {
     return $this->translator->getLocale();
 }
Esempio n. 5
0
 /**
  * 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);
     // Menu.
     $menu = $this->returnMenu();
     $this->assign('menu', $menu);
     // Breadcrumb
     if ($this->loadBreadcrumb) {
         //$this->loadBreadcrumbToTemplate();
     }
     //$this->app['new_breadcrumb'] =
     // Extra content
     $extra_header = null;
     if (!api_is_platform_admin()) {
         //$extra_header = trim(api_get_setting('header_extra_content'));
     }
     $this->assign('header_extra_content', $extra_header);
 }