function languages_get_config($engine) { global $ext; switch ($engine) { case 'asterisk': foreach (languages_list() as $row) { $ext->add('app-languages', $row['language_id'], '', new ext_noop('Changing Channel to language: ' . $row['lang_code'] . ' (' . $row['description'] . ')')); $ext->add('app-languages', $row['language_id'], '', new ext_setlanguage($row['lang_code'])); $ext->add('app-languages', $row['language_id'], '', new ext_goto($row['dest'])); } break; } }
function languages_options() { // Initialization global $locale; $return = array(is_eng_array('Detect', 'language', ' - ') => 'Detect'); $languages = get_available_languages(); $languages_list = languages_list(); $languages_self_list = languages_self_list(); $is_en = substr($locale, 0, 2) == 'en'; foreach ($languages as $language) { $return[] = array(isset($languages_self_list[$language]) ? $languages_self_list[$language] : $languages_list[$language] => array((isset($languages_list[$language]) ? $languages_list[$language] : $language) . ($is_en ? '' : ' - ' . $language) => $language)); } if (!in_array('en', $languages) && !in_array('en_US', $languages) && !in_array('en_GB', $languages)) { $return[] = array('English' => array(is_eng_array('English', 'language', ' - ') => 'en_US')); } return $return; }
<div class="panel"> <div class="panel-body"> <div class="form-group"> <select name="language" class="form-control" onchange="set_language()"> <?php $languages = get_available_languages(); $langtext = '<option value="Detect"'; if (!isset($_SESSION['language']) || $_SESSION['language'] == 'Detect') { $langtext .= ' selected="selected"'; } $langtext .= '>' . _x('Select language', 'language'); if (substr($locale, 0, 2) != 'en') { $langtext .= ' - Languages'; } $langtext .= "</option>\n"; $languages_list = languages_list(); $languages_self_list = languages_self_list(); if (!in_array('en', $languages, true) && !in_array('en_US', $languages, true) && !in_array('en_GB', $languages, true)) { $langtext .= '<option value="en_US"'; if ($_SESSION['language'] == 'en_US') { $langtext .= ' selected="selected"'; } $langtext .= '>' . _x('English', 'language') . " - English</option>\n"; } foreach ($languages as $language) { $langtext .= "<option value=\"{$language}\""; if ($_SESSION['language'] == $language) { $langtext .= ' selected="selected"'; } $langtext .= '>' . (isset($languages_list[$language]) ? $languages_list[$language] : $language); $langtext .= " - " . (isset($languages_self_list[$language]) ? $languages_self_list[$language] : $languages_list[$language]) . "</option>\n";
} ?> </ul> </div> <?php $theWPML = "true"; } ?> <?php if (get_option(THEMESLUG . '_show_flags') && function_exists('icl_get_languages')) { ?> <!-- / flags --> <div id="wpml_flags"> <?php languages_list(); ?> </div> <!-- / flags --> <?php $theWPML = "true"; } ?> <!-- background wrapper --> <div id="container" class="extrapadding" style="padding:0"> <!-- <div id="container" class="extrapadding2"> -->
<?php // License for all code of this FreePBX module can be found in the license file inside the module directory // Copyright 2015 Sangoma Technologies. // $lrows = ''; foreach (languages_list() as $row) { $lrows .= '<tr>'; $lrows .= '<td>'; $lrows .= $row['description']; $lrows .= '</td>'; $lrows .= '<td>'; $lrows .= '<a href="?display=languages&view=form&extdisplay=' . $row['language_id'] . '"><i class="fa fa-edit"></i></a> '; $lrows .= '<a href="?display=languages&action=delete&language_id=' . $row['language_id'] . '"><i class="fa fa-trash"></i></a>'; $lrows .= '</td>'; $lrows .= '</tr>'; } ?> <div id="toolbar-all"> <a href="config.php?display=languages&view=form" class="btn btn-default" ><i class="fa fa-plus"></i> <?php echo _("Add Language"); ?> </a> </div> <table data-toolbar="#toolbar-all" data-maintain-selected="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped"> <thead> <th data-sortable="true"><?php echo _("Language"); ?> </th> <th><?php
function languages_list_cells($label, $name, $selected_id = null, $all_option = false) { $controlAsString = languages_list($name, $selected_id, $all_option); View::get()->addControl(View::controlFromRenderedString(View::CONTROL_ARRAY, $label, $controlAsString)); }
?> </head> <body <?php body_class(); ?> > <!-- ><div id="tz"></div> !--> <div id="page" class="hfeed site"> <div class="right-box clr fs13 clr-bc cgb"> <div class="container"> <?php get_search_form(); ?> <span class='langselector'> <?php $i = languages_list(0); function languages_list($i) { $languages = icl_get_languages('skip_missing=1'); // &orderby=code if (!empty($languages)) { foreach ($languages as $l) { //echo $i>0 ? ' / ' : ''; echo ' <span class="lang up">'; if (!$l['active']) { echo '<a href="' . $l['url'] . '">'; } echo substr($l['native_name'], 0, 2); if (!$l['active']) { echo '</a>'; }