function testCultureList() { $allCultures = CultureInfo::getCultures(); $neutralCultures = CultureInfo::getCultures(CultureInfo::NEUTRAL); $specificCultures = CultureInfo::getCultures(CultureInfo::SPECIFIC); //there should be 246 cultures all together. $this->assertEqual(count($allCultures), 246); $this->assertEqual(count($neutralCultures), 76); $this->assertEqual(count($specificCultures), 170); }
/** * @static * @return array */ public static function getAvailableCultures() { //FCKeditor's available languages $fck = self::getFCKeditorsLanguages(); //Prado's available languages $prado = CultureInfo::getCultures(); //Gets the intersection through comparison $intersection = array(); foreach ($prado as $p) { foreach ($fck as $f) { if (eregi("^" . sql_regcase($p) . "\$", str_replace('-', '_', $f))) { $intersection[$p] = $f; } } } unset($fck, $prado); //Include languages that were not included, but are available. $intersection['ja'] = 'jp'; $intersection['ja_JP'] = 'jp'; $intersection['ja_JP_TRADITIONAL'] = 'jp'; return $intersection; }