@@ -242,6 +242,9 @@ public function testBasicTranslateFunction()
242
242
I18n::defaultFormatter ('sprintf ' );
243
243
$ this ->assertEquals ('%d is 1 (po translated) ' , __ ('%d = 1 ' ));
244
244
$ this ->assertEquals ('1 is 1 (po translated) ' , __ ('%d = 1 ' , 1 ));
245
+ $ this ->assertEquals ('1 is 1 (po translated) ' , __ ('%d = 1 ' , [1 ]));
246
+ $ this ->assertEquals ('The red dog, and blue cat ' , __ ('The %s dog, and %s cat ' , ['red ' , 'blue ' ]));
247
+ $ this ->assertEquals ('The red dog, and blue cat ' , __ ('The %s dog, and %s cat ' , 'red ' , 'blue ' ));
245
248
}
246
249
247
250
/**
@@ -268,6 +271,12 @@ public function testBasicTranslatePluralFunction()
268
271
269
272
$ result = __n ('singular msg ' , '%d = 0 or > 1 ' , 2 );
270
273
$ this ->assertEquals ('2 is 2-4 (po translated) ' , $ result );
274
+
275
+ $ result = __n ('%s %s and %s are good ' , '%s and %s are best ' , 1 , ['red ' , 'blue ' ]);
276
+ $ this ->assertEquals ('1 red and blue are good ' , $ result );
277
+
278
+ $ result = __n ('%s %s and %s are good ' , '%s and %s are best ' , 1 , 'red ' , 'blue ' );
279
+ $ this ->assertEquals ('1 red and blue are good ' , $ result );
271
280
}
272
281
273
282
/**
@@ -292,6 +301,9 @@ public function testBasicDomainFunction()
292
301
$ result = __d ('custom ' , 'The {0} is tasty ' , ['fruit ' ]);
293
302
$ this ->assertEquals ('The fruit is delicious ' , $ result );
294
303
304
+ $ result = __d ('custom ' , 'The {0} is tasty ' , 'fruit ' );
305
+ $ this ->assertEquals ('The fruit is delicious ' , $ result );
306
+
295
307
$ result = __d ('custom ' , 'Average price {0} ' , ['9.99 ' ]);
296
308
$ this ->assertEquals ('Price Average 9.99 ' , $ result );
297
309
}
@@ -355,6 +367,9 @@ public function testBasicContextFunction()
355
367
$ this ->assertEquals ('The letters A and B ' , __x ('character ' , 'letters ' , ['A ' , 'B ' ]));
356
368
$ this ->assertEquals ('The letter A ' , __x ('character ' , 'letter ' , ['A ' ]));
357
369
370
+ $ this ->assertEquals ('The letters A and B ' , __x ('character ' , 'letters ' , 'A ' , 'B ' ));
371
+ $ this ->assertEquals ('The letter A ' , __x ('character ' , 'letter ' , 'A ' ));
372
+
358
373
$ this ->assertEquals (
359
374
'She wrote a letter to Thomas and Sara ' ,
360
375
__x ('communication ' , 'letters ' , ['Thomas ' , 'Sara ' ])
0 commit comments