public static function translate($key, array $args = array())
    {
        if (self::$isInit === false) {
            throw new BadUse('locale doesn\'t seem to have been initialized');
        }
        $oldKey = $key;
        $section = self::$translations;
        while (isset($section[$key]) === false && ($pos = strpos($key, '.')) !== false) {
            if (! is_int($pos)) { // re: https://github.com/phpstan/phpstan/issues/647
                break;
            }
            $subSection = substr($key, 0, $pos);
            if (isset($section[$subSection]) === false) {
                break;
            }
            $section = $section[$subSection];
            $key = substr($key, $pos + 1);
        }
        if (isset($section[$key]) === false) {
            Logger::get()->error('can\'t find translation for key "' . $oldKey . '"');

            return '(null)';
        }

        return $section[$key];
    }