Loads a language, including all dependencies

@param {string} lang the language to load
@type {Promise} the promise which resolves as soon as everything is loaded
542992
function loadLanguage (lang)
{
	// at first we need to fetch all dependencies for the main language
	// Note: we need to do this, even if the main language already is loaded (just to be sure..)
	//
	// We load an array of all dependencies and call recursively this function on each entry
	//
	// dependencies is now an (possibly empty) array of loading-promises
	var dependencies = getDependenciesOfLanguage(lang).map(loadLanguage);

	// We create a promise, which will resolve, as soon as all dependencies are loaded.
	// They need to be fully loaded because the main language may extend them.
	return Promise.all(dependencies)
		.then(function () {

			// If the main language itself isn't already loaded, load it now
			// and return the newly created promise (we chain the promises).
			// If the language is already loaded, just do nothing - the next .then()
			// will immediately be called
			if (!Prism.languages[lang]) {
				return new Promise(function (resolve) {
					$u.script('components/prism-' + lang + '.js', resolve);
				});
			}
		});
}
708537
def load_lang_model(self):
        
        if self.lang in self.languages:
            if not Spacy.model_installed(self.lang):
                download(self.lang)
            model = spacy.load(self.lang)
        elif self.lang in self.alpha_languages:
            language_module = importlib.import_module(f"spacy.lang.{self.lang}")
            language_method = getattr(language_module, self.alpha_languages[self.lang])
            model = language_method()
        self.model = model
907062
def lang(self, lang):
        
        self.graph.set((self.asNode(), DC.language, Literal(lang)))
1346017
function addTextLocale(locale, body, options = {}) {
  const gt = new Gettext();
  const domain = 'messages';
  const {
    filter,
    gettextDefaultCharset = 'UTF-8',
  } = options;

  if (body.length > 0) {
    gt.addTranslations(locale, domain, po.parse(body, gettextDefaultCharset));
  }

  if (filter) {
    const filterAsync = Promise.promisify(filter);
    return filterAsync(gt, locale);
  }

  return Promise.resolve(gt.catalogs[locale] && gt.catalogs[locale][domain].translations);
}
181304
private function load()
    {
        // reset phrases
        $this->phrases = array();
        $this->loaded = true;

        // set file path
        $langDataPath = FS2LANG . '/' . $this->local . '/' . $this->type . '.txt';

        // include language data file
        if (file_exists($langDataPath)) {
            // load file
            $langData = file_get_contents($langDataPath);
            $langData = str_replace(array("\r\n", "\r"), "\n", $langData); // unify linebreaks
            $this->import($langData);

            // get lines
            $langData = preg_replace("/#.*?\n/is", '', $langData);
            $langData = explode("\n", $langData);

            // Run through lines
            foreach ($langData as $line) {
                preg_match("#([a-z0-9_-]+?)\s*?:\s*(.*)#is", $line, $match);
                if (count($match) >= 2) {
                    $this->add($match[1], $match[2]);
                }
                unset($match);
            }
        } else {
            Throw new \Exception('Language File not found: ' . $langDataPath);
        }
    }
1343591
def init_language_data(self, lang, lang_data_type):
        
        if lang not in self.loaded_langs:
            self.loaded_langs[lang] = {}

        if lang_data_type not in self.loaded_langs[lang]:
            result = self._query_lang(lang=lang, lang_data_type=lang_data_type)
            data = self._process_lang(result)
            self.loaded_langs[lang].update({lang_data_type: data})
272047
public function loadAllFile($folder, $language = "default") {
        $this->folder = $folder;
        $this->language = $language;
		
        $msg = array();
        if($language == "default")
            @include($folder."message.php");
        else
        @include($folder."message_".$language.".php");

        /*
         * Some OSes don't distinguish between empty array and FALSE (they may return FALSE in case of no match),
         * therefore the foreach may trigger a Warning even if there is no error
         */
        $ressourceFiles = glob($folder."message_custom_".$language."_*.php");
        if ($ressourceFiles){
            foreach ($ressourceFiles as $filename) {
                @include($filename);
            }
        }

        $this->msg = $msg;
    }
