/** * since 3.2.9.2 */ function qtranxf_default_enabled_languages() { //$locale = defined('WPLANG') ? WPLANG : get_option('WPLANG','en_US'); $locale = get_locale(); if (!$locale) { $locale = 'en_US'; } $lang = null; $locales = qtranxf_default_locale(); foreach ($locales as $ln => $lo) { if ($lo != $locale) { continue; } $lang = $ln; break; } if (!$lang) { $lang = substr($locale, 0, 2); } if (!qtranxf_language_predefined($lang)) { $langs = array(); $langs['language_name'][$lang] = 'Unknown'; $langs['flag'][$lang] = 'us.png'; $langs['locale'][$lang] = $locale; $langs['date_format'][$lang] = '%A %B %e%q, %Y'; $langs['time_format'][$lang] = '%I:%M %p'; $langs['not_available'][$lang] = 'Sorry, this entry is only available in %LANG:, : and %.'; qtranxf_save_languages($langs); } //qtranxf_dbg_log('qtranxf_default_enabled_languages: $lang='.$lang.' $locale:',$locale); return array($lang, $lang != 'en' ? 'en' : 'de'); //return array( 'de', 'en', 'zh' ); }
/** * Remove language $lang from the database. * @since 3.3 */ function qtranxf_deleteLanguage($lang) { global $q_config; if (!qtranxf_language_predefined($lang)) { if ($q_config['default_language'] == $lang) { //if(!isset($q_config['language_name'][$lang])||strtolower($lang)=='code') $error = __('No such language!', 'qtranslate'); return __('Cannot delete Default Language!', 'qtranslate'); } qtranxf_disableLanguage($lang); } $langs = array(); qtranxf_load_languages($langs); qtranxf_unsetLanguage($langs, $lang); qtranxf_save_languages($langs); if ($q_config['language'] == $lang) { qtranxf_setLanguageAdmin($q_config['default_language']); } return ''; }