Load a language file

@param  string $language
@return bool
320025
public function loadLanguage($language)
    {
        if ($this->isLoaded($language)) {
            return;
        }

        $this->strings[$language] = [];
        $this->languagesLoaded[] = $language;
    }
77834
public function hasTranslation($message) {
		if($this->language === null) {
			$this->initLanguage();
		}
		
		//Load the main file
		if($this->msg === null) {
			$this->retrieveMessages($this->language);
		}
		
		//If the translation is not in the main file, load the custom file associated to the message
		if(!isset($this->msg[$message])) {
			$this->retrieveCustomMessages($message, $this->language);
		}
		
		if (isset($this->msg[$message])) {
			return true;
		} else {
			return false;
		}
	}
741149
private function loadTranslation($language)
    {
        $class = $this->translationClass;
        if (!$class) {
            throw new InvalidParamException('Translation class not set.');
        }
        $translation = new $class;
        $translation->{$this->languageAttribute} = $language;

        return $translation;
    }
1199407
public function doesAcceptLanguage($language = 'en')
	{
		return (in_array(strtolower($language), $this->getAcceptLanguages(), true)) ? true : false;
	}
892752
private function loadModuleTranslation(AbstractModule $module, $language)
    {
        // Translations are optional
        if (method_exists($module, 'getTranslations')) {
            $translations = $module->getTranslations($language);

            // Only array must be provided, otherwise ignore another type
            if (is_array($translations)) {
                // If that's an array, then append translations
                foreach ($translations as $string => $translation) {
                    $this->translations[$string] = $translation;
                }

                // And indicate success
                return true;
            }
        }

        // Failure by default
        return false;
    }
1368965
public function loadAllTranslations($language)
    {
        foreach ($this->loaded as $module) {
            $this->loadModuleTranslation($module, $language);
        }
    }
356415
public function load(string $file)
    {
        $file = $this->sanitizeFileName($file);
        if (empty($this->loaded)
            && !empty($this->beforeFirstTimeLoadCallBack)
            && $this->isValid()
        ) {
            $callback = $this->beforeFirstTimeLoadCallBack;
            $callback($this);
            $this->beforeFirstTimeLoadCallBack = false;
        }

        $this->loaded[$file] = isset($this->loaded[$file])
            ? $this->loaded[$file]+1
            : 1;
        return RequireBinding::with(($this->getThemePath() . $file), $this);
    }
331718
protected function loadFromCache(string $language, string $file): bool
	{
		$this->strings[$language] = $this->cache->get('mako.i18n.' . $language);

		return $this->strings[$language] !== false && isset($this->strings[$language][$file]);
	}
266955
public function loadFile( $file ) {

		if ( empty( $this->files ) )
			$this->files = $this->readDirRecursive(
				$this->base_dir,
				'*' . $this->extension
			);

		if ( ! in_array( $file, $this->files ) )
			return FALSE;

		require_once $file;

		return TRUE;
	}
895781
public function loadFile($file)
    {
        $xml = file_get_contents($file);
        if (!$xml) {
            return false;
        }

        try {
            $this->setXml($xml);
        } catch (\Exception $e) {
            return false;
        }

        return true;
    }
763843
private function loadTranslationMessages($language)
    {
        // Reset any previous translations if any
        $this->moduleManager->clearTranslations();
        $this->translator->reset();

        // Now load new ones
        $this->moduleManager->loadAllTranslations($language);
        $this->translator->extend($this->moduleManager->getTranslations());
    }
661621
public function setLanguageDatabase(string $language) : bool
    {
        $pdo = $this->bot->getPDO();

        // Update the language in the database
        $sth = $pdo->prepare('UPDATE ' . $this->user_table . ' SET language = :language WHERE '
                                             . $this->id_column . ' = :id');
        $sth->bindParam(':language', $language);

        $chat_id = $this->bot->chat_id;
        $sth->bindParam(':id', $chat_id);

        try {
            $sth->execute();
        } catch (\PDOException $e) {
            throw new BotException($e->getMessage());
        }

        $this->language = $language;

        return true;
    }
894850
function load(string $file = null)
    {
        if ($file == null) {
            $file = static::$configFile;
        }
        if (!file_exists($file)) {
            return false;
        }

        $a = json_decode(file_get_contents($file));

        if (isset($a->css)) {
            $this->css = $a->css;
        }

        if (isset($a->js)) {
            $this->js = $a->js;
        }
        
        if (isset($a->jss)) {
            $this->jss = $a->jss;
        }
        
        return true;
    }
1279308
private function loadLang($lang) {
        $locale = preg_replace_callback('/\b([a-z]{2})[-_](?:([a-z]{4})[-_])?([a-z]{2})\b/', function ($matches) {
            return $matches[1].'_'.(!empty($matches[2]) ? ucfirst($matches[2]).'_' : '').strtoupper($matches[3]);
        }, strtolower($lang));

        if (file_exists($filename = __DIR__.'/Lang/'.$locale.'.php')) {
            $this->lang = $locale;

            $this->number_word = include __DIR__.'/Lang/'.$locale.'.php';
            $this->currency = $this->number_word['currency'];

            return true;
        }
        throw new InvalidArgumentException('Unknown language ('.$lang.')');
    }
318922
public function load($file)
    {
        if (!is_file($file)) {
            if (!$file = $this->findFile($file)) {
                throw new \RuntimeException(sprintf('Language file: %s not found.', $file));
            }
        }

        return include $file;
    }
921091
public function loadDictionary($lang = null)
    {
        if (!is_string($lang) && !is_null($lang)) {
            throw new \InvalidArgumentException("Please provide a string as parameter!");
        } else {
            
            // if nothing is set, get it from the config file
            if (is_null($lang)) {
                $lang = $this->config->value('language');
            }
            
            $file_to_load = $this->language_folder . $lang . '.php';

            return $this->loadFile($file_to_load);
        }
    }
683038
public function getMetadata($language)
	{
		$path = $this->getLanguagePath(ANPATH_BASE, $language);
		$file = $language.'.json';

		$meta = null;

		if (file_exists($path.DS.$file)) {
			$result = json_decode(file_get_contents($path.DS.$file));
			$meta = $result->meta;
			$meta->tag = $result->tag;
		}

		return $meta;
	}