Beautiful Open-Source Form Builder
Fix missing and corrupted form validation translations (#1313)
Julien Nahum3cc54d37a8b1
diff --git a/README.md b/README.mdindex def25c70e..ee2dae0c2 100644--- a/README.md+++ b/README.md@@ -101,3 +101,9 @@ OpnForm uses a dual-license model to make the project sustainable:- **Enterprise Edition** (Proprietary): Advanced features under `api/app/Enterprise/` are available under our [Enterprise License](https://github.com/OpnForm/OpnForm/blob/main/api/app/Enterprise/LICENSE) and [Enterprise Terms](https://opnform.com/terms-conditions). These features help fund ongoing development and keep OpnForm sustainable.By offering Enterprise features alongside our open-source core, we can continue to invest in making OpnForm better for everyone while keeping the project financially sustainable.++### Form validation translations++Public submissions use the form's language for API validation messages. When adding a translated validation message, update the catalogs under `api/resources/lang/` for all languages in `Form::LANGUAGES`, preserving placeholders such as `:attribute`, `:min`, and `:max`.++Run `vendor/bin/pest --filter=FormValidationTranslationsTest` from `api/` to check supported catalogs and render invalid date range, rating, selection, and Arabic file-type errors. The tests do not require a database. The catalog check excludes custom attribute aliases and the legacy password key, whose structure differs between Laravel versions. Client text coverage is checked separately by `test/unit/form-locale-keys.test.ts` in `client/`.diff --git a/api/resources/lang/ar/validation.php b/api/resources/lang/ar/validation.phpindex 9e712fc48..9fffa4e0d 100644--- a/api/resources/lang/ar/validation.php+++ b/api/resources/lang/ar/validation.php@@ -13,7 +13,7 @@ return ['before_or_equal' => ':attribute يجب أن يكون تاريخا سابقا أو مطابقا للتاريخ :date.','between' => ['numeric' => 'يجب أن تكون قيمة :attribute بين :min و :max.',- 'file' => 'يجب أن يكون حجم الملف :attribute بين :min و :max ��يلوبايت.',+ 'file' => 'يجب أن يكون حجم الملف :attribute بين :min و :max كيلوبايت.','string' => 'يجب أن يكون عدد حروف النّص :attribute بين :min و :max.','array' => 'يجب أن يحتوي :attribute على عدد من العناصر بين :min و :max.',],@@ -66,12 +66,12 @@ return [],'max' => ['numeric' => 'يجب أن تكون قيمة :attribute مساوية أو أصغر من :max.',- 'file' => 'يجب أن لا يتجاوز حجم الملف :attribute :max كيلوبا��ت.',+ 'file' => 'يجب أن لا يتجاوز حجم الملف :attribute :max كيلوبايت.','string' => 'يجب أن لا يتجاوز طول النّص :attribute :max حروفٍ/حرفًا.','array' => 'يجب أن لا يحتوي :attribute على أكثر من :max عناصر/عنصر.',],- 'mimes' => 'يجب أن يكون ملفًا من نوع : :values.',- 'mimetypes' => 'يجب أن يكون ملفًا من نوع : :values.',+ 'mimes' => 'يجب أن يكون :attribute ملفًا من نوع: :values.',+ 'mimetypes' => 'يجب أن يكون :attribute ملفًا من نوع: :values.','min' => ['numeric' => 'يجب أن تكون قيمة :attribute مساوية أو أكبر من :min.','file' => 'يجب أن يكون حجم الملف :attribute على الأقل :min كيلوبايت.',@@ -120,4 +120,11 @@ return ['complete_captcha' => 'يرجى إكمال التحقق من صحة الحقل.','yes' => 'نعم','no' => 'لا',++ 'from_date_required' => 'تاريخ البداية مطلوب',+ 'to_date_required' => 'تاريخ النهاية مطلوب',+ 'from_date_before_or_equal' => 'يجب أن يكون تاريخ البداية قبل تاريخ النهاية أو مساويًا له',+ 'rating_min' => 'يجب اختيار تقييم',+ 'select_min' => 'يرجى اختيار :min خيارات على الأقل',+ 'select_max' => 'يرجى اختيار :max خيارات كحد أقصى',];diff --git a/api/resources/lang/bn/validation.php b/api/resources/lang/bn/validation.phpindex c16871758..4943d15ea 100644--- a/api/resources/lang/bn/validation.php+++ b/api/resources/lang/bn/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'অনুগ্রহ করে টিপস টিপুন।','yes' => 'হ্যাঁ','no' => 'না',++ 'from_date_required' => 'শুরুর তারিখ প্রয়োজন',+ 'to_date_required' => 'শেষের তারিখ প্রয়োজন',+ 'from_date_before_or_equal' => 'শুরুর তারিখ শেষের তারিখের আগে বা সমান হতে হবে',+ 'rating_min' => 'একটি রেটিং নির্বাচন করতে হবে',+ 'select_min' => 'অনুগ্রহ করে অন্তত :minটি বিকল্প নির্বাচন করুন',+ 'select_max' => 'অনুগ্রহ করে সর্বাধিক :maxটি বিকল্প নির্বাচন করুন',];diff --git a/api/resources/lang/ca/validation.php b/api/resources/lang/ca/validation.phpindex 8ffb9dc96..dcd2ae3c1 100644--- a/api/resources/lang/ca/validation.php+++ b/api/resources/lang/ca/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'Si us plau, completa el CAPTCHA.','yes' => 'Sí','no' => 'No',++ 'from_date_required' => 'La data inicial és obligatòria',+ 'to_date_required' => 'La data final és obligatòria',+ 'from_date_before_or_equal' => 'La data inicial ha de ser anterior o igual a la data final',+ 'rating_min' => 'Cal seleccionar una valoració',+ 'select_min' => 'Seleccioneu almenys :min opcions',+ 'select_max' => 'Seleccioneu com a màxim :max opcions',];diff --git a/api/resources/lang/cs/validation.php b/api/resources/lang/cs/validation.phpindex 0484dca3d..aed9ae3f4 100644--- a/api/resources/lang/cs/validation.php+++ b/api/resources/lang/cs/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'Prosím, vyplňte CAPTCHA.','yes' => 'Ano','no' => 'Ne',++ 'from_date_required' => 'Počáteční datum je povinné',+ 'to_date_required' => 'Koncové datum je povinné',+ 'from_date_before_or_equal' => 'Počáteční datum musí být před koncovým datem nebo stejné',+ 'rating_min' => 'Musí být vybráno hodnocení',+ 'select_min' => 'Vyberte alespoň :min možností',+ 'select_max' => 'Vyberte nejvýše :max možností',];diff --git a/api/resources/lang/de/validation.php b/api/resources/lang/de/validation.phpindex 9289f9c0f..a8dabe1b2 100644--- a/api/resources/lang/de/validation.php+++ b/api/resources/lang/de/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'Bitte füllen Sie die CAPTCHA aus.','yes' => 'Ja','no' => 'Nein',++ 'from_date_required' => 'Das Startdatum ist erforderlich',+ 'to_date_required' => 'Das Enddatum ist erforderlich',+ 'from_date_before_or_equal' => 'Das Startdatum muss vor oder am Enddatum liegen',+ 'rating_min' => 'Eine Bewertung muss ausgewählt werden',+ 'select_min' => 'Bitte wählen Sie mindestens :min Optionen aus',+ 'select_max' => 'Bitte wählen Sie höchstens :max Optionen aus',];diff --git a/api/resources/lang/es/validation.php b/api/resources/lang/es/validation.phpindex 5020d3087..5359ab791 100755--- a/api/resources/lang/es/validation.php+++ b/api/resources/lang/es/validation.php@@ -158,4 +158,41 @@ return ['yes' => 'Sí','no' => 'No',+ 'from_date_required' => 'La fecha de inicio es obligatoria',+ 'to_date_required' => 'La fecha de fin es obligatoria',+ 'from_date_before_or_equal' => 'La fecha de inicio debe ser anterior o igual a la fecha de fin',+ 'rating_min' => 'Debe seleccionar una valoración',+ 'select_min' => 'Seleccione al menos :min opciones',+ 'select_max' => 'Seleccione como máximo :max opciones',+ 'date_equals' => ':attribute debe ser una fecha igual a :date.',+ 'ends_with' => ':attribute debe terminar con uno de los siguientes valores: :values.',+ 'gt' => [+ 'numeric' => ':attribute debe ser mayor que :value.',+ 'file' => ':attribute debe ser mayor que :value kilobytes.',+ 'string' => ':attribute debe tener más de :value caracteres.',+ 'array' => ':attribute debe tener más de :value elementos.',+ ],+ 'gte' => [+ 'numeric' => ':attribute debe ser mayor o igual que :value.',+ 'file' => ':attribute debe ser mayor o igual que :value kilobytes.',+ 'string' => ':attribute debe tener al menos :value caracteres.',+ 'array' => ':attribute debe tener al menos :value elementos.',+ ],+ 'lt' => [+ 'numeric' => ':attribute debe ser menor que :value.',+ 'file' => ':attribute debe ser menor que :value kilobytes.',+ 'string' => ':attribute debe tener menos de :value caracteres.',+ 'array' => ':attribute debe tener menos de :value elementos.',+ ],+ 'lte' => [+ 'numeric' => ':attribute debe ser menor o igual que :value.',+ 'file' => ':attribute debe ser menor o igual que :value kilobytes.',+ 'string' => ':attribute debe tener como máximo :value caracteres.',+ 'array' => ':attribute debe tener como máximo :value elementos.',+ ],+ 'multiple_of' => ':attribute debe ser un múltiplo de :value.',+ 'not_regex' => 'El formato de :attribute no es válido.',+ 'password' => 'La contraseña es incorrecta.',+ 'starts_with' => ':attribute debe comenzar con uno de los siguientes valores: :values.',+ 'uuid' => ':attribute debe ser un UUID válido.',];diff --git a/api/resources/lang/eu/validation.php b/api/resources/lang/eu/validation.phpindex 8676d586f..c5fc3c3cf 100644--- a/api/resources/lang/eu/validation.php+++ b/api/resources/lang/eu/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'Mesedez, bete CAPTCHA.','yes' => 'Bai','no' => 'Ez',++ 'from_date_required' => 'Hasiera-data beharrezkoa da',+ 'to_date_required' => 'Amaiera-data beharrezkoa da',+ 'from_date_before_or_equal' => 'Hasiera-data amaiera-data baino lehenagokoa edo berdina izan behar da',+ 'rating_min' => 'Balorazio bat hautatu behar da',+ 'select_min' => 'Hautatu gutxienez :min aukera',+ 'select_max' => 'Hautatu gehienez :max aukera',];diff --git a/api/resources/lang/fr/validation.php b/api/resources/lang/fr/validation.phpindex 61d66ac2f..dea799e8c 100644--- a/api/resources/lang/fr/validation.php+++ b/api/resources/lang/fr/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'Veuillez compléter le captcha.','yes' => 'Oui','no' => 'Non',++ 'from_date_required' => 'La date de début est obligatoire',+ 'to_date_required' => 'La date de fin est obligatoire',+ 'from_date_before_or_equal' => 'La date de début doit être antérieure ou égale à la date de fin',+ 'rating_min' => 'Une note doit être sélectionnée',+ 'select_min' => 'Veuillez sélectionner au moins :min options',+ 'select_max' => 'Veuillez sélectionner au maximum :max options',];diff --git a/api/resources/lang/gl/validation.php b/api/resources/lang/gl/validation.phpindex 8aa4d3d62..cf99981bc 100644--- a/api/resources/lang/gl/validation.php+++ b/api/resources/lang/gl/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'Por favor, completa o CAPTCHA.','yes' => 'Si','no' => 'Non',++ 'from_date_required' => 'A data de inicio é obrigatoria',+ 'to_date_required' => 'A data de fin é obrigatoria',+ 'from_date_before_or_equal' => 'A data de inicio debe ser anterior ou igual á data de fin',+ 'rating_min' => 'Debe seleccionar unha valoración',+ 'select_min' => 'Seleccione polo menos :min opcións',+ 'select_max' => 'Seleccione como máximo :max opcións',];diff --git a/api/resources/lang/hi/validation.php b/api/resources/lang/hi/validation.phpindex d9455911e..dfe536b04 100644--- a/api/resources/lang/hi/validation.php+++ b/api/resources/lang/hi/validation.php@@ -70,7 +70,7 @@ return ['string' => ':attribute, :max वर्णों से बड़ा नहीं हो सकता है।','array' => ':attribute में :max से अधिक आइटम नहीं हो सकते हैं।',],- 'mimes' => ':attribute एक प्रकार की फ़ाइल: :values होनी च��हिए।',+ 'mimes' => ':attribute एक प्रकार की फ़ाइल: :values होनी चाहिए।','mimetypes' => ':attribute एक प्रकार की फ़ाइल: :values होनी चाहिए।','min' => ['numeric' => ':attribute कम से कम :min होना चाहिए।',@@ -100,7 +100,7 @@ return ['array' => ':attribute में :size आइटम होने चाहिए।',],'starts_with' => ':attribute निम्न में से किसी एक से शुरू होना चाहिए: :values',- 'string' => ':attribute एक स्ट्रिंग हो��ी चाहिए।',+ 'string' => ':attribute एक स्ट्रिंग होनी चाहिए।','timezone' => ':attribute एक मान्य क्षेत्र होना चाहिए।','unique' => ':attribute पहले से ही लिया गया है।','uploaded' => ':attribute अपलोड करने में विफल रहा।',@@ -120,4 +120,11 @@ return ['complete_captcha' => 'कृपया कैप्चा भरें।','yes' => 'है','no' => 'नहीं',++ 'from_date_required' => 'प्रारंभ तिथि आवश्यक है',+ 'to_date_required' => 'समाप्ति तिथि आवश्यक है',+ 'from_date_before_or_equal' => 'प्रारंभ तिथि समाप्ति तिथि से पहले या उसके बराबर होनी चाहिए',+ 'rating_min' => 'एक रेटिंग चुनना आवश्यक है',+ 'select_min' => 'कृपया कम से कम :min विकल्प चुनें',+ 'select_max' => 'कृपया अधिकतम :max विकल्प चुनें',];diff --git a/api/resources/lang/ja/validation.php b/api/resources/lang/ja/validation.phpindex d00fb916d..5384f8b05 100644--- a/api/resources/lang/ja/validation.php+++ b/api/resources/lang/ja/validation.php@@ -31,7 +31,7 @@ return ['ends_with' => ':attributeは、次のいずれかで終わる必要があります。: :values','exists' => '選択された:attributeは、有効ではありません。','file' => ':attributeには、ファイルを指定してください。',- 'filled' => ':attributeには、値を指��してください。',+ 'filled' => ':attributeには、値を指定してください。','gt' => ['numeric' => ':attributeは、:valueより大きくなければなりません。','file' => ':attributeは、:value KBより大きくなければなりません。',@@ -120,4 +120,11 @@ return ['complete_captcha' => 'CAPTCHAを完了してください。','yes' => 'はい','no' => 'いいえ',++ 'from_date_required' => '開始日は必須です',+ 'to_date_required' => '終了日は必須です',+ 'from_date_before_or_equal' => '開始日は終了日以前でなければなりません',+ 'rating_min' => '評価を選択してください',+ 'select_min' => ':min 個以上の選択肢を選択してください',+ 'select_max' => '選択できる選択肢は :max 個までです',];diff --git a/api/resources/lang/jv/validation.php b/api/resources/lang/jv/validation.phpindex 1db7227b1..bcf93021c 100644--- a/api/resources/lang/jv/validation.php+++ b/api/resources/lang/jv/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'CAPTCHA kudu diisi.','yes' => 'Ya','no' => 'Tidak',++ 'from_date_required' => 'Tanggal wiwitan kudu diisi',+ 'to_date_required' => 'Tanggal pungkasan kudu diisi',+ 'from_date_before_or_equal' => 'Tanggal wiwitan kudu sadurunge utawa padha karo tanggal pungkasan',+ 'rating_min' => 'Rating kudu dipilih',+ 'select_min' => 'Mangga pilih paling ora :min pilihan',+ 'select_max' => 'Mangga pilih paling akeh :max pilihan',];diff --git a/api/resources/lang/ko/validation.php b/api/resources/lang/ko/validation.phpindex 01efb2b88..c53f28d9e 100644--- a/api/resources/lang/ko/validation.php+++ b/api/resources/lang/ko/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => '캡차를 완료해 주세요.','yes' => '예','no' => '아니오',++ 'from_date_required' => '시작 날짜는 필수입니다',+ 'to_date_required' => '종료 날짜는 필수입니다',+ 'from_date_before_or_equal' => '시작 날짜는 종료 날짜보다 이전이거나 같아야 합니다',+ 'rating_min' => '평점을 선택해야 합니다',+ 'select_min' => '최소 :min개의 옵션을 선택해 주세요',+ 'select_max' => '최대 :max개의 옵션을 선택해 주세요',];diff --git a/api/resources/lang/mr/validation.php b/api/resources/lang/mr/validation.phpindex 53105ac8a..6a86d00d6 100644--- a/api/resources/lang/mr/validation.php+++ b/api/resources/lang/mr/validation.php@@ -26,7 +26,7 @@ return ['date_format' => ':attribute हा :format फॉरमॅटशी जुळत नाही.','declined' => ':attribute नाकारणे आवश्यक आहे.','declined_if' => ':other :value असताना :attribute नाकारणे आवश्यक आहे.',- 'different' => ':attribute आणि :other वेगळे अ���ावे.',+ 'different' => ':attribute आणि :other वेगळे असावे.','digits' => ':attribute, :digits अंक असावा.','digits_between' => ':attribute, :min आणि :max अंक दरम्यान असावा.','dimensions' => ':attribute चे अवैध प्रतिमा परिमाण आहेत.',@@ -58,7 +58,7 @@ return ['ipv6' => ':attribute एक वैध IPv6 पत्ता असावा.','json' => ':attribute एक वैध JSON स्ट्रिंग असावी.','lt' => [- 'array' => ':attribute मध्ये :value पेक्षा ��मी आयटम असावेत.',+ 'array' => ':attribute मध्ये :value पेक्षा कमी आयटम असावेत.','file' => ':attribute, :value किलोबाइटपेक्षा लहान असावा.','numeric' => ':attribute, :value पेक्षा लहान असावा.','string' => ':attribute, :value वर्णांपेक्षा लहान असावा.',@@ -104,7 +104,7 @@ return ['required' => ':attribute फील्ड आवश्यक आहे.','required_array_keys' => ':attribute फील्डमध्ये खालील नोंदी असणे आवश्यक आहे: :values.','required_if' => ':other :value असताना :attribute फील्ड आवश्यक आहे.',- 'required_unless' => ':other :values मध्य�� नसेल तर :attribute फील्ड आवश्यक आहे.',+ 'required_unless' => ':other :values मध्ये नसेल तर :attribute फील्ड आवश्यक आहे.','required_with' => ':values उपस्थित असताना :attribute फील्ड आवश्यक आहे.','required_with_all' => ':values उपस्थित असताना :attribute फील्ड आवश्यक आहे.','required_without' => ':values उपस्थित नसताना :attribute फील्ड आवश्यक आहे.',@@ -137,4 +137,11 @@ return ['complete_captcha' => 'कृपया कैप्चा भरा.','yes' => 'है','no' => 'नहीं',++ 'from_date_required' => 'सुरुवातीची तारीख आवश्यक आहे',+ 'to_date_required' => 'शेवटची तारीख आवश्यक आहे',+ 'from_date_before_or_equal' => 'सुरुवातीची तारीख शेवटच्या तारखेपूर्वी किंवा त्याच दिवशी असणे आवश्यक आहे',+ 'rating_min' => 'रेटिंग निवडणे आवश्यक आहे',+ 'select_min' => 'कृपया किमान :min पर्याय निवडा',+ 'select_max' => 'कृपया जास्तीत जास्त :max पर्याय निवडा',];diff --git a/api/resources/lang/pa/validation.php b/api/resources/lang/pa/validation.phpindex 4cd540a31..ed2366b8c 100644--- a/api/resources/lang/pa/validation.php+++ b/api/resources/lang/pa/validation.php@@ -35,7 +35,7 @@ return ['gt' => ['numeric' => ':attribute :value ਤੋਂ ਵੱਡਾ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ।','file' => ':attribute :value ਕਿਲੋਬਾਈਟਸ ਤੋਂ ਵੱਡਾ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ।',- 'string' => ':attribute :value ਅੱਖਰਾ��� ਤੋਂ ਵੱਡਾ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ।',+ 'string' => ':attribute :value ਅੱਖਰਾਂ ਤੋਂ ਵੱਡਾ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ।','array' => ':attribute ਵਿੱਚ :value ਤੋਂ ਵੱਧ ਆਈਟਮਾਂ ਹੋਣੀਆਂ ਚਾਹੀਦੀਆਂ ਹਨ।',],'gte' => [@@ -62,7 +62,7 @@ return ['numeric' => ':attribute :value ਤੋਂ ਛੋਟਾ ਜਾਂ ਬਰਾਬਰ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ।','file' => ':attribute :value ਕਿਲੋਬਾਈਟਸ ਤੋਂ ਛੋਟਾ ਜਾਂ ਬਰਾਬਰ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ।','string' => ':attribute :value ਅੱਖਰਾਂ ਤੋਂ ਛੋਟਾ ਜਾਂ ਬਰਾਬਰ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ।',- 'array' => ':attribute ਵਿੱਚ :value ਤੋਂ ਵੱਧ ਆਈਟਮਾਂ ਨਹੀ�� ਹੋਣੀਆਂ ਚਾਹੀਦੀਆਂ।',+ 'array' => ':attribute ਵਿੱਚ :value ਤੋਂ ਵੱਧ ਆਈਟਮਾਂ ਨਹੀਂ ਹੋਣੀਆਂ ਚਾਹੀਦੀਆਂ।',],'max' => ['numeric' => ':attribute :max ਤੋਂ ਵੱਡਾ ਨਹੀਂ ਹੋ ਸਕਦਾ।',@@ -91,7 +91,7 @@ return ['required_with' => ':attribute ਫੀਲਡ ਲੋੜੀਂਦਾ ਹੈ ਜਦੋਂ :values ਮੌਜੂਦ ਹੈ।','required_with_all' => ':attribute ਫੀਲਡ ਲੋੜੀਂਦਾ ਹੈ ਜਦੋਂ :values ਮੌਜੂਦ ਹਨ।','required_without' => ':attribute ਫੀਲਡ ਲੋੜੀਂਦਾ ਹੈ ਜਦੋਂ :values ਮੌਜੂਦ ਨਹੀਂ ਹੈ।',- 'required_without_all' => ':attribute ਫੀਲਡ ਲੋੜੀ��ਦਾ ਹੈ ਜਦੋਂ :values ਵਿੱਚੋਂ ਕੋਈ ਵੀ ਮੌਜੂਦ ਨਹੀਂ ਹੈ।',+ 'required_without_all' => ':attribute ਫੀਲਡ ਲੋੜੀਂਦਾ ਹੈ ਜਦੋਂ :values ਵਿੱਚੋਂ ਕੋਈ ਵੀ ਮੌਜੂਦ ਨਹੀਂ ਹੈ।','same' => ':attribute ਅਤੇ :other ਮੇਲ ਖਾਣੇ ਚਾਹੀਦੇ ਹਨ।','size' => ['numeric' => ':attribute :size ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ।',@@ -120,4 +120,11 @@ return ['complete_captcha' => 'ਕਿਰਪਾ ਕਰੋ ਕੈਪਚਾ ਭਰੋ।','yes' => 'ਹੈ','no' => 'ਨਹੀਂ',++ 'from_date_required' => 'ਸ਼ੁਰੂਆਤੀ ਮਿਤੀ ਲੋੜੀਂਦੀ ਹੈ',+ 'to_date_required' => 'ਅੰਤਿਮ ਮਿਤੀ ਲੋੜੀਂਦੀ ਹੈ',+ 'from_date_before_or_equal' => 'ਸ਼ੁਰੂਆਤੀ ਮਿਤੀ ਅੰਤਿਮ ਮਿਤੀ ਤੋਂ ਪਹਿਲਾਂ ਜਾਂ ਉਸ ਦੇ ਬਰਾਬਰ ਹੋਣੀ ਚਾਹੀਦੀ ਹੈ',+ 'rating_min' => 'ਇੱਕ ਰੇਟਿੰਗ ਚੁਣਨੀ ਲੋੜੀਂਦੀ ਹੈ',+ 'select_min' => 'ਕਿਰਪਾ ਕਰਕੇ ਘੱਟੋ-ਘੱਟ :min ਵਿਕਲਪ ਚੁਣੋ',+ 'select_max' => 'ਕਿਰਪਾ ਕਰਕੇ ਵੱਧ ਤੋਂ ਵੱਧ :max ਵਿਕਲਪ ਚੁਣੋ',];diff --git a/api/resources/lang/pl/validation.php b/api/resources/lang/pl/validation.phpindex 8181fe5a9..5a1e99417 100644--- a/api/resources/lang/pl/validation.php+++ b/api/resources/lang/pl/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'Proszę wypełnić kod CAPTCHA.','yes' => 'Tak','no' => 'Nie',++ 'from_date_required' => 'Data początkowa jest wymagana',+ 'to_date_required' => 'Data końcowa jest wymagana',+ 'from_date_before_or_equal' => 'Data początkowa musi być wcześniejsza lub równa dacie końcowej',+ 'rating_min' => 'Należy wybrać ocenę',+ 'select_min' => 'Wybierz co najmniej :min opcji',+ 'select_max' => 'Wybierz nie więcej niż :max opcji',];diff --git a/api/resources/lang/pt/validation.php b/api/resources/lang/pt/validation.phpindex 350e222e1..46074b209 100644--- a/api/resources/lang/pt/validation.php+++ b/api/resources/lang/pt/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'Por favor, complete o captcha.','yes' => 'Sim','no' => 'Não',++ 'from_date_required' => 'A data de início é obrigatória',+ 'to_date_required' => 'A data de fim é obrigatória',+ 'from_date_before_or_equal' => 'A data de início deve ser anterior ou igual à data de fim',+ 'rating_min' => 'É necessário selecionar uma avaliação',+ 'select_min' => 'Selecione pelo menos :min opções',+ 'select_max' => 'Selecione no máximo :max opções',];diff --git a/api/resources/lang/ru/validation.php b/api/resources/lang/ru/validation.phpindex 5fab695f1..02784a85e 100644--- a/api/resources/lang/ru/validation.php+++ b/api/resources/lang/ru/validation.php@@ -55,7 +55,7 @@ return ['lt' => ['numeric' => 'Поле :attribute должно быть меньше :value.','file' => 'Размер файла в поле :attribute должен быть меньше :value килобайт.',- 'string' => 'Количество символов в поле :attribute должн�� быть меньше :value.',+ 'string' => 'Количество символов в поле :attribute должно быть меньше :value.','array' => 'Количество элементов в поле :attribute должно быть меньше :value.',],'lte' => [@@ -120,4 +120,11 @@ return ['complete_captcha' => 'Пожалуйста, заполните CAPTCHA.','yes' => 'Да','no' => 'Нет',++ 'from_date_required' => 'Дата начала обязательна',+ 'to_date_required' => 'Дата окончания обязательна',+ 'from_date_before_or_equal' => 'Дата начала должна быть раньше даты окончания или совпадать с ней',+ 'rating_min' => 'Необходимо выбрать оценку',+ 'select_min' => 'Выберите не менее :min вариантов',+ 'select_max' => 'Выберите не более :max вариантов',];diff --git a/api/resources/lang/sk/validation.php b/api/resources/lang/sk/validation.phpindex 5f744750d..767eaad88 100644--- a/api/resources/lang/sk/validation.php+++ b/api/resources/lang/sk/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'Prosím, vyplňte CAPTCHA.','yes' => 'Áno','no' => 'Nie',++ 'from_date_required' => 'Počiatočný dátum je povinný',+ 'to_date_required' => 'Koncový dátum je povinný',+ 'from_date_before_or_equal' => 'Počiatočný dátum musí byť pred koncovým dátumom alebo rovnaký',+ 'rating_min' => 'Je potrebné vybrať hodnotenie',+ 'select_min' => 'Vyberte aspoň :min možností',+ 'select_max' => 'Vyberte najviac :max možností',];diff --git a/api/resources/lang/sv/validation.php b/api/resources/lang/sv/validation.phpindex f1517a2eb..b9e835221 100644--- a/api/resources/lang/sv/validation.php+++ b/api/resources/lang/sv/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'Vänligen fyll i CAPTCHA.','yes' => 'Ja','no' => 'Nej',++ 'from_date_required' => 'Startdatum krävs',+ 'to_date_required' => 'Slutdatum krävs',+ 'from_date_before_or_equal' => 'Startdatum måste vara före eller samma som slutdatum',+ 'rating_min' => 'Ett betyg måste väljas',+ 'select_min' => 'Välj minst :min alternativ',+ 'select_max' => 'Välj högst :max alternativ',];diff --git a/api/resources/lang/ta/validation.php b/api/resources/lang/ta/validation.phpindex 0377fec10..2638c4b14 100644--- a/api/resources/lang/ta/validation.php+++ b/api/resources/lang/ta/validation.php@@ -41,7 +41,7 @@ return ['array' => ':attribute :value உருப்படிகளுக்கு மேல் கொண்டிருக்க வேண்டும்.','file' => ':attribute :value கிலோபைட்களுக்கு மேல் இருக்க வேண்டும்.','numeric' => ':attribute :value க்கு மேல் இருக்க வேண்டும்.',- 'string' => ':attribute :value ��ழுத்துகளுக்கு மேல் இருக்க வேண்டும்.',+ 'string' => ':attribute :value எழுத்துகளுக்கு மேல் இருக்க வேண்டும்.',],'gte' => ['array' => ':attribute :value அல்லது அதற்கு மேற்பட்ட உருப்படிகளைக் கொண்டிருக்க வேண்டும்.',@@ -77,7 +77,7 @@ return ['string' => ':attribute :max எழுத்துகளுக்கு மேல் இருக்கக்கூடாது.',],'mimes' => ':attribute பின்வரும் வகையான கோப்பாக இருக்க வேண்டும்: :values.',- 'mimetypes' => ':attribute பின்வரும் வகையான கோப்பாக இருக்க வே���்டும்: :values.',+ 'mimetypes' => ':attribute பின்வரும் வகையான கோப்பாக இருக்க வேண்டும்: :values.','min' => ['array' => ':attribute குறைந்தது :min உருப்படிகளைக் கொண்டிருக்க வேண்டும்.','file' => ':attribute குறைந்தது :min கிலோபைட்களாக இருக்க வேண்டும்.',@@ -90,7 +90,7 @@ return ['numeric' => ':attribute ஒரு எண்ணாக இருக்க வேண்டும்.','password' => ['letters' => ':attribute குறைந்தது ஒரு எழுத்தையாவது கொண்டிருக்க வேண்டும்.',- 'mixed' => ':attribute குறைந்தது ஒரு பெரிய எழுத்த��� மற்றும் ஒரு சிறிய எழுத்தையாவது கொண்டிருக்க வேண்டும்.',+ 'mixed' => ':attribute குறைந்தது ஒரு பெரிய எழுத்து மற்றும் ஒரு சிறிய எழுத்தையாவது கொண்டிருக்க வேண்டும்.','numbers' => ':attribute குறைந்தது ஒரு எண்ணையாவது கொண்டிருக்க வேண்டும்.','symbols' => ':attribute குறைந்தது ஒரு சின்னத்தையாவது கொண்டிருக்க வேண்டும்.','uncompromised' => 'கொடுக்கப்பட்ட :attribute தரவு கசிவில் தோன்றியுள்ளது. வேறு :attribute ஐத் தேர்வு செய்யவும்.',@@ -137,4 +137,11 @@ return ['complete_captcha' => 'கையால் வைத்த முறையை நிரப்பவும்.','yes' => 'ஆம்','no' => 'இல்லை',++ 'from_date_required' => 'தொடக்கத் தேதி தேவை',+ 'to_date_required' => 'முடிவுத் தேதி தேவை',+ 'from_date_before_or_equal' => 'தொடக்கத் தேதி முடிவுத் தேதிக்கு முன்னதாகவோ அதே தேதியாகவோ இருக்க வேண்டும்',+ 'rating_min' => 'ஒரு மதிப்பீட்டைத் தேர்ந்தெடுக்க வேண்டும்',+ 'select_min' => 'குறைந்தது :min விருப்பங்களைத் தேர்ந்தெடுக்கவும்',+ 'select_max' => 'அதிகபட்சம் :max விருப்பங்களைத் தேர்ந்தெடுக்கவும்',];diff --git a/api/resources/lang/te/validation.php b/api/resources/lang/te/validation.phpindex 16e249ad1..f21ce6adb 100644--- a/api/resources/lang/te/validation.php+++ b/api/resources/lang/te/validation.php@@ -105,7 +105,7 @@ return ['unique' => ':attribute ఇప్పటికే తీసుకోబడింది.','uploaded' => ':attribute అప్లోడ్ చేయడంలో విఫలమైంది.','url' => ':attribute ఫార్మాట్ చెల్లదు.',- 'uuid' => ':attribute తప్పనిసరిగా చ���ల్లుబాటు అయ్యే UUID అయి ఉండాలి.',+ 'uuid' => ':attribute తప్పనిసరిగా చెల్లుబాటు అయ్యే UUID అయి ఉండాలి.','custom' => ['attribute-name' => [@@ -120,4 +120,11 @@ return ['complete_captcha' => 'దయచేసి క్యాప్చా భరించండి.','yes' => 'అవును','no' => 'కానీ',++ 'from_date_required' => 'ప్రారంభ తేదీ అవసరం',+ 'to_date_required' => 'ముగింపు తేదీ అవసరం',+ 'from_date_before_or_equal' => 'ప్రారంభ తేదీ ముగింపు తేదీ కంటే ముందు లేదా దానికి సమానంగా ఉండాలి',+ 'rating_min' => 'రేటింగ్ను ఎంచుకోవాలి',+ 'select_min' => 'దయచేసి కనీసం :min ఎంపికలను ఎంచుకోండి',+ 'select_max' => 'దయచేసి గరిష్టంగా :max ఎంపికలను ఎంచుకోండి',];diff --git a/api/resources/lang/tr/validation.php b/api/resources/lang/tr/validation.phpindex d74a2c125..3c011a2fc 100644--- a/api/resources/lang/tr/validation.php+++ b/api/resources/lang/tr/validation.php@@ -137,4 +137,11 @@ return ['complete_captcha' => 'Lütfen CAPTCHA\'yı tamamlayın.','yes' => 'Evet','no' => 'Hayır',++ 'from_date_required' => 'Başlangıç tarihi gereklidir',+ 'to_date_required' => 'Bitiş tarihi gereklidir',+ 'from_date_before_or_equal' => 'Başlangıç tarihi bitiş tarihinden önce veya onunla aynı olmalıdır',+ 'rating_min' => 'Bir puan seçilmelidir',+ 'select_min' => 'Lütfen en az :min seçenek seçin',+ 'select_max' => 'Lütfen en fazla :max seçenek seçin',];diff --git a/api/resources/lang/ur/validation.php b/api/resources/lang/ur/validation.phpindex 649eacab9..f973bda54 100644--- a/api/resources/lang/ur/validation.php+++ b/api/resources/lang/ur/validation.php@@ -42,7 +42,7 @@ return ['numeric' => ':attribute لازمی طور پر :value سے بڑا یا برابر ہونا چاہیے۔','file' => ':attribute لازمی طور پر :value کلوبائٹس سے بڑا یا برابر ہونا چاہیے۔','string' => ':attribute لازمی طور پر :value حروف سے بڑا یا برابر ہونا چاہیے۔',- 'array' => ':attribute میں لا��می طور پر :value یا اس سے زیادہ آئٹمز ہونی چاہئیں۔',+ 'array' => ':attribute میں لازمی طور پر :value یا اس سے زیادہ آئٹمز ہونی چاہئیں۔',],'image' => ':attribute لازمی طور پر ایک تصویر ہونی چاہیے۔','in' => 'منتخب کردہ :attribute درست نہیں ہے۔',@@ -59,7 +59,7 @@ return ['array' => ':attribute میں لازمی طور پر :value سے کم آئٹمز ہونی چاہئیں۔',],'lte' => [- 'numeric' => ':attribute لازم�� طور پر :value سے چھوٹا یا برابر ہونا چاہیے۔',+ 'numeric' => ':attribute لازمی طور پر :value سے چھوٹا یا برابر ہونا چاہیے۔','file' => ':attribute لازمی طور پر :value کلوبائٹس سے چھوٹا یا برابر ہونا چاہیے۔','string' => ':attribute لازمی طور پر :value حروف سے چھوٹا یا برابر ہونا چاہیے۔','array' => ':attribute میں لازمی طور پر :value سے زیادہ آئٹمز نہیں ہونی چاہئیں۔',@@ -74,7 +74,7 @@ return ['mimetypes' => ':attribute لازمی طور پر :values قسم کی فائل ہونی چاہیے۔','min' => ['numeric' => ':attribute لازمی طور پر کم از کم :min ہونا چاہیے۔',- 'file' => ':attribute لازمی طور پر کم از کم :min ��لوبائٹس ہونا چاہیے۔',+ 'file' => ':attribute لازمی طور پر کم از کم :min کلو بائٹس ہونا چاہیے۔','string' => ':attribute لازمی طور پر کم از کم :min حروف ہونا چاہیے۔','array' => ':attribute میں لازمی طور پر کم از کم :min آئٹمز ہونی چاہئیں۔',],@@ -120,4 +120,11 @@ return ['complete_captcha' => 'براہ کرم کپچا پر کام کریں۔','yes' => 'ہے','no' => 'نہیں',++ 'from_date_required' => 'آغاز کی تاریخ ضروری ہے',+ 'to_date_required' => 'اختتام کی تاریخ ضروری ہے',+ 'from_date_before_or_equal' => 'آغاز کی تاریخ اختتام کی تاریخ سے پہلے یا اس کے برابر ہونی چاہیے',+ 'rating_min' => 'ایک درجہ بندی منتخب کرنا ضروری ہے',+ 'select_min' => 'براہ کرم کم از کم :min اختیارات منتخب کریں',+ 'select_max' => 'براہ کرم زیادہ سے زیادہ :max اختیارات منتخب کریں',];diff --git a/api/resources/lang/vi/validation.php b/api/resources/lang/vi/validation.phpindex d834ce9eb..48d169344 100644--- a/api/resources/lang/vi/validation.php+++ b/api/resources/lang/vi/validation.php@@ -120,4 +120,11 @@ return ['complete_captcha' => 'Vui lòng nhập mã bảo vệ.','yes' => 'Có','no' => 'Không',++ 'from_date_required' => 'Ngày bắt đầu là bắt buộc',+ 'to_date_required' => 'Ngày kết thúc là bắt buộc',+ 'from_date_before_or_equal' => 'Ngày bắt đầu phải trước hoặc bằng ngày kết thúc',+ 'rating_min' => 'Phải chọn một mức đánh giá',+ 'select_min' => 'Vui lòng chọn ít nhất :min lựa chọn',+ 'select_max' => 'Vui lòng chọn không quá :max lựa chọn',];diff --git a/api/resources/lang/zh/validation.php b/api/resources/lang/zh/validation.phpindex 76aa60188..0fd0339ae 100644--- a/api/resources/lang/zh/validation.php+++ b/api/resources/lang/zh/validation.php@@ -19,7 +19,7 @@ return [],'boolean' => ':attribute 必须为布尔值。','confirmed' => ':attribute 两次输入不一致。',- 'date' => ':attribute 不是一���有效的日期。',+ 'date' => ':attribute 不是一个有效的日期。','date_equals' => ':attribute 必须等于 :date。','date_format' => ':attribute 的格式必须为 :format。','different' => ':attribute 和 :other 必须不同。',@@ -95,7 +95,7 @@ return ['same' => ':attribute 和 :other 必须相同。','size' => ['numeric' => ':attribute 大小必须为 :size。',- 'file' => ':attribute 大��必须为 :size KB。',+ 'file' => ':attribute 大小必须为 :size KB。','string' => ':attribute 必须是 :size 个字符。','array' => ':attribute 必须为 :size 个单元。',],@@ -120,4 +120,11 @@ return ['complete_captcha' => '请完成验证码。','yes' => '是','no' => '否',++ 'from_date_required' => '开始日期为必填项',+ 'to_date_required' => '结束日期为必填项',+ 'from_date_before_or_equal' => '开始日期必须早于或等于结束日期',+ 'rating_min' => '请选择评分',+ 'select_min' => '请至少选择 :min 个选项',+ 'select_max' => '请最多选择 :max 个选项',];diff --git a/api/tests/Unit/FormValidationTranslationsTest.php b/api/tests/Unit/FormValidationTranslationsTest.phpnew file mode 100644index 000000000..43403511f--- /dev/null+++ b/api/tests/Unit/FormValidationTranslationsTest.php@@ -0,0 +1,86 @@+<?php++use App\Http\Requests\AnswerFormRequest;+use App\Models\Forms\Form;+use Illuminate\Container\Container;+use Illuminate\Filesystem\Filesystem;+use Illuminate\Support\Arr;+use Illuminate\Translation\FileLoader;+use Illuminate\Translation\Translator;+use Illuminate\Validation\Factory;++function formValidationTranslator(string $locale): Translator+{+ $translator = new Translator(new FileLoader(new Filesystem(), __DIR__ . '/../../resources/lang'), $locale);+ $translator->setFallback('en');++ return $translator;+}++it('keeps validation keys, placeholders and encoding intact in every supported form language', function (string $locale) {+ $english = Arr::dot(require __DIR__ . '/../../resources/lang/en/validation.php');+ $translated = Arr::dot(require __DIR__ . "/../../resources/lang/$locale/validation.php");++ // Password catalogs use different Laravel generations (scalar vs. nested keys).+ foreach ($english as $key => $message) {+ if ($key === 'password' || !is_string($message) || str_starts_with($key, 'custom.') || str_starts_with($key, 'attributes.')) {+ continue;+ }+ expect($translated)->toHaveKey($key);+ preg_match_all('/:[a-z_]+/', $message, $expected);+ preg_match_all('/:[a-z_]+/', $translated[$key], $actual);+ expect(array_diff($expected[0], $actual[0]))->toBe([], "$locale: $key placeholders");+ }+ foreach ($translated as $message) {+ if (is_string($message)) {+ expect($message)->not->toContain("\u{FFFD}");+ }+ }+})->with(Form::LANGUAGES);++it('renders date range, rating and selection failures through the real request messages', function (string $locale) {+ $previousContainer = Container::getInstance();+ $container = new Container();+ $translator = formValidationTranslator($locale);+ $container->instance('translator', $translator);+ Container::setInstance($container);++ try {+ // messages() only needs form properties, not the constructor's workspace lookup.+ $request = (new ReflectionClass(AnswerFormRequest::class))->newInstanceWithoutConstructor();+ $request->form = new Form(['properties' => [+ ['id' => 'period', 'name' => 'Period', 'type' => 'date', 'date_range' => true],+ ['id' => 'rating', 'name' => 'Rating', 'type' => 'rating'],+ ['id' => 'choices', 'name' => 'Choices', 'type' => 'multi_select', 'min_selection' => 2, 'max_selection' => 3],+ ]]);+ $factory = new Factory($translator);+ $cases = [+ [['period' => [null, '2026-10-05']], ['period.0' => 'required_with:period.1'], 'period.0', 'from_date_required'],+ [['period' => ['2026-10-05', null]], ['period.1' => 'required_with:period.0'], 'period.1', 'to_date_required'],+ [['period' => ['2026-10-06', '2026-10-05']], ['period.0' => 'before_or_equal:period.1'], 'period.0', 'from_date_before_or_equal'],+ [['rating' => 0], ['rating' => 'numeric|min:1'], 'rating', 'rating_min'],+ [['choices' => ['A']], ['choices' => 'array|min:2'], 'choices', 'select_min'],+ [['choices' => ['A', 'B', 'C', 'D']], ['choices' => 'array|max:3'], 'choices', 'select_max'],+ ];+ foreach ($cases as [$data, $rules, $field, $key]) {+ $validator = $factory->make($data, $rules, $request->messages());+ expect($validator->fails())->toBeTrue();+ $message = $validator->errors()->first($field);+ expect($message)->toBe($translator->get("validation.$key", ['min' => 2, 'max' => 3], $locale, false));+ expect($message)->not->toContain(':min', ':max', 'validation.');+ if ($locale !== 'en') {+ expect($message)->not->toBe(formValidationTranslator('en')->get("validation.$key", ['min' => 2, 'max' => 3]));+ }+ }+ } finally {+ Container::setInstance($previousContainer);+ }+})->with(Form::LANGUAGES);++it('keeps the Arabic field name and allowed file types in file validation errors', function (string $rule) {+ $factory = new Factory(formValidationTranslator('ar'));+ $validator = $factory->make(['upload' => 'invalid'], ['upload' => "$rule:pdf"], [], ['upload' => 'المرفق']);++ expect($validator->fails())->toBeTrue();+ expect($validator->errors()->first('upload'))->toContain('المرفق', 'pdf')->not->toContain(':attribute', ':values');+})->with(['mimes', 'mimetypes']);