language selector window
546558
def select
      @inline_translations_allowed = false
      @inline_translations_enabled = false
    
      if tr8n_current_user_is_translator? 
        unless tr8n_current_translator.blocked?
          @inline_translations_allowed = true
          @inline_translations_enabled = tr8n_current_translator.enable_inline_translations?
        end
      else
        @inline_translations_allowed = Tr8n::Config.open_registration_mode?
      end
    
      @inline_translations_allowed = true if tr8n_current_user_is_admin?
    
      @source_url = request.env['HTTP_REFERER']
      @source_url.gsub!("locale", "previous_locale") if @source_url
    
      @all_languages = Tr8n::Language.enabled_languages
      @user_languages = Tr8n::LanguageUser.languages_for(tr8n_current_user) unless tr8n_current_user_is_guest?
    
      render_lightbox
    end
974728
@Override
    public ViewDeclarationLanguage getViewDeclarationLanguage(FacesContext context, String viewId) {
        ViewDeclarationLanguage vdl = delegate.getViewDeclarationLanguage(context, viewId);
        if (vdl != null) {
            return new SeamViewDeclarationLanguage(vdl);
        } else {
            return null;
        }
    }
970641
private void initLanguageDetection() {

        try {
            // use a seed for initializing the language detection for making sure the
            // same probabilities are detected for the same document contents
            DetectorFactory.clear();
            DetectorFactory.setSeed(42L);
            DetectorFactory.loadProfile(loadProfiles(getAvailableLocales()));
        } catch (Exception e) {
            LOG.error(Messages.get().getBundle().key(Messages.INIT_I18N_LANG_DETECT_FAILED_0), e);
        }
    }
285531
function _highlightBlockForLanguage(code, language, onComplete) {
        var patterns = _getPatternsForLanguage(language);
        _processCodeWithPatterns(_htmlEntities(code), patterns, onComplete);
    }
410421
public function lselectLocalizedOptionWithJavascript($selector, $option) {
        $localizedOption = $this->localizeTarget($option);
        $this->selectOptionWithJavascript($selector, $localizedOption);
    }
468244
function highlight(language, value, sheet) {
  var result = high.call(this, language, value)
  result.value = all(sheet || SHEET, result.value)
  return result
}
1257951
public static SelectOptions getOptionsForLanguageStatic(Locale setLocale, Locale prevLocale) {

        // get available locales from the workplace manager
        List<Locale> locales = OpenCms.getWorkplaceManager().getLocales();
        List<String> options = new ArrayList<String>(locales.size());
        List<String> values = new ArrayList<String>(locales.size());
        int checkedIndex = 0;
        int counter = 0;
        Iterator<Locale> i = locales.iterator();
        while (i.hasNext()) {
            Locale currentLocale = i.next();
            // add all locales to the select box
            String language = currentLocale.getDisplayLanguage(setLocale);
            if (CmsStringUtil.isNotEmpty(currentLocale.getCountry())) {
                language = language + " (" + currentLocale.getDisplayCountry(setLocale) + ")";
            }
            if (CmsStringUtil.isNotEmpty(currentLocale.getVariant())) {
                language = language + " (" + currentLocale.getDisplayVariant(setLocale) + ")";
            }
            options.add(language);
            values.add(currentLocale.toString());
            if (prevLocale.toString().equals(currentLocale.toString())) {
                // mark the currently active locale
                checkedIndex = counter;
            }
            counter++;
        }
        SelectOptions selectOptions = new SelectOptions(options, values, checkedIndex);
        return selectOptions;
    }