1156606
public function load($locale)
    {
        if ($this->isLoaded($locale)) {
            return;
        }
        $this->languages[$locale] = $this->handler->load($locale);
    }
674387
public function loadLanguage()
    {
        $package = $this->getIdentifier()->package;
        $domain  = $this->getIdentifier()->domain;

        if($domain) {
            $url = 'com://'.$domain.'/'.$package;
        } else {
            $url = 'com:'.$package;
        }

        $this->getObject('translator')->load($url);
    }
962754
function loadPrismLang(lang) {
    if (!lang) return undefined;
    let langObject = Prism.languages[lang];
    if (langObject === undefined) {
        try {
            require('prismjs/components/prism-' + lang);
            return Prism.languages[lang];
        } catch (e) {
            // nothing to do
        }
    }
    return langObject;
}
281947
function() {
        library.addCatalog({
            slug: 'langnames',
            url: 'https://td.unfoldingword.org/exports/langnames.json',
            modified_at: 0
        });
        library.addCatalog({
            slug: 'new-language-questions',
            url: 'https://td.unfoldingword.org/api/questionnaire/',
            modified_at: 0
        });
        library.addCatalog({
            slug: 'temp-langnames',
            url: 'https://td.unfoldingword.org/api/templanguages/',
            modified_at: 0
        });
        // TRICKY: this catalog should always be indexed after langnames and temp-langnames otherwise the linking will fail!
        library.addCatalog({
            slug: 'approved-temp-langnames',
            url: 'https://td.unfoldingword.org/api/templanguages/assignment/changed/',
            modified_at: 0
        });
        return Promise.resolve();
    }
636456
def lang_items(self, lang=None):
        """"""
        if lang is None:
            lang = self.language
        yield from self.cache.setdefault(lang, {}).items()
320025
public function loadLanguage($language)
    {
        if ($this->isLoaded($language)) {
            return;
        }

        $this->strings[$language] = [];
        $this->languagesLoaded[] = $language;
    }
113233
function downloadLanguage (language, callback)
	{
		grunt.log.writeln ('Fetching ' + language.url);
		getJSON (getHttpParameters (language.token), function (data) {
			grunt.file.write (options.dest + '/' + language.token + '.json', JSON.stringify (data));
			callback ();
		});
	}
1255160
function loadImplementation(implementation){
  var impl = null

  if(shouldPreferGlobalPromise(implementation)){
    // if no implementation or env specified use global.Promise
    impl = {
      Promise: global.Promise,
      implementation: 'global.Promise'
    }
  } else if(implementation){
    // if implementation specified, require it
    var lib = require(implementation)
    impl = {
      Promise: lib.Promise || lib,
      implementation: implementation
    }
  } else {
    // try to auto detect implementation. This is non-deterministic
    // and should prefer other branches, but this is our last chance
    // to load something without throwing error
    impl = tryAutoDetect()
  }

  if(impl === null){
    throw new Error('Cannot find any-promise implementation nor'+
      ' global.Promise. You must install polyfill or call'+
      ' require("any-promise/register") with your preferred'+
      ' implementation, e.g. require("any-promise/register/bluebird")'+
      ' on application load prior to any require("any-promise").')
  }

  return impl
}
67269
public function lang($lang = NULL)
	{
		if ( ! func_num_args())
		{
			return $this->_lang;
		}
		$this->_lang = $lang;
		return $this;
	}
1362209
function load(target) {
      if (!loaded[target]) {
        var def = componentDirectory[target];
        // Initialize component, this won't cause an infinite loop because
        // we've already check that the componentDirectory is a DAG
        let requires = def.requires || [];
        return loaded[target] = Promise.all(requires.map(load)).then(deps => {
          let ctx = {};
          for (let i = 0; i < deps.length; i++) {
            ctx[def.requires[i]] = deps[i];
          }
          return new Promise((resolve, reject) => {
            try {
              resolve(def.setup.call(null, ctx));
            } catch (err) {
              reject(err);
            }
          }).catch(function(err) {
            debug(`error while loading component '${target}': ${err}`);
            throw err;
          });
        });
      }
      return loaded[target];
    }