Deal with the multiple corner case of choosing the language.
974492
def choose_language(self, lang, request):
        """"""

        # Can be an empty string or None
        if not lang:
            lang = get_language_from_request(request)

        # Raise a 404 if the language is not in not in the list
        if lang not in [key for (key, value) in settings.PAGE_LANGUAGES]:
            raise Http404

        # We're going to serve CMS pages in language lang;
        # make django gettext use that language too
        if lang and translation.check_for_language(lang):
            translation.activate(lang)

        return lang
309646
function(data) {
		try {
		    this.options.language = new TL.Language(this.options);

		    this._initData(data);
		} catch(e) {
		    this.showMessage(this._translateError(e));
		}
	}
1167779
@Override
  public final void setLang(final Languages pLang) {
    this.lang = pLang;
    if (this.itsId == null) {
      this.itsId = new IdI18nSeService();
    }
    this.itsId.setLang(this.lang);
  }
1095184
def language_code_select(priority_languages, options, html_options)
      selected = object.send(@method_name) if object.respond_to?(@method_name)

      languages = ""

      if options.present? and options[:include_blank]
        option = options[:include_blank] == true ? "" : options[:include_blank]
        languages += "<option>#{option}</option>\n"
      end

      if priority_languages
        languages += options_for_select(priority_languages, selected)
        languages += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
      end

      languages = languages + options_for_select(language_translations, selected)

      html_options = html_options.stringify_keys
      add_default_name_and_id(html_options)

      content_tag(:select, languages.html_safe, html_options)
    end
1037546
def cell_language(source):
    """"""
    if source:
        line = source[0]
        if line.startswith('%%'):
            magic = line[2:]
            if ' ' in magic:
                lang, magic_args = magic.split(' ', 1)
            else:
                lang = magic
                magic_args = ''

            if lang in _JUPYTER_LANGUAGES:
                source.pop(0)
                return lang, magic_args

    return None, None
310487
private String determineLanguage(FacesContext fc, DataTable dataTable) {
		final List<String> availableLanguages = Arrays.asList("de", "en", "es", "fr", "hu", "it", "nl", "pl", "pt",
				"ru");
		if (BsfUtils.isStringValued(dataTable.getCustomLangUrl())) {
			return dataTable.getCustomLangUrl();
		} else if (BsfUtils.isStringValued(dataTable.getLang())) {
			String lang = dataTable.getLang();
			if (availableLanguages.contains(lang)) {
				return determineLanguageUrl(fc, lang);
			}
		} else {
			String lang = fc.getViewRoot().getLocale().getLanguage();
			if (availableLanguages.contains(lang)) {
				return determineLanguageUrl(fc, lang);
			}
		}
		return null;
	}
436817
protected function deleteLanguage()
    {
        $this->controlAccess('language_delete');

        if ($this->language->delete($this->data_language['code'])) {
            $this->redirect('admin/settings/language', $this->text('Language has been deleted'), 'success');
        }

        $this->redirect('', $this->text('Language has not been deleted'), 'warning');
    }
1133154
def _get_lang(self, *args, **kwargs):
        
        if "lang" in kwargs:
            if kwargs["lang"] in self._available_languages:
                self.lang = kwargs["lang"]
95000
def languages_column(self, obj):
        
        languages = self.get_available_languages(obj)
        return '<span class="available-languages">{0}</span>'.format(
            " ".join(languages)
        )
1283423
def set_language(self, language):
        
        self.log([u"Setting language: '%s'", language])
        for fragment in self.fragments:
            fragment.language = language
273449
function Polyglot(options) {
    options = options || {};
    this.phrases = options.phrases || {};
    this.currentLocale = options.locale || 'en';
  }
115390
protected function addLanguage()
    {
        $this->controlAccess('language_add');

        if ($this->language->add($this->getSubmitted())) {
            $this->redirect('admin/settings/language', $this->text('Language has been added'), 'success');
        }

        $this->redirect('', $this->text('Language has not been added'), 'warning');
    }
905848
protected function wizardAddLanguage()
    {
        $this->validatePrompt('code', $this->text('Code'), 'language');
        $this->validatePrompt('name', $this->text('Name'), 'language', '');
        $this->validatePrompt('native_name', $this->text('Native name'), 'language', '');
        $this->validatePrompt('status', $this->text('Status'), 'language', 0);
        $this->validatePrompt('default', $this->text('Default') . '?', 'language', 0);
        $this->validatePrompt('weight', $this->text('Weight'), 'language', 0);
        $this->validatePrompt('rtl', $this->text('Right-to-left') . '?', 'language', 0);

        $this->validateComponent('language');
        $this->addLanguage();
    }
1329915
public static void setLanguage(LanguageSelect lang) {
		if (lang == null) GuildWars2.lang = LanguageSelect.English;
		else GuildWars2.lang = lang;
	}
837318
private void setupLanguage() {
        Locale locale = LanguageSetting.getLanguage(activity);
        setupLocale(locale);
        currentLanguage = locale;
        LanguageSetting.setLanguage(activity, locale);
    }
471750
def choose_aspect(decision):
    """"""
    choice = []
    for i in range(len(ASPECTSTYLES)):
        if (i < decision):
            choice = ASPECTSTYLES[i]
    return choice
1069368
def poll_open_file_languages(self):
        """"""
        languages = []
        for index in range(self.get_stack_count()):
            languages.append(
                self.tabs.widget(index).language.lower())
        return set(languages)