public static function registerTranslations($baseDir, $localesDir, $prefix = null)
    {
        if (self::$isInit === true) {
            $dir = $baseDir . DIRECTORY_SEPARATOR . $localesDir;
            if (is_dir($dir) === false) {
                throw new InvalidDirectory('directory "' . $dir . '" can\'t be identified');
            }
            $language = self::$currentLanguage;
            if (($pos = strpos($language, '-')) !== false) {
                $pos = (int) $pos; // re: https://github.com/phpstan/phpstan/issues/647
                $language = substr($language, 0, $pos);
            }
            if (($pos = strpos($language, '_')) !== false) {
                $pos = (int) $pos; // re: https://github.com/phpstan/phpstan/issues/647
                $language = substr($language, 0, $pos);
            }
            if (is_readable($dir . DIRECTORY_SEPARATOR . $language . '.yml') === true) {
                $newOnes = Config::get($dir . DIRECTORY_SEPARATOR . $language . '.yml');
                if (is_array($newOnes) === true) {
                    if ($prefix != null) {
                        $newOnes = array($prefix => $newOnes);
                    }
                    self::$translations = array_merge(self::$translations, $newOnes);
                }
            } else {
                Logger::get()->notice('can\'t find language "' . $language . '" in directory "' . $dir . '"');
            }
        }
    }