85870
function setLanguage(language) {
  window[App.pkg.settings.storage_engine || 'localStorage'][App.pkg._id + '-language'] = language;

  var xhr = null;
  var activexmodes = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
  if(window.ActiveXObject) {
    for(var i = 0; i < activexmodes.length; i++) {
      try {
        xhr = new ActiveXObject(activexmodes[i]);
      } catch(e) {}
    }
  } else {
    xhr = new XMLHttpRequest();
  }
  xhr.open('GET', 'languages/' + language + '.json', false);
  xhr.send(null);

  if(xhr.status == 200 || xhr.status == 201) {
    var response = JSON.parse(xhr.responseText);
    Globalize.culture(language);
    Globalize.addCultureInfo(language, {
      messages: response,
    });
  }
}
154415
def language_support(f, attribute, options)
      return if Fae.languages.blank?

      attribute_array = attribute.to_s.split('_')
      language_suffix = attribute_array.pop
      return unless Fae.languages.has_key?(language_suffix.to_sym) || Fae.languages.has_key?(language_suffix)

      label = attribute_array.push("(#{language_suffix})").join(' ').titleize
      options[:label] = label unless options[:label].present?

      if options[:wrapper_html].present?
        options[:wrapper_html].deep_merge!({ data: { language: language_suffix } })
      else
        options[:wrapper_html] = { data: { language: language_suffix } }
      end
    end
1141692
function (code, language, bare) {
    var result;
    if (typeof hljs !== 'undefined') {
      if (language) {
        try {
          result = hljs.highlight(language, code, true);
        }
        catch (e) {
          Ember.warn(
            '[marked] Failing to highlight some code with language `' + language +
            '`, trying auto-detecting language (error: ' + e + ').'
          );
          result = hljs.highlightAuto(code);
        }
      }
      else {
        result = hljs.highlightAuto(code);
      }
      result.value = '<pre><code>' + result.value + '</code></pre>';
      if (bare) {
        return result;
      }
      else {
        return result.value;
      }
    }
    else {
      result = '<pre><code>' + (code || '').replace(/<>&/g, entitiesReplacer) + '</code></pre>';
      if (bare) {
        return {value: result, language: null};
      }
      else {
        return result;
      }
    }
  }
652991
function _updateLanguageInfo(editor) {
        var doc = editor.document,
            lang = doc.getLanguage();

        // Show the current language as button title
        languageSelect.$button.text(lang.getName());
    }
97297
def set_language(self, request, org):
        """"""
        if org:
            lang = org.language or settings.DEFAULT_LANGUAGE
            translation.activate(lang)
1287124
public function listLanguage()
    {
        $this->refreshLanguage();
        $this->setTitleListLanguage();
        $this->setBreadcrumbListLanguage();
        $this->setFilterListLanguage();
        $this->setPagerListLanguage();

        $this->setData('languages', (array) $this->getListLanguage());
        $this->outputListLanguage();
    }
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;
	}
1113328
function guessLanguage(request){
	//console.log("guessLanguage");
    if(typeof request === 'object'){
        var language_header = request.headers['accept-language'],
        languages = [];
        regions = [];
        request.languages = [currentLocale];
		/*
		for (x in request.languages)
		{
			console.log(request.languages[x] + x);
		}
		*/
        request.regions = [currentLocale];
        request.language = currentLocale;
        request.region = currentLocale;

        if (language_header) {
            language_header.split(',').forEach(function(l) {
                header = l.split(';', 1)[0];
                lr = header.split('-', 2);
                if (lr[0]) {
                    languages.push(lr[0].toLowerCase());
                }
                if (lr[1]) {
                    regions.push(lr[1].toLowerCase());
                }
            });

            if (languages.length > 0) {
                request.languages = languages;
                request.language = languages[0];
            }

            if (regions.length > 0) {
                request.regions = regions;
                request.region = regions[0];
            }
        }
        i18n.setLocale(request.language);
    }
}
255646
function selectHourOnInputElement() {
				inputElement.focus();
				setTimeout(function() {
					inputElement.get(0).setSelectionRange(0, inputElement.val().indexOf(settings.separator));
				}, 1);
			}
1203350
public void addLanguage(Language language) {
        languages.add(language);

        if (dropdown.isAttached()) {
            addLanguageItem(language);
        } else {
            lazyLoaded = true;
        }
    }