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


PHP api_get_language_isocode函数代码示例

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


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

示例1: HTML_QuickForm_datepicker

    /**
     * Constructor
     */
    public function HTML_QuickForm_datepicker($elementName = null, $elementLabel = null, $attributes = null, $optionIncrement = null)
    {
        $js_form_name = api_get_unique_id();
        HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
        $this->_persistantFreeze = true;
        $this->_appendName = true;
        $this->_type = 'datepicker';
        $popup_link = '<a href="javascript:openCalendar(\'' . $js_form_name . '\',\'' . $elementName . '\')">
		<img src="' . api_get_path(WEB_IMG_PATH) . 'calendar_select.gif" style="vertical-align:middle;" alt="Select Date" /></a>';
        $hour_minute_devider = get_lang("HourMinuteDivider");
        $special_chars = array('D', 'l', 'd', 'M', 'F', 'm', 'y', 'H', 'a', 'A', 's', 'i', 'h', 'g', ' ');
        foreach ($special_chars as $char) {
            $popup_link = str_replace($char, "\\" . $char, $popup_link);
            $hour_minute_devider = str_replace($char, "\\" . $char, $hour_minute_devider);
        }
        $lang_code = api_get_language_isocode();
        // If translation not available in PEAR::HTML_QuickForm_date, add the Chamilo-translation
        if (!array_key_exists($lang_code, $this->_locale)) {
            $this->_locale[$lang_code]['months_long'] = api_get_months_long();
        }
        $this->_options['format'] = 'dFY ' . $popup_link . '   H ' . $hour_minute_devider . ' i';
        $this->_options['minYear'] = date('Y') - 5;
        $this->_options['maxYear'] = date('Y') + 10;
        $this->_options['language'] = $lang_code;
        if (isset($optionIncrement)) {
            $this->_options['optionIncrement']['i'] = intval($optionIncrement);
        }
    }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:datepicker_old.php

