summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2023-12-08 15:44:24 +0100
committerGitHub <noreply@github.com>2023-12-08 15:44:24 +0100
commit46b6966f352fd05ffdd6d94bd4f0b2ff2db6968e (patch)
tree828a48ca0ecd09b7dd7937f2250d07b673edbd7d
parentcd428124ffc62b18f89d920a44664ca5ebc7530e (diff)
parent8b5a4449c8680475a9e43002a9ab58fc09ba195a (diff)
downloadnextcloud-server-46b6966f352fd05ffdd6d94bd4f0b2ff2db6968e.tar.gz
nextcloud-server-46b6966f352fd05ffdd6d94bd4f0b2ff2db6968e.zip
Merge pull request #42122 from nextcloud/backport/42093/stable28
-rw-r--r--lib/public/Util.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/public/Util.php b/lib/public/Util.php
index 488eddbaf4b..6322ab56a88 100644
--- a/lib/public/Util.php
+++ b/lib/public/Util.php
@@ -161,6 +161,12 @@ class Util {
$path = "js/$file";
}
+ // We need to handle the translation BEFORE the init script
+ // is loaded, as the init script might use translations
+ if ($application !== 'core' && !str_contains($file, 'l10n')) {
+ self::addTranslations($application, null, true);
+ }
+
self::$scriptsInit[] = $path;
}
@@ -233,9 +239,10 @@ class Util {
* Add a translation JS file
* @param string $application application id
* @param string $languageCode language code, defaults to the current locale
+ * @param bool $init whether the translations should be loaded early or not
* @since 8.0.0
*/
- public static function addTranslations($application, $languageCode = null) {
+ public static function addTranslations($application, $languageCode = null, $init = false) {
if (is_null($languageCode)) {
$languageCode = \OC::$server->getL10NFactory()->findLanguage($application);
}
@@ -244,7 +251,12 @@ class Util {
} else {
$path = "l10n/$languageCode";
}
- self::$scripts[$application][] = $path;
+
+ if ($init) {
+ self::$scriptsInit[] = $path;
+ } else {
+ self::$scripts[$application][] = $path;
+ }
}
/**