From 79650e2d356024e3ede5d60217d8a349a4444d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Busso?= <90727999+agustinbusso@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:26:39 -0300 Subject: [PATCH 1/7] Fix issue when empty translation --- resources/js/app-login.js | 3 ++- resources/js/bootstrap.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/js/app-login.js b/resources/js/app-login.js index e7bd62a464..6fadf0340a 100644 --- a/resources/js/app-login.js +++ b/resources/js/app-login.js @@ -57,7 +57,8 @@ window.ProcessMaker = { window.ProcessMaker.i18nPromise = i18next.use(Backend).init({ lng: document.documentElement.lang, - fallbackLng: false, +fallbackLng: "en", // default language when no translations + returnEmptyString: false, // When a translation is an empty string, return the default language, not empty nsSeparator: false, keySeparator: false, parseMissingKeyHandler(value) { diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js index d5e236fcb2..770631fcb5 100644 --- a/resources/js/bootstrap.js +++ b/resources/js/bootstrap.js @@ -197,7 +197,8 @@ window.ProcessMaker = { window.ProcessMaker.i18nPromise = i18next.use(Backend).init({ lng: document.documentElement.lang, - fallbackLng: false, + fallbackLng: "en", // default language when no translations + returnEmptyString: false, // When a translation is an empty string, return the default language, not empty nsSeparator: false, keySeparator: false, parseMissingKeyHandler(value) { From 428c7b72166524bb23b9e8781230263f54ce6cf4 Mon Sep 17 00:00:00 2001 From: "Marco A. Nina" Date: Tue, 22 Oct 2024 11:17:35 -0400 Subject: [PATCH 2/7] Set cache to user anonymous --- ProcessMaker/Http/Controllers/Api/UserController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ProcessMaker/Http/Controllers/Api/UserController.php b/ProcessMaker/Http/Controllers/Api/UserController.php index dd05182138..2072f786d3 100644 --- a/ProcessMaker/Http/Controllers/Api/UserController.php +++ b/ProcessMaker/Http/Controllers/Api/UserController.php @@ -6,6 +6,7 @@ use Illuminate\Auth\Access\AuthorizationException; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Hash; use ProcessMaker\Events\UserCreated; @@ -18,7 +19,6 @@ use ProcessMaker\Http\Controllers\Controller; use ProcessMaker\Http\Resources\ApiCollection; use ProcessMaker\Http\Resources\Users as UserResource; -use ProcessMaker\Models\RecommendationUser; use ProcessMaker\Models\User; use ProcessMaker\RecommendationEngine; use ProcessMaker\TwoFactorAuthentication; @@ -144,7 +144,7 @@ public function index(Request $request) /** * Display a listing of users and their task counts. * - * @param \Illuminate\Http\Request $request + * @param Request $request * @return \Illuminate\Http\Response * * @OA\Get( @@ -845,6 +845,12 @@ public function storeFilterConfiguration(String $name, Request $request) public function updateLanguage(Request $request) { + if (Auth::user()->is_system) { + Cache::put('LANGUAGE_ANON_WEBENTRY', $request->input('language'), 15); + + return response([], 204); + } + $user = Auth::user(); $original = $user->getOriginal(); $user->language = $request->input('language')['code']; From c96ab2af0312cbb3352cc85bb2ef6dfe7eee9175 Mon Sep 17 00:00:00 2001 From: "Marco A. Nina" Date: Tue, 22 Oct 2024 11:18:33 -0400 Subject: [PATCH 3/7] create backup to packages --- ProcessMaker/Managers/PackageManager.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ProcessMaker/Managers/PackageManager.php b/ProcessMaker/Managers/PackageManager.php index f79181f3ee..cbb4615094 100644 --- a/ProcessMaker/Managers/PackageManager.php +++ b/ProcessMaker/Managers/PackageManager.php @@ -93,6 +93,11 @@ public function createLanguageFile($code) // Create file in package file_put_contents("{$package}/{$code}.json", $baseFile); + + // save new language backup + if (File::exists("{$package}.orig")) { + file_put_contents("{$package}.orig/{$code}.json", $baseFile); + } } } } From c1c3eb9eaba7179f0d8a14ceb8a2f147f74bced6 Mon Sep 17 00:00:00 2001 From: "Marco A. Nina" Date: Tue, 22 Oct 2024 11:30:08 -0400 Subject: [PATCH 4/7] Add ignore lang.orig --- resources/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 resources/.gitignore diff --git a/resources/.gitignore b/resources/.gitignore new file mode 100644 index 0000000000..bdec8defee --- /dev/null +++ b/resources/.gitignore @@ -0,0 +1 @@ +lang.orig From b410da68eadd9bf2bdd9659d9325303e7c7e0cd5 Mon Sep 17 00:00:00 2001 From: "Marco A. Nina" Date: Tue, 22 Oct 2024 11:32:20 -0400 Subject: [PATCH 5/7] add ignore in lang --- resources/lang/.gitignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 resources/lang/.gitignore diff --git a/resources/lang/.gitignore b/resources/lang/.gitignore new file mode 100644 index 0000000000..e04bd0a815 --- /dev/null +++ b/resources/lang/.gitignore @@ -0,0 +1,4 @@ +* +!en +!en.json +!.gitignore From 92e768a0ce8b8c6ded263ef2875f707fb50b77b9 Mon Sep 17 00:00:00 2001 From: "Marco A. Nina" Date: Tue, 22 Oct 2024 12:16:43 -0400 Subject: [PATCH 6/7] Add files gitignore in packages --- ProcessMaker/Managers/PackageManager.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ProcessMaker/Managers/PackageManager.php b/ProcessMaker/Managers/PackageManager.php index cbb4615094..adc5b74275 100644 --- a/ProcessMaker/Managers/PackageManager.php +++ b/ProcessMaker/Managers/PackageManager.php @@ -98,6 +98,10 @@ public function createLanguageFile($code) if (File::exists("{$package}.orig")) { file_put_contents("{$package}.orig/{$code}.json", $baseFile); } + + //Add files gitignore + copy(base_path('resources') . '/.gitignore', $package . '/../.gitignore'); + copy(lang_path() . '/.gitignore', $package . '/.gitignore'); } } } From 688ea61a169d963b692d6354a205566f0b69686b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Busso?= <90727999+agustinbusso@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:35:39 -0300 Subject: [PATCH 7/7] Fix indentation --- resources/js/app-login.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/app-login.js b/resources/js/app-login.js index 6fadf0340a..cbbe80ecba 100644 --- a/resources/js/app-login.js +++ b/resources/js/app-login.js @@ -57,7 +57,7 @@ window.ProcessMaker = { window.ProcessMaker.i18nPromise = i18next.use(Backend).init({ lng: document.documentElement.lang, -fallbackLng: "en", // default language when no translations + fallbackLng: "en", // default language when no translations returnEmptyString: false, // When a translation is an empty string, return the default language, not empty nsSeparator: false, keySeparator: false,