@@ -273,11 +273,11 @@ Translation is different with custom messages.
273
273
Translation may needed when you use custom message for rule ` in ` , ` not_in ` , ` mimes ` , and ` uploaded_file ` .
274
274
275
275
For example if you use rule ` in:1,2,3 ` we will set invalid message like "The Attribute only allows '1', '2', or '3'"
276
- where message "'1', '2', or '3'" is comes from ": allowed_values " tag.
277
- So if you have custom Indonesian message ": attribute hanya mengizinkan : allowed_values ",
278
- we will set invalid message like "Attribute hanya mengizinkan '1', '2', or '3'" which is the "or" word is not Indonesian language.
276
+ where part "'1', '2', or '3'" is comes from ": allowed_values " tag.
277
+ So if you have custom Indonesian message ": attribute hanya memperbolehkan : allowed_values ",
278
+ we will set invalid message like "Attribute hanya memperbolehkan '1', '2', or '3'" which is the "or" word is not part of Indonesian language.
279
279
280
- So, to solves this problem, we can use translation like this:
280
+ So, to solve this problem, we can use translation like this:
281
281
282
282
``` php
283
283
// Set translation for words 'and' and 'or'.
@@ -287,14 +287,14 @@ $validator->setTranslations([
287
287
]);
288
288
289
289
// Set custom message for 'in' rule
290
- $validator->setMessage('in', ":attribute hanya mengizinkan :allowed_values");
290
+ $validator->setMessage('in', ":attribute hanya memperbolehkan :allowed_values");
291
291
292
292
// Validate
293
293
$validation = $validator->validate($inputs, [
294
294
'nomor' => 'in:1,2,3'
295
295
]);
296
296
297
- $message = $validation->errors()->first('nomor'); // "Nomor hanya mengizinkan '1', '2', atau '3'"
297
+ $message = $validation->errors()->first('nomor'); // "Nomor hanya memperbolehkan '1', '2', atau '3'"
298
298
```
299
299
300
300
> Actually, our built-in rules only use words 'and' and 'or' that you may need to translates.
0 commit comments