Beispiel #1
0
 /**
  * @see	wcf\data\DatabaseObject::__construct()
  */
 public function __construct($languageID, array $row, Language $language = null)
 {
     if ($row === null) {
         throw new SystemException('SetupLanguage accepts only an existing dataset.');
     }
     parent::__construct(null, $row, null);
 }
Beispiel #2
0
 /**
  * Returns a localized date output.
  * 
  * @param	string				$date
  * @param	string				$format
  * @param 	wcf\data\language\Language	$language
  */
 public static function localizeDate($date, $format, Language $language)
 {
     if ($language->languageCode != 'en') {
         // full textual representation of the day of the week (l)
         if (stripos($format, 'l') !== false) {
             $date = str_replace(array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'), array($language->get('wcf.date.day.sunday'), $language->get('wcf.date.day.monday'), $language->get('wcf.date.day.tuesday'), $language->get('wcf.date.day.wednesday'), $language->get('wcf.date.day.thursday'), $language->get('wcf.date.day.friday'), $language->get('wcf.date.day.saturday')), $date);
         }
         // textual representation of a day, three letters (D)
         if (stripos($format, 'D') !== false) {
             $date = str_replace(array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'), array($language->get('wcf.date.day.sun'), $language->get('wcf.date.day.mon'), $language->get('wcf.date.day.tue'), $language->get('wcf.date.day.wed'), $language->get('wcf.date.day.thu'), $language->get('wcf.date.day.fri'), $language->get('wcf.date.day.sat')), $date);
         }
         // full textual representation of a month (F)
         if (stripos($format, 'F') !== false) {
             $date = str_replace(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'), array($language->get('wcf.date.month.january'), $language->get('wcf.date.month.february'), $language->get('wcf.date.month.march'), $language->get('wcf.date.month.april'), $language->get('wcf.date.month.may'), $language->get('wcf.date.month.june'), $language->get('wcf.date.month.july'), $language->get('wcf.date.month.august'), $language->get('wcf.date.month.september'), $language->get('wcf.date.month.october'), $language->get('wcf.date.month.november'), $language->get('wcf.date.month.december')), $date);
         }
         // short textual representation of a month (M)
         if (stripos($format, 'M') !== false) {
             $date = str_replace(array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), array($language->get('wcf.date.month.jan'), $language->get('wcf.date.month.feb'), $language->get('wcf.date.month.mar'), $language->get('wcf.date.month.apr'), $language->get('wcf.date.month.may'), $language->get('wcf.date.month.jun'), $language->get('wcf.date.month.jul'), $language->get('wcf.date.month.aug'), $language->get('wcf.date.month.sep'), $language->get('wcf.date.month.oct'), $language->get('wcf.date.month.nov'), $language->get('wcf.date.month.dec')), $date);
         }
     }
     return $date;
 }