request->getRequestUri(); $loadL10N = false; foreach (self::routesToLoadL10N as $route) { $url = str_replace('/index.php', '', $url); $url = str_replace('/apps', '', $url); if (str_starts_with($url, $route)) { $loadL10N = true; break; } } if (!$loadL10N) { return $output; } /** @var array $exApp */ foreach ($this->exAppService->getExAppsList() as $exApp) { $appId = $exApp['id']; $lang = $this->l10nFactory->findLanguage($appId); $availableLocales = $this->l10nFactory->findAvailableLanguages($appId); if (in_array($lang, $availableLocales) && $lang !== 'en') { $headPos = stripos($output, ''); if ($headPos !== false) { try { $l10nScriptSrc = $this->appManager->getAppWebPath($appId) . '/l10n/' . $lang . '.js'; $nonce = $this->nonceManager->getNonce(); $output = substr_replace($output, '', $headPos, 0); } catch (AppPathNotFoundException) { $this->logger->debug(sprintf('Can not find translations for %s ExApp.', $appId)); } } } } return $output; } }