From: Tim Düsterhus Date: Wed, 26 Apr 2023 10:07:54 +0000 (+0200) Subject: Disallow changing the languageCode of existing languages X-Git-Tag: 6.0.0_Alpha_1~202 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f3951adda52b0d19cc4387f0c7c71defaec6e14d;p=GitHub%2FWoltLab%2FWCF.git Disallow changing the languageCode of existing languages Changing the language code for an existing language effectively invalidates everything that is already stored within that language and thus is not a useful operation. Changing the country code or locale should be compatible with existing phrases or contents and thus is still allowed. --- diff --git a/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php index 424044bb27..680e228ceb 100644 --- a/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php @@ -97,6 +97,7 @@ class LanguageAddForm extends AbstractFormBuilderForm ->description('wcf.acp.language.code.description') ->maximumLength(20) ->required() + ->immutable($this->form->getFormMode() === IFormDocument::FORM_MODE_UPDATE) ->addValidator(new FormFieldValidator('unique', function (TextFormField $formField) { if ($formField->getValidationErrors() !== []) { return;