3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
12 namespace Civi\WorkflowMessage\Traits
;
14 trait LocalizationTrait
{
25 public function getLocale(): ?
string {
30 * @param string|null $locale
33 public function setLocale(?
string $locale) {
34 $this->locale
= $locale;
38 protected function validateExtra_localization(&$errors) {
39 $allLangs = \CRM_Core_I18n
::languages();
40 if ($this->locale
!== NULL && !isset($allLangs[$this->locale
])) {
42 'severity' => 'error',
43 'fields' => ['locale'],
44 'name' => 'badLocale',
45 'message' => ts('The given locale is not valid (%1)', [json_encode($this->locale
)]),