@@ -92,6 +92,7 @@ describe('Translate tests', () => {
92
92
Vue . config . language = 'en_US'
93
93
expect ( undetectableGettext ( 'Pending' ) ) . to . equal ( 'Pending' )
94
94
95
+ expect ( undetectableGettext ( 'Pending' , 'fr_FR' ) ) . to . equal ( 'En cours' )
95
96
} )
96
97
97
98
it ( 'tests the pgettext() method' , ( ) => {
@@ -104,6 +105,7 @@ describe('Translate tests', () => {
104
105
Vue . config . language = 'en_US'
105
106
expect ( undetectablePgettext ( 'Noun' , 'Answer' ) ) . to . equal ( 'Answer (noun)' )
106
107
108
+ expect ( undetectablePgettext ( 'Noun' , 'Answer' , 'fr_FR' ) ) . to . equal ( 'Réponse (nom)' )
107
109
} )
108
110
109
111
it ( 'tests the ngettext() method' , ( ) => {
@@ -116,6 +118,8 @@ describe('Translate tests', () => {
116
118
Vue . config . language = 'en_US'
117
119
expect ( undetectableNgettext ( '%{ carCount } car' , '%{ carCount } cars' , 2 ) ) . to . equal ( '%{ carCount } cars' )
118
120
121
+ expect ( undetectableNgettext ( '%{ carCount } car' , '%{ carCount } cars' , 2 , 'fr_FR' ) ) . to . equal ( '%{ carCount } véhicules' )
122
+
119
123
// If no translation exists, display the default singular form (if n < 2).
120
124
Vue . config . language = 'fr_FR'
121
125
expect ( undetectableNgettext ( 'Untranslated %{ n } item' , 'Untranslated %{ n } items' , - 1 ) )
@@ -148,6 +152,9 @@ describe('Translate tests', () => {
148
152
expect ( undetectableNpgettext ( 'Verb' , '%{ carCount } car (verb)' , '%{ carCount } cars (verb)' , 1 ) )
149
153
. to . equal ( '%{ carCount } car (verb)' )
150
154
155
+ expect ( undetectableNpgettext ( 'Noun' , '%{ carCount } car (noun)' , '%{ carCount } cars (noun)' , 2 , 'fr_FR' ) )
156
+ . to . equal ( '%{ carCount } véhicules (nom)' )
157
+
151
158
// If no translation exists, display the default singular form (if n < 2).
152
159
Vue . config . language = 'fr_FR'
153
160
expect ( undetectableNpgettext ( 'Noun' , 'Untranslated %{ n } item (noun)' , 'Untranslated %{ n } items (noun)' , 1 ) )
@@ -265,6 +272,7 @@ describe('Translate tests without Vue', () => {
265
272
config . language = 'en_US'
266
273
expect ( undetectableGettext ( 'Pending' ) ) . to . equal ( 'Pending' )
267
274
275
+ expect ( undetectableGettext ( 'Pending' , 'fr_FR' ) ) . to . equal ( 'En cours' )
268
276
} )
269
277
270
278
it ( 'tests the pgettext() method' , ( ) => {
@@ -277,6 +285,7 @@ describe('Translate tests without Vue', () => {
277
285
config . language = 'en_US'
278
286
expect ( undetectablePgettext ( 'Noun' , 'Answer' ) ) . to . equal ( 'Answer (noun)' )
279
287
288
+ expect ( undetectablePgettext ( 'Noun' , 'Answer' , 'fr_FR' ) ) . to . equal ( 'Réponse (nom)' )
280
289
} )
281
290
282
291
it ( 'tests the ngettext() method' , ( ) => {
@@ -289,6 +298,8 @@ describe('Translate tests without Vue', () => {
289
298
config . language = 'en_US'
290
299
expect ( undetectableNgettext ( '%{ carCount } car' , '%{ carCount } cars' , 2 ) ) . to . equal ( '%{ carCount } cars' )
291
300
301
+ expect ( undetectableNgettext ( '%{ carCount } car' , '%{ carCount } cars' , 2 , 'fr_FR' ) ) . to . equal ( '%{ carCount } véhicules' )
302
+
292
303
// If no translation exists, display the default singular form (if n < 2).
293
304
config . language = 'fr_FR'
294
305
expect ( undetectableNgettext ( 'Untranslated %{ n } item' , 'Untranslated %{ n } items' , - 1 ) )
@@ -321,6 +332,9 @@ describe('Translate tests without Vue', () => {
321
332
expect ( undetectableNpgettext ( 'Verb' , '%{ carCount } car (verb)' , '%{ carCount } cars (verb)' , 1 ) )
322
333
. to . equal ( '%{ carCount } car (verb)' )
323
334
335
+ expect ( undetectableNpgettext ( 'Noun' , '%{ carCount } car (noun)' , '%{ carCount } cars (noun)' , 1 , 'fr_FR' ) )
336
+ . to . equal ( '%{ carCount } véhicule (nom)' )
337
+
324
338
// If no translation exists, display the default singular form (if n < 2).
325
339
config . language = 'fr_FR'
326
340
expect ( undetectableNpgettext ( 'Noun' , 'Untranslated %{ n } item (noun)' , 'Untranslated %{ n } items (noun)' , 1 ) )
0 commit comments