Disallow changing the languageCode of existing languages
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 26 Apr 2023 10:07:54 +0000 (12:07 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 26 Apr 2023 10:07:54 +0000 (12:07 +0200)
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.

wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php

index 424044bb272af27cf860cb1efa2d602ca3122241..680e228ceb5b9d16a48fa6f7da6fa623f3d9b3e7 100644 (file)
@@ -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;