Services that are essential for the loading of the localization
functionality.
502720
public function register()
    {
        if (!$this->app->bound(TranslatorAdapterFactoryInterface::class)) {
            $this->app->bind(TranslatorAdapterFactoryInterface::class, function ($app, $params) {
                $config = $app->make('config');
                $loaders = $config->get('i18n.adapters.zend.loaders', []);

                $loaderRepository = new TranslationLoaderRepository();
                foreach ($loaders as $key => $class) {
                    $loader = $app->build($class, [$app]);
                    $loaderRepository->registerTranslationLoader($key, $loader);
                }

                $serviceManager = new ServiceManager();
                $loaderPluginManager = new LoaderPluginManager(
                    $serviceManager,
                    [
                        'factories' => [
                            GettextLoader::class => function($creationContext, $resolvedName, $options) {
                                return $this->app->build(GettextLoader::class, ['webrootDirectory' => DIR_BASE]);
                            }
                        ],
                        'aliases' => [
                            'gettext' => GettextLoader::class,
                        ],
                    ]
                );
                $zendFactory = new ZendTranslatorAdapterFactory($loaderRepository, $loaderPluginManager);
                $plainFactory = new PlainTranslatorAdapterFactory();

                return new CoreTranslatorAdapterFactory($config, $plainFactory, $zendFactory);
            });
        }

        $this->app->singleton(Localization::class, function ($app) {
            $loc = new Localization();

            $translatorAdapterFactory = $app->make(TranslatorAdapterFactoryInterface::class);
            $repository = new TranslatorAdapterRepository($translatorAdapterFactory);
            $loc->setTranslatorAdapterRepository($repository);

            $loc->setActiveContext(Localization::CONTEXT_UI);

            return $loc;
        });
    }
743652
function (request, response) {
      var locale = request.params.locale;
      var phrase = request.params.phrase;

      var result;
      if (request.query.plural) {
        var singular = phrase;
        var plural = request.query.plural;
        // Make sure the information is added to the catalog if it doesn't exist yet.
        var translated = vulpejs.i18n.__n({
          singular: singular,
          plural: plural,
          count: request.query.count,
          locale: locale,
        });
        // Retrieve the translation object from the catalog and return it.
        var catalog = vulpejs.i18n.getCatalog(locale);
        result = singular.split(configuration.objectNotation).reduce(function (object, index) {
          return object[index];
        }, catalog);
      } else {
        result = vulpejs.i18n.__({
          phrase: phrase,
          locale: locale,
        });
      }
      response.send(result);
    }
996538
public void addRequestedLocalization(final Object node, final String key, final String domain, final String locale, final Localization localization) {

		final GenericProperty keyKey    = new GenericProperty("key");
		final GenericProperty domainKey = new GenericProperty("domain");
		final GenericProperty localeKey = new GenericProperty("locale");
		final GenericProperty nodeKey   = new GenericProperty("node");

		boolean notContained = true;
		for (GraphObject gom : localizations) {
			if (notContained) {

				if (gom.getProperty(keyKey).equals(key) && gom.getProperty(domainKey).equals(domain) && gom.getProperty(localeKey).equals(locale)) {

					final GraphObject prevNode = (GraphObject)gom.getProperty(nodeKey);
					if (prevNode != null && node != null && prevNode.getUuid().equals(((GraphObject)node).getUuid())) {
						notContained = false;
					}
				}
			}
		}

		if (notContained) {

			final Map<String, Object> data = new HashMap();
			data.put("node", node);
			data.put("key", key);
			data.put("domain", domain);
			data.put("locale", locale);
			data.put("localization", localization);

			GraphObjectMap converted = GraphObjectMap.fromMap(data);

			if (!localizations.contains(converted)) {
				localizations.add(converted);
			}
		}
	}
1241451
function () {
          for (var key in translationIds) {
            if (translationIds.hasOwnProperty(key)) {
              updateTranslation(key, translationIds[key], scope, scope.interpolateParams, scope.defaultText);
            }
          }
        }
929597
function (locale, callback) {

            var self = this;

            if (!locale) {
                callback && callback("locale not defined");
                return;
            }

            require(['json!' + self.$.path + '/' + self.$.locale], function (translations) {
                self.set({
                    translations: translations
                });
                callback && callback();
            }, function (err) {
                self.log(err, 'error');
                callback && callback(err);
            });

        }
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);
    }
