From 9a29df2a07e1ce98719a58c42966a713c45a6004 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Thu, 26 Mar 2020 11:20:12 +0800 Subject: [PATCH] load front end i18n as assets --- app/Services/Translations/JavaScript.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Services/Translations/JavaScript.php b/app/Services/Translations/JavaScript.php index 7dc080e2..66868ad0 100644 --- a/app/Services/Translations/JavaScript.php +++ b/app/Services/Translations/JavaScript.php @@ -33,10 +33,10 @@ class JavaScript $this->filesystem->put($compiled, $content); $this->cache->put($this->prefix.$locale, $sourceModified); - return url("lang/$locale.js?t=$sourceModified"); + return url()->asset("lang/$locale.js?t=$sourceModified"); } - return url("lang/$locale.js?t=$compiledModified"); + return url()->asset("lang/$locale.js?t=$compiledModified"); } public function resetTime(string $locale): void @@ -48,7 +48,9 @@ class JavaScript { $path = public_path("lang/${locale}_plugin.js"); if ($this->filesystem->exists($path)) { - return url("lang/${locale}_plugin.js?t=".$this->filesystem->lastModified($path)); + $lastModified = $this->filesystem->lastModified($path); + + return url()->asset("lang/${locale}_plugin.js?t=$lastModified"); } return '';