示例2: HTML_QuickForm_datepickerdate

 /**
  * Constructor
  */
 function HTML_QuickForm_datepickerdate($elementName = null, $elementLabel = null, $attributes = null)
 {
     global $myMinYear, $myMaxYear;
     $js_form_name = $attributes['form_name'];
     unset($attributes['form_name']);
     HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
     $this->_persistantFreeze = true;
     $this->_appendName = true;
     $this->_type = 'datepicker';
     $popup_link = '<a href="javascript:openCalendar(\'' . $js_form_name . '\',\'' . $elementName . '\')"><img src="' . api_get_path(WEB_IMG_PATH) . 'calendar_select.gif" style="vertical-align:middle;" alt="Select Date" /></a>';
     $special_chars = array('D', 'l', 'd', 'M', 'F', 'm', 'y', 'H', 'a', 'A', 's', 'i', 'h', 'g', ' ');
     foreach ($special_chars as $index => $char) {
         $popup_link = str_replace($char, "\\" . $char, $popup_link);
     }
     $lang_code = api_get_language_isocode();
     // If translation not available in PEAR::HTML_QuickForm_date, add the Chamilo-translation
     if (!array_key_exists($lang_code, $this->_locale)) {
         $this->_locale[$lang_code]['months_long'] = api_get_months_long();
     }
     $this->_options['format'] = 'dFY ' . $popup_link;
     $this->_options['minYear'] = date('Y') - 5;
     $this->_options['maxYear'] = date('Y') + 10;
     $this->_options['language'] = $lang_code;
     //$this->_options['addEmptyOption'] = true;
     //$this->_options['emptyOptionValue'] = 0;
     //$this->_options['emptyOptionText'] = ' -- ';
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:30,代码来源:datepickerdate.php

示例3: utf8_sort

 /**
  * @param $array
  * @return mixed
  */
 public static function utf8_sort($array)
 {
     $old_locale = setlocale(LC_ALL, null);
     $code = api_get_language_isocode();
     $locale_list = array($code . '.utf8', 'en.utf8', 'en_US.utf8', 'en_GB.utf8');
     $try_sort = false;
     foreach ($locale_list as $locale) {
         $my_local = setlocale(LC_COLLATE, $locale);
         if ($my_local) {
             $try_sort = true;
             break;
         }
     }
     if ($try_sort) {
         uasort($array, 'strcoll');
     }
     setlocale(LC_COLLATE, $old_locale);
     return $array;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:23,代码来源:array.lib.php

示例4: set_header_parameters

    /**
     * Set header parameters
     */
    private function set_header_parameters()
    {
        global $httpHeadXtra, $_course, $interbreadcrumb, $language_file, $noPHP_SELF, $_configuration, $this_section;
        $help = $this->help;
        $nameTools             = $this->title;
        $navigation            = return_navigation_array();
        $this->menu_navigation = $navigation['menu_navigation'];

        $this->assign('system_charset', api_get_system_encoding());

        if (isset($httpHeadXtra) && $httpHeadXtra) {
            foreach ($httpHeadXtra as & $thisHttpHead) {
                header($thisHttpHead);
            }
        }

        $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', api_get_language_isocode());

        $course_title = isset($_course['name']) ? $_course['name'] : null;

        $title_list = array();

        $title_list[] = api_get_setting('Institution');
        $title_list[] = api_get_setting('siteName');

        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->set_css_files();
        $this->set_js_files();
        //$this->set_js_files_post();

        $browser = api_browser_support('check_browser');
        if ($browser[0] == 'Internet Explorer' && $browser[1] >= '11') {
            $browser_head = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />';
            $this->assign('browser_specific_head', $browser_head);
        }

        // 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_access_url($access_url_id);
                $url       = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url']));
                $clean_url = 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->set_help();
//.........这里部分代码省略.........
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:101,代码来源:template.lib.php

示例5: dirname

/* For licensing terms, see /license.txt */
$language_file = 'agenda';
require_once dirname(__FILE__) . '/../../../global.inc.php';
//session
if (isset($_GET['id_session'])) {
    $_SESSION['id_session'] = Security::remove_XSS($_GET['id_session']);
}
// the variables for the days and the months
// Defining the shorts for the days
$DaysShort = api_get_week_days_short();
// Defining the days of the week to allow translation of the days
$DaysLong = api_get_week_days_long();
// Defining the months of the year to allow translation of the months
$MonthsLong = api_get_months_long();
$iso_lang = api_get_language_isocode($language_interface);
header('Content-Type: text/html; charset=' . api_get_system_encoding());
?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
echo $iso_lang;
?>
" lang="<?php 
echo $iso_lang;
?>
">
<head>
<title>Calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:30,代码来源:calendar_popup.php

示例6: array

        $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']);
    }
}
Display::display_header($nameTools, 'Doc');
echo '<div class="actions">';
echo '<a href="document.php?id=' . $document_id . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
///pixlr
// max size 1 Mb ??
$title = urlencode(utf8_encode(get_lang('NewImage')));
//TODO:check
//
$image = api_get_path(WEB_IMG_PATH) . 'canvas1024x768.png';
//
$pixlr_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn');
$langpixlr = api_get_language_isocode();
$langpixlr = isset($pixlr_code_translation_table[$langpixlr]) ? $pixlredit_code_translation_table[$langpixlr] : $langpixlr;
$loc = $langpixlr;
// deprecated ?? TODO:check pixlr read user browser
$exit_path = api_get_path(WEB_CODE_PATH) . 'document/exit_pixlr.php';
$_SESSION['exit_pixlr'] = $document_data['path'];
$referrer = "Chamilo";
$target_path = api_get_path(WEB_CODE_PATH) . 'document/save_pixlr.php';
$target = $target_path;
$locktarget = "true";
$locktitle = "false";
if ($_SERVER['HTTP_HOST'] == "localhost") {
    $path_and_file = api_get_path(SYS_SERVER_ROOT_PATH) . '/crossdomain.xml';
    if (!file_exists($path_and_file)) {
        $crossdomain = '<?xml version="1.0"?>
			<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:create_paint.php

示例7: _api_get_locale_from_language

/**
 * Returns isocode (see api_get_language_isocode()) which is purified accordingly to
 * be used by the php intl extension (ICU library).
 * @param string $language (optional)	This is the name of the folder containing translations for the corresponding language.
 * If $language is omitted, interface language is assumed then.
 * @return string						The found language locale id or null on error. Examples: bg, en, pt_BR, ...
 */
function _api_get_locale_from_language($language = null)
{
    static $locale = array();
    if (empty($language)) {
        $language = api_get_interface_language();
    }
    if (!isset($locale[$language])) {
        $locale[$language] = str_replace('-', '_', api_get_language_isocode($language));
    }
    return $locale[$language];
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:18,代码来源:internationalization_internal.lib.php

示例8: scorm_export


//.........这里部分代码省略.........
            //error_log(__LINE__.'checking existence of '.$main_path.$file_path.'', 0);
            if (!is_file($main_path . $file_path) || !is_readable($main_path . $file_path)) {
                continue;
            }
            //error_log(__LINE__.'getting document from '.$main_path.$file_path.' removing '.api_get_path(SYS_COURSE_PATH).$_course['path'].'/', 0);
            $dest_file = $archive_path . $temp_dir_short . '/document/' . $file_path;
            $this->create_path($dest_file);
            //error_log('Created path '.api_get_path(SYS_ARCHIVE_PATH).$temp_dir_short.'/document/'.$file_path, 0);
            //error_log('copy '.api_get_path(SYS_COURSE_PATH).$_course['path'].'/'.$file_path.' to '.api_get_path(SYS_ARCHIVE_PATH).$temp_dir_short.'/'.$file_path, 0);
            //echo $main_path.$file_path.' - '.$dest_file.'<br />';
            copy($main_path . $file_path, $dest_file);
            // Check if the file needs a link update.
            if (in_array($file_path, array_keys($link_updates))) {
                $string = file_get_contents($dest_file);
                unlink($dest_file);
                foreach ($link_updates[$file_path] as $old_new) {
                    //error_log('Replacing '.$old_new['orig'].' by '.$old_new['dest'].' in '.$file_path, 0);
                    // This is an ugly hack that allows .flv files to be found by the flv player that
                    // will be added in document/main/inc/lib/flv_player/flv_player.swf and that needs
                    // to find the flv to play in document/main/, so we replace main/ in the flv path by
                    // ../../.. to return from inc/lib/flv_player to the document/main path.
                    if (substr($old_new['dest'], -3) == 'flv' && substr($old_new['dest'], 0, 5) == 'main/') {
                        $old_new['dest'] = str_replace('main/', '../../../', $old_new['dest']);
                    }
                    $string = str_replace($old_new['orig'], $old_new['dest'], $string);
                }
                file_put_contents($dest_file, $string);
            }
        }
        if (is_array($links_to_create)) {
            foreach ($links_to_create as $file => $link) {
                $file_content = '<!DOCTYPE html>
    <head>
                   <meta charset="' . api_get_language_isocode() . '" />
        <title>' . $link['title'] . '</title>
    </head>
    <body dir="' . api_get_text_direction() . '">
                        <div style="text-align:center">
                        <a href="' . $link['url'] . '">' . $link['title'] . '</a></div>
    </body>
</html>';
                file_put_contents($archive_path . $temp_dir_short . '/' . $file, $file_content);
            }
        }
        // Add non exportable message explanation.
        $lang_not_exportable = get_lang('ThisItemIsNotExportable');
        $file_content = '<!DOCTYPE html>
    <head>
            <meta charset="' . api_get_language_isocode() . '" />
        <title>' . $lang_not_exportable . '</title>
        <meta http-equiv="Content-Type" content="text/html; charset=' . api_get_system_encoding() . '" />
    </head>
        <body dir="' . api_get_text_direction() . '">';
        $file_content .= <<<EOD
        <style>
            .error-message {
                font-family: arial, verdana, helvetica, sans-serif;
                border-width: 1px;
                border-style: solid;
                left: 50%;
                margin: 10px auto;
                min-height: 30px;
                padding: 5px;
                right: 50%;
                width: 500px;
                background-color: #FFD1D1;
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:67,代码来源:learnpath.class.php

示例9: set_header_parameters

    /**
     * Set header parameters
     * @param bool $sendHeaders send headers
     */
    private function set_header_parameters($sendHeaders)
    {
        global $httpHeadXtra, $interbreadcrumb, $language_file, $_configuration, $this_section;
        $_course = api_get_course_info();
        $help = $this->help;
        $nameTools = $this->title;
        $navigation = return_navigation_array();
        $this->menu_navigation = $navigation['menu_navigation'];
        $this->assign('system_charset', api_get_system_encoding());
        if (isset($httpHeadXtra) && $httpHeadXtra) {
            foreach ($httpHeadXtra as &$thisHttpHead) {
                header($thisHttpHead);
            }
        }
        $this->assign('online_button', Display::return_icon('statusonline.png', null, null, ICON_SIZE_ATOM));
        $this->assign('offline_button', Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM));
        // Get language iso-code for this page - ignore errors
        $this->assign('document_language', api_get_language_isocode());
        $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
        $css = $this->setCssFiles();
        $this->set_js_files();
        $this->setCssCustomFiles($css);
        //$this->set_js_files_post();
        $browser = api_browser_support('check_browser');
        if ($browser[0] == 'Internet Explorer' && $browser[1] >= '11') {
            $browser_head = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />';
            $this->assign('browser_specific_head', $browser_head);
        }
        // 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);
        //Defaul root chamilo favicon
        $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_PATH) . 'favicon.ico" type="image/x-icon" />';
        //Added to verify if in the current Chamilo Theme exist a favicon
        $favicoThemeUrl = api_get_path(SYS_CSS_PATH) . 'themes/' . $this->theme . '/images/';
        //If exist pick the current chamilo theme favicon
        if (is_file($favicoThemeUrl . 'favicon.ico')) {
            $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/images/favicon.ico" type="image/x-icon" />';
        }
        if (api_is_multiple_url_enabled()) {
            $access_url_id = api_get_current_access_url_id();
            if ($access_url_id != -1) {
                $url_info = api_get_access_url($access_url_id);
                $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_APP_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();
        //@todo move this in the template
        $bug_notification_link = '';
        if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) {
            $bug_notification_link = '<li class="report">
		        						<a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank">
		        						<img src="' . api_get_path(WEB_IMG_PATH) . 'bug.large.png" style="vertical-align: middle;" alt="' . get_lang('ReportABug') . '" title="' . get_lang('ReportABug') . '"/></a>
		    						  </li>';
        }
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:template.lib.php

示例10: toHtml

    /**
     * The ajax call must contain an array of id and text
     * @return string
     */
    public function toHtml()
    {
        $formatResult = $this->getAttribute('formatResult');
        $formatCondition = null;
        if (!empty($formatResult)) {
            $formatCondition = ',
                templateResult : ' . $formatResult . ',
                templateSelection : ' . $formatResult;
        }
        $width = 'element';
        $givenWidth = '100%';
        if (!empty($givenWidth)) {
            $width = $givenWidth;
        }
        //Get the minimumInputLength for select2
        $minimumInputLength = $this->getAttribute('minimumInputLength') > 3 ? $this->getAttribute('minimumInputLength') : 3;
        $plHolder = $this->getAttribute('placeholder');
        if (empty($plHolder)) {
            $plHolder = get_lang('SelectAnOption');
        }
        $id = $this->getAttribute('id');
        if (empty($id)) {
            $id = $this->getAttribute('name');
            $this->setAttribute('id', $id);
        }
        //$iso = Container
        $url = $this->getAttribute('url');
        $iso = api_get_language_isocode();
        $languageCondition = "language: '{$iso}',";
        if (!$url) {
            $url = $this->getAttribute('url_function');
        } else {
            $url = "'{$url}'";
        }
        $html = <<<JS
            <script>
                \$(function(){
                    \$('#{$this->getAttribute('id')}').select2({
                        {$languageCondition}
                        placeholder: '{$plHolder}',
                        allowClear: true,
                        width: '{$width}',
                        minimumInputLength: '{$minimumInputLength}',
                        ajax: {
                            url: {$url},
                            dataType: 'json',
                            data: function(params) {
                                return {
                                    q: params.term, // search term
                                    page_limit: 10,
                                };
                            },
                            processResults: function (data, page) {
                                //parse the results into the format expected by Select2
                                return {
                                    results: data.items
                                };
                            }
                            {$formatCondition}
                        }
                    });
                });
            </script>
JS;
        $this->removeAttribute('formatResult');
        $this->removeAttribute('minimumInputLength');
        $this->removeAttribute('placeholder');
        $this->removeAttribute('class');
        $this->removeAttribute('url');
        $this->removeAttribute('url_function');
        $this->setAttribute('style', 'width: 100%;');
        return parent::toHtml() . $html;
    }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:77,代码来源:SelectAjax.php

示例11: return_help

 function return_help()
 {
     $user_selected_language = api_get_language_isocode();
     $sys_path = api_get_path(SYS_PATH);
     $platformLanguage = api_get_setting('language.platform_language');
     // Help section.
     /* Hide right menu "general" and other parts on anonymous right menu. */
     if (!isset($user_selected_language)) {
         $user_selected_language = $platformLanguage;
     }
     $html = null;
     $home_menu = @(string) file_get_contents($sys_path . $this->home . 'home_menu_' . $user_selected_language . '.html');
     if (!empty($home_menu)) {
         $home_menu_content = '<ul class="nav nav-pills nav-stacked">';
         $home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
         $home_menu_content .= '</ul>';
         $html .= self::show_right_block(get_lang('MenuGeneral'), $home_menu_content, 'help_block', null, 'helps', 'helpsCollapse');
     }
     return $html;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:20,代码来源:userportal.lib.php

示例12: foreach

     foreach ($_languages['name'] as $key => $value) {
         $english_name = $_languages['folder'][$key];
         if ($language == $english_name) {
             $html .= '<option value="' . $english_name . '" selected="selected">' . $value . '</option>';
         } else {
             $html .= '<option value="' . $english_name . '">' . $value . '</option>';
         }
     }
     $html .= '</select></td></tr>';
     $form->addElement('html', $html);
 }
 $default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open);
 $form->addHtmlEditor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
 $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs'));
 $form->addElement('html', '<table id="table_langs" style="margin-left:5px;"><tr>');
 $currentLanguage = api_get_language_isocode();
 $i = 0;
 foreach ($_languages['name'] as $key => $value) {
     $lang_name = $_languages['folder'][$key];
     $i++;
     $checked = null;
     if ($languageGet == $lang_name) {
         $checked = "checked";
     }
     $html_langs = '<td width="300">';
     $html_langs .= '<label><input type="checkbox" ' . $checked . ' id="lang" name="' . $lang_name . '" />&nbsp;' . $value . '<label/>';
     $html_langs .= '</td>';
     if ($i % 5 == 0) {
         $html_langs .= '</tr><tr>';
     }
     $form->addElement('html', $html_langs);
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:configure_homepage.php

示例13: convertLanguageToGettextDivideInFolders

 /**
  * Converts the classic chamilo lang into folders example: locale/trad4all/en.po, locale/trad4all/es.po, etc
  * @param string $destinationLanguage Chamilo language 'spanish', 'french', etc
  * @param OutputInterface $output
  */
 private function convertLanguageToGettextDivideInFolders($destinationLanguage, OutputInterface $output)
 {
     /** @var \Silex\Application $app */
     $app = $this->getApplication()->getSilexApplication();
     //$tempPath = $app['paths']['path.temp'].'langs';
     $tempPath = $app['paths']['sys_root'] . 'main/locale';
     if (!is_dir($tempPath)) {
         mkdir($tempPath);
         $output->writeln('<info>folder $tempPath created </info>');
     }
     $isocode = api_get_language_isocode($destinationLanguage);
     $englishPath = $app['paths']['root_sys'] . 'main/lang/english/';
     // Translate this language.
     $toLanguagePath = $app['paths']['root_sys'] . 'main/lang/' . $destinationLanguage;
     if (is_dir($englishPath)) {
         if ($dh = opendir($englishPath)) {
             while (($file = readdir($dh)) !== false) {
                 $info = pathinfo($file);
                 if ($info['extension'] != 'php') {
                     continue;
                 }
                 $info['filename'] = explode('.', $info['filename']);
                 $info['filename'] = $info['filename'][0];
                 if ($info['filename'] != 'admin') {
                     //continue;
                 }
                 $translations = array();
                 $filename = $englishPath . '/' . $file;
                 $po = file($filename);
                 if (!file_exists($filename) || !file_exists($toLanguagePath . '/' . $file)) {
                     continue;
                 }
                 foreach ($po as $line) {
                     $pos = strpos($line, '=');
                     if ($pos) {
                         $variable = substr($line, 1, $pos - 1);
                         $variable = trim($variable);
                         require $filename;
                         $my_variable_in_english = ${$variable};
                         require $toLanguagePath . '/' . $file;
                         $my_variable = ${$variable};
                         /** This fixes a notice due an array in the lang files */
                         if (strpos($variable, 'langNameOfLang') === false) {
                             $translations[] = array('msgid' => $variable, 'msgstr' => $my_variable);
                         } else {
                             continue;
                         }
                     }
                 }
                 if (!is_dir($tempPath . '/' . $info['filename'])) {
                     mkdir($tempPath . '/' . $info['filename']);
                     $output->writeln('<info>folder ' . $tempPath . '/' . $info['filename'] . ' created </info>');
                 }
                 $new_po_file = $tempPath . '/' . $info['filename'] . '/' . $isocode . '.po';
                 $fp = fopen($new_po_file, 'w');
                 $header = 'msgid ""' . "\n" . 'msgstr ""' . "\n" . '"Content-Type: text/plain; charset=utf-8 \\n"';
                 fwrite($fp, $header);
                 fwrite($fp, "\n\n");
                 foreach ($translations as $item) {
                     $line = 'msgid "' . addslashes($item['msgid']) . '"' . "\n";
                     $translated = $item['msgstr'];
                     $translated = addslashes($translated);
                     $translated = str_replace(array("\\'"), "'", $translated);
                     $line .= 'msgstr "' . $translated . '"' . "\n\n";
                     fwrite($fp, $line);
                 }
                 fclose($fp);
                 $message = "File {$file} converted to " . $new_po_file;
                 $output->writeln($message);
             }
             closedir($dh);
         }
     }
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:79,代码来源:ExportLanguagesCommand.php

示例14: file

     $po = file($phpFilePath);
     $translations = array();
     $englishFile = $englishDir . '/' . $phpFile->getBasename();
     foreach ($po as $line) {
         $pos = strpos($line, '=');
         if ($pos) {
             $variable = substr($line, 1, $pos - 1);
             $variable = trim($variable);
             require $englishFile;
             $my_variable_in_english = $variable;
             require $phpFilePath;
             $my_variable = ${$variable};
             $translations[] = array('msgid' => $my_variable_in_english, 'msgstr' => $my_variable);
         }
     }
     $code = api_get_language_isocode($folder->getBasename());
     //LC_MESSAGES
     $new_po_file = $save_path . $folder->getBasename() . '/' . $phpFile->getBasename('.php') . '.po';
     if (!is_dir($save_path . $folder->getBasename())) {
         mkdir($save_path . $folder->getBasename());
     }
     $fp = fopen($new_po_file, 'w');
     foreach ($translations as $item) {
         $line = 'msgid "' . addslashes($item['msgid']) . '"' . "\n";
         $line .= 'msgstr "' . addslashes($item['msgstr']) . '"' . "\n\n";
         fwrite($fp, $line);
     }
     fclose($fp);
 }
 if ($folder->getBasename() == 'bosnian') {
     //exit;
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:translate_all_languages_array_to_po.php

示例15: array

}
$tbl_admin_languages = Database::get_main_table(TABLE_MAIN_LANGUAGE);
$sql_select = "SELECT * FROM {$tbl_admin_languages}";
$result_select = Database::query($sql_select);
$options = $options_pedia = array();
$selected_language = null;
while ($row = Database::fetch_array($result_select)) {
    $options[$row['isocode']] = $row['original_name'] . ' (' . $row['english_name'] . ')';
    if (in_array($row['isocode'], array('de', 'en', 'es', 'fr'))) {
        $options_pedia[$row['isocode']] = $row['original_name'] . ' (' . $row['english_name'] . ')';
    }
}
$icon = Display::return_icon('text2audio.png', get_lang('HelpText2Audio'), '', ICON_SIZE_MEDIUM);
echo '<div class="page-header"><h2>' . $icon . get_lang('HelpText2Audio') . '</h2></div>';
if (Security::remove_XSS($_GET['dt2a']) == 'google') {
    $selected_language = api_get_language_isocode();
    //lang default is the course language
    echo '<div>';
    $form = new FormValidator('form1', 'post', null, '', array('id' => 'form1'));
    $form->addElement('hidden', 'text2voice_mode', 'google');
    $form->addElement('hidden', 'id', $document_id);
    $form->addElement('text', 'title', get_lang('Title'));
    $form->addElement('select', 'lang', get_lang('Language'), $options);
    $form->addElement('textarea', 'text', get_lang('InsertText2Audio'), array('id' => 'textarea_google'));
    //echo Display :: return_icon('info3.gif', get_lang('HelpGoogleAudio'), array('align' => 'absmiddle', 'hspace' => '3px'), false);
    $form->addButtonSave(get_lang('SaveMP3'));
    $defaults = array();
    $defaults['lang'] = $selected_language;
    $form->setDefaults($defaults);
    $form->display();
    echo '</div>';
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:create_audio.php


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