837809
function requestBundles(requestedLangs = navigator.languages) {
    const newLangs = negotiateLanguages(
      requestedLangs, availableLangs, { defaultLocale }
    );

    const bundles = newLangs.map(
      lang => new ResourceBundle(lang, resIds)
    );

    return Promise.resolve(bundles);
  }
1024277
protected void initElementLanguage() {

        // get the default locale for the resource
        List<Locale> locales = OpenCms.getLocaleManager().getDefaultLocales(getCms(), getParamResource());
        Locale locale = locales.get(0);
        locale = ensureLocale(locale);
        setParamElementlanguage(locale.toString());
    }
136441
protected function initialize()
    {
        if ($this->initialized) {
            return;
        }

        parent::initialize();

        // Add resources files directly, so that we still have translations
        // event if we don't run translation:import
        $standardResources = $this->getStandardResources();
        foreach ($standardResources as $resource) {
            parent::addResource($resource['format'], $resource['path'], $resource['locale'], $resource['domain']);
        }

        // Register all catalogues we have in the storage
        $repo = $this->container->get('liip.translation.repository');
        $locales = $repo->getLocaleList();
        foreach ($repo->getDomainList() as $domain) {
            foreach ($locales as $locale) {
                parent::addResource('liip', 'intermediate.storage', $locale, $domain);
            }
        }

        $this->initialized = true;
    }
369052
public static function bootTranslatable(): void
    {
        static::created(function (Model $model) {
            $model->translations()->saveMany($model->translationCache);
        });

        static::updating(function (Model $model) {
            $model->translations()->saveMany($model->translationCache);
        });
    }
732594
protected function load_messages(){
        if($this->messages == NULL || $this->locale != $this->messagesLocale){
            if($this->locale != NULL){
                if(file_exists($this->dir_content . "_$this->locale" . '.txt')){
                    $this->messages= file($this->dir_content . "_$this->locale" . '.txt');
                    $this->messages= $this->parse_properties($this->messages);
                    $this->messagesLocale= $this->locale;
                }
            }
            if($this->messages == NULL){
                $this->messages= file($this->dir_content . '.txt');
                $this->messages= $this->parse_properties($this->messages);
                $this->messagesLocale= NULL;
            }
        }
    }
963780
private static MeasureFormatData loadLocaleData(ULocale locale) {
        ICUResourceBundle resource =
                (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUData.ICU_UNIT_BASE_NAME, locale);
        MeasureFormatData cacheData = new MeasureFormatData();
        UnitDataSink sink = new UnitDataSink(cacheData);
        resource.getAllItemsWithFallback("", sink);
        return cacheData;
    }
6874
private function loadService()
    {
        $this->getEventManager()->dispatch(self::EVENT_BEFORE_LOAD_SERVICE, $this);

        foreach ($this->registerBundles() as $bundle) {
            $bundle->loadService();
        }

        $this->getEventManager()->dispatch(self::EVENT_AFTER_LOAD_SERVICE, $this);
    }
1156606
public function load($locale)
    {
        if ($this->isLoaded($locale)) {
            return;
        }
        $this->languages[$locale] = $this->handler->load($locale);
    }
1102571
protected function loadServices()
    {
        $loader = new Loader\XmlFileLoader($this->container, new FileLocator(__DIR__.'/Config'));
        $loader->load(__DIR__ . '/Resources/container/container.xml');
    }
765615
@Before
    public void setUp() {
        defineApplicationLocales();

        clearKeys();

        List<Key> keys = new ArrayList<>();
        keys.add(createKey(KEY_DEFAULT, false, false, false));

        Key outdatedKey = createKey(KEY_OUTDATED, false, false, false);
        outdatedKey.setOutdated();
        keys.add(outdatedKey);

        keys.add(createKey(KEY_TLN_APPROX, true, false, false));
        keys.add(createKey(KEY_TLN_OUTDATED, false, true, false));
        keys.add(createKey(KEY_TLN_MISSING, false, false, true));

        Key key = keyFactory.createKey(KEY_WITH_MISSING_TRANSLATION);
        key.addTranslation(FR, TRANSLATION_FR);
        keys.add(key);

        for (Key keyToPersist : keys) {
            keyRepository.add(keyToPersist);
        }
    }
308941
function()
    {
        var _this = this;

        _(api.services).each(function(service, key) {
            _this._addService(service);
        });
    }