public static function loadFrom($dir, $extend = true)
    {
        $file = $dir . '/' . self::$language . '.';
        if (isset(self::$cache)) {
            $cached = self::$cache->getItem($file);
            if ($cached->isHit()) {
                $value = $cached->get();
                if (is_array($value)) {
                    $localization = new Locale($value);
                    self::load($localization, $extend);
                    return true;
                } else {
                    self::$cache->deleteItems(array(
                        $file
                    ));
                }
            }
        }
        if (file_exists($file . 'pot')) {
            return true;
        } elseif (file_exists($file . 'mo')) {
            $localization = Locale::readMo($file . 'mo');
        } elseif (file_exists($file . 'po')) {
            $localization = Locale::readPo($file . 'po');
        } else {
            return false;
        }
        if (isset(self::$cache)) {
            // self::$cache->set($file, $localization->getMessages(), 3600);
            $item = self::$cache->getItem($file);
            $item->set($localization->getMessages());
            $item->expiresAfter(3600);
            self::$cache->save($item);
        }
        self::load($localization, $extend);
        return true;
    }