Initialize {@code TextToSpeech} and treats unsupported languages exceptions by setting a default language.
960321
private void init() {

        mTextToSpeech = new TextToSpeech(mContext, new OnInitListener() {

            @Override
            public void onInit(int status) {

                if (status == TextToSpeech.SUCCESS) {
                    checkCurrentLocale();
                    int result = mTextToSpeech.setLanguage(mLocale);

                    if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
                        mLocale = getDefaultLocale();
                        init();
                        Log.i(TAG, "set default locale (English US) for gvrAccessibility");
                    }
                }
            }
        });

    }
643327
public void setContentLanguage(Locale locale) {
		checkCommitted();
		ContentLanguageHeader contentLanguageHeader =
			SipFactoryImpl.headerFactory.createContentLanguageHeader(locale);
		this.message.setContentLanguage(contentLanguageHeader);
	}
314797
private void initializeLocale() {
        final String locale = getProperty(LOCALE, applicationProperties);
        if (locale != null && !"".equals(locale)) {
            final String[] localeParts = locale.split("_");
            if (localeParts.length == 2) {
                currentLocale = new Locale(localeParts[0], localeParts[1]);
            } else {
                currentLocale = new Locale(localeParts[0]);
            }
        } else {
            currentLocale = Locale.getDefault();
        }
        logger.info(Messages.getMessage(CONTEXT_LOCALE_USED), currentLocale);
    }
845952
private static void initializePropertiesIfNeeded() {
        if (translationResources != null) {
            return;
        }
        String lastException = "";
        try {
            translationResources = new Properties();
            ClassLoader classLoader = ClassLoader.getSystemClassLoader();
            translationResources.load(classLoader.getResourceAsStream(
                    propertiesFileName));
        } catch (Exception exception) {
            lastException = exception.toString() + "\n----\n" + exception.getMessage();
        }
        if (translationResources == null) {
            throw new RuntimeException("TranslationSource.initializePropertiesIfNeeded()"
                    + "Could not load TranslationResources.properties file.\n"
                    + "The exception follows:\n" + lastException);
        }
    }
1290063
public void setLanguage(Language language) {
        this.language = language;
        this.label.setText(language.getName());
        this.image.setUrl(language.getImage());
    }
1151686
public synchronized void setDefaultSSLContext() throws Exception {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "setDefaultSSLContext");

        if (FrameworkState.isStopping()) {
            return;
        }

        SSLConfig defaultSSLConfig = getDefaultSSLConfig();

        if (defaultSSLConfig != null)
            JSSEProviderFactory.getInstance(null).setServerDefaultSSLContext(defaultSSLConfig);
        else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "There is no default SSLConfig.");
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "setDefaultSSLContext");

    }
1074749
public function handleLanguageIntoSession()
    {
        $this->settingsCommonLib();
        $this->initializeSprGlbAndSession();
        if (is_null($this->tCmnSuperGlobals->get('lang')) && is_null($this->tCmnSession->get('lang'))) {
            $this->tCmnSession->set('lang', $this->commonLibFlags['default_language']);
        } elseif (!is_null($this->tCmnSuperGlobals->get('lang'))) {
            $this->tCmnSession->set('lang', filter_var($this->tCmnSuperGlobals->get('lang'), FILTER_SANITIZE_STRING));
        }
        $this->normalizeLocalizationIntoSession();
    }
1180169
public void setDefaultLanguage(Map<String, String> deflang) {
		if (deflang != null && !deflang.isEmpty()) {
			LANG_CACHE.put(getDefaultLanguageCode(), deflang);
		}
	}
1163506
@Override
  public final void setLang(final Languages pLang) {
    this.lang = pLang;
    if (this.itsId == null) {
      this.itsId = new IdI18nCatalogGs();
    }
    this.itsId.setLang(this.lang);
  }
1234364
@Override
    public void initialize(UimaContext context) throws ResourceInitializationException {

        super.initialize(context);

        this.context = context;

        this.logger = context.getLogger();

        if (this.logger.isLoggable(Level.INFO)) {
            this.logger.log(Level.INFO, "Initializing the OpenNLP " + "Part of Speech annotator.");
        }

        POSModel model;

        try {
            POSModelResource modelResource = (POSModelResource) context.getResourceObject(UimaUtil.MODEL_PARAMETER);

            model = modelResource.getModel();
        } catch (ResourceAccessException e) {
            throw new ResourceInitializationException(e);
        }

        Integer beamSize = AnnotatorUtil.getOptionalIntegerParameter(context, UimaUtil.BEAM_SIZE_PARAMETER);

        if (beamSize == null)
            beamSize = POSTaggerME.DEFAULT_BEAM_SIZE;

        this.posTagger = new POSTaggerME(model, beamSize, 0);
    }
1165660
public static function initialiseLang()
        {
            $lang = !empty($_REQUEST['lang']) ? preg_replace('/[^a-zA-Z\-]/', null, $_REQUEST['lang']) : 'en';
            Lang::initialize();
            Lang::set($lang, false);
        }
227659
public void addDefaultLocale(String localeName) {

        Locale locale = getLocale(localeName);
        if (!m_defaultLocales.contains(locale)) {
            m_defaultLocales.add(locale);
            if (CmsLog.INIT.isInfoEnabled()) {
                CmsLog.INIT.info(
                    Messages.get().getBundle().key(
                        Messages.INIT_I18N_CONFIG_DEFAULT_LOCALE_2,
                        new Integer(m_defaultLocales.size()),
                        locale));

            }
        }
    }
81759
public void initialize(Language language, String treeTaggerHome, Boolean annotateTokens, 
			Boolean annotateSentences, Boolean annotatePartOfSpeech, Boolean improveGermanSentences) {
		this.initialize(language, treeTaggerHome, annotateTokens, annotateSentences, annotatePartOfSpeech,
				improveGermanSentences, null);
	}
1232702
public void setLanguageIn(LanguageMode languageIn) {
    checkState(languageIn != LanguageMode.NO_TRANSPILE);
    checkState(languageIn != LanguageMode.UNSUPPORTED);
    this.languageIn = languageIn == LanguageMode.STABLE ? LanguageMode.STABLE_IN : languageIn;
  }
514247
public static void setLocale(@NonNull Locale locale) {
        if (!locale.equals(Locale.getDefault())) {
            LocalizationHelper.locale = locale;
            Locale.setDefault(locale);
        }
    }
631434
@Override
    public void setup() {

        if (log.isInfoEnabled()) {
            log.info("Setting default locale to [" + newLocale + "]");
        }

        try {
            Locale.setDefault(newLocale);
        } catch (Exception e) {
            log.error("Could not switch locale to ["
                    + newLocale + "]. Continuing with standard locale.", e);
        }
    }
647918
public static void initialize(Retransformer trans) throws Exception {
        transformer = trans;

        List<String> scripts = new ArrayList<>();
        List<String> scriptNames = new ArrayList<>();

        // Load default and custom rules
        Enumeration<URL> iter = ClassLoader.getSystemResources(ROOT_RULE_FOLDER);
        while (iter.hasMoreElements()) {
            loadRules(iter.nextElement().toURI(), scriptNames, scripts);
        }

        try (PrintWriter writer = new PrintWriter(new StringWriter())) {
            try {
                transformer.installScript(scripts, scriptNames, writer);
            } catch (Exception e) {
                log.log(Level.SEVERE, "Failed to install scripts", e);
            }
        }

        if (log.isLoggable(Level.FINE)) {
            log.fine("Installed rules");
        }
    }