Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ProcessMaker/Http/Controllers/Api/ProcessTranslationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
</b-form-checkbox>
</div>
</div>

<div class="mt-3" v-if="showLanguageWarning">
<p class="alert alert-warning m-0">
{{ $t("Since there is no interface translation for this language, translations for these screens will only render for anonymous users in web entries.") }}
</p>
</div>
</div>

<!-- Processing translations section -->
Expand Down Expand Up @@ -143,6 +149,7 @@ export default {
disabled: false,
aiLoading: false,
availableLanguages: [],
availablePmLanguages: [],
selectedLanguage: null,
selectedScreen: null,
screensTranslations: [],
Expand All @@ -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 = [];
Expand Down Expand Up @@ -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;
});
},
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down