From 6e4a0e5d4b26630809829b75bf61b95d3049bb4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Agust=C3=ADn=20Busso?=
<90727999+agustinbusso@users.noreply.github.com>
Date: Fri, 21 Jul 2023 12:15:47 -0300
Subject: [PATCH 1/2] Show warning message for no PM languages
---
.../Api/ProcessTranslationController.php | 13 ++++++++++++
.../CreateProcessTranslationModal.vue | 20 +++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/ProcessMaker/Http/Controllers/Api/ProcessTranslationController.php b/ProcessMaker/Http/Controllers/Api/ProcessTranslationController.php
index 7b8c00c8e0..d8c546a75a 100644
--- a/ProcessMaker/Http/Controllers/Api/ProcessTranslationController.php
+++ b/ProcessMaker/Http/Controllers/Api/ProcessTranslationController.php
@@ -104,8 +104,21 @@ public function getAvailableLanguages(Request $request)
}
}
+ // Available Pm Languages (user settings)
+ $pmLangs = [];
+ foreach (scandir(resource_path('lang')) as $file) {
+ preg_match('/([a-z]{2})\\.json/', $file, $matches);
+ if (!empty($matches)) {
+ $pmLangs[] = $matches[1];
+ }
+ }
+
+ // Our form controls need attribute:value pairs sot we convert the langs array to and associative one
+ $availablePmLanguages = array_combine($pmLangs, $pmLangs);
+
return response()->json([
'availableLanguages' => $availableLanguages,
+ 'availablePmLanguages' => $availablePmLanguages,
]);
}
diff --git a/resources/js/processes/translations/components/CreateProcessTranslationModal.vue b/resources/js/processes/translations/components/CreateProcessTranslationModal.vue
index 162924d2dd..68d7f43b3b 100644
--- a/resources/js/processes/translations/components/CreateProcessTranslationModal.vue
+++ b/resources/js/processes/translations/components/CreateProcessTranslationModal.vue
@@ -42,6 +42,12 @@
+
+
+
+ The translations for the selected language are only be applied to anonymous web entry screens.
+
+
@@ -143,6 +149,7 @@ export default {
disabled: false,
aiLoading: false,
availableLanguages: [],
+ availablePmLanguages: [],
selectedLanguage: null,
selectedScreen: null,
screensTranslations: [],
@@ -166,6 +173,18 @@ export default {
};
},
+ computed: {
+ showLanguageWarning() {
+ if (!this.selectedLanguage) {
+ return false;
+ }
+
+ if (this.availablePmLanguages[this.selectedLanguage.language] === undefined) {
+ return true;
+ }
+ return false;
+ },
+ },
watch: {
selectedScreen(val) {
this.currentScreenTranslations = [];
@@ -390,6 +409,7 @@ export default {
ProcessMaker.apiClient.post("/process/translations/languages", params)
.then((response) => {
this.availableLanguages = JSON.parse(JSON.stringify(response.data.availableLanguages));
+ this.availablePmLanguages = JSON.parse(JSON.stringify(response.data.availablePmLanguages));
this.loading = false;
});
},
From 87fb7d7a0534eb83d8e85eb9592bbd19d629e193 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Agust=C3=ADn=20Busso?=
<90727999+agustinbusso@users.noreply.github.com>
Date: Fri, 21 Jul 2023 14:19:09 -0300
Subject: [PATCH 2/2] Change warning message
---
.../translations/components/CreateProcessTranslationModal.vue | 2 +-
resources/lang/en.json | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/resources/js/processes/translations/components/CreateProcessTranslationModal.vue b/resources/js/processes/translations/components/CreateProcessTranslationModal.vue
index 68d7f43b3b..6162750565 100644
--- a/resources/js/processes/translations/components/CreateProcessTranslationModal.vue
+++ b/resources/js/processes/translations/components/CreateProcessTranslationModal.vue
@@ -45,7 +45,7 @@
- The translations for the selected language are only be applied to anonymous web entry screens.
+ {{ $t("Since there is no interface translation for this language, translations for these screens will only render for anonymous users in web entries.") }}
diff --git a/resources/lang/en.json b/resources/lang/en.json
index ff01aa9676..efe66bb1bc 100644
--- a/resources/lang/en.json
+++ b/resources/lang/en.json
@@ -1715,6 +1715,7 @@
"Templates": "Templates",
"Template Author": "Template Author",
"Create a new Process": "Create a new Process",
+ "Since there is no interface translation for this language, translations for these screens will only render for anonymous users in web entries.": "Since there is no interface translation for this language, translations for these screens will only render for anonymous users in web entries.",
"Your word is our command!": "Your word is our command!",
"Use Artificial Intelligence in any natural language to create complex Processes, just like writing to a person. Even describe your Process in one language, but output your model in another.":"Use Artificial Intelligence in any natural language to create complex Processes, just like writing to a person. Even describe your Process in one language, but output your model in another.",
"Publish Template": "Publish Template",