file_bulkupload_translations-1.0.x-dev/src/Plugin/Validation/Constraint/UniqueLanguageConstraint.php
src/Plugin/Validation/Constraint/UniqueLanguageConstraint.php
<?php
declare(strict_types=1);
namespace Drupal\file_bulkupload_translations\Plugin\Validation\Constraint;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;
/**
* Check that there are no files with the same language.
*/
#[Constraint(
id : "UniqueLanguage",
label : new TranslatableMarkup("In case of cardinality 1, not possible to have multiple files of the same language", [], ['context' => 'Validation']),
type : 'file'
)]
class UniqueLanguageConstraint extends SymfonyConstraint {
/**
* Error message when uploading same language.
*/
public const NOT_UNIQUE = 'You cannot upload more than one file with the same language (%filename_language).';
}
