@@ -561,7 +561,6 @@ public function testReadForOneLocaleAndOneDomain(string $locale, string $domain,
561
561
$ expectedBody = json_encode ([
562
562
'format ' => 'symfony_xliff ' ,
563
563
'original_filenames ' => true ,
564
- 'directory_prefix ' => '%LANG_ISO% ' ,
565
564
'filter_langs ' => [$ locale ],
566
565
'filter_filenames ' => [$ domain .'.xliff ' ],
567
566
'export_empty_as ' => 'skip ' ,
@@ -583,15 +582,10 @@ public function testReadForOneLocaleAndOneDomain(string $locale, string $domain,
583
582
]);
584
583
};
585
584
586
- $ loader = $ this ->getLoader ();
587
- $ loader ->expects ($ this ->once ())
588
- ->method ('load ' )
589
- ->willReturn ((new XliffFileLoader ())->load ($ responseContent , $ locale , $ domain ));
590
-
591
585
$ provider = self ::createProvider ((new MockHttpClient ($ response ))->withOptions ([
592
586
'base_uri ' => 'https://api.lokalise.com/api2/projects/PROJECT_ID/ ' ,
593
587
'headers ' => ['X-Api-Token ' => 'API_KEY ' ],
594
- ]), $ loader , $ this ->getLogger (), $ this ->getDefaultLocale (), 'api.lokalise.com ' );
588
+ ]), new XliffFileLoader () , $ this ->getLogger (), $ this ->getDefaultLocale (), 'api.lokalise.com ' );
595
589
$ translatorBag = $ provider ->read ([$ domain ], [$ locale ]);
596
590
597
591
// We don't want to assert equality of metadata here, due to the ArrayLoader usage.
@@ -763,6 +757,36 @@ public static function getResponsesForOneLocaleAndOneDomain(): \Generator
763
757
$ expectedTranslatorBagEn ,
764
758
];
765
759
760
+ $ expectedTranslatorBagEnUS = new TranslatorBag ();
761
+ $ expectedTranslatorBagEnUS ->addCatalogue ($ arrayLoader ->load ([
762
+ 'index.hello ' => 'Hello ' ,
763
+ 'index.greetings ' => 'Welcome, {firstname}! ' ,
764
+ ], 'en_US ' ));
765
+
766
+ yield ['en_US ' , 'messages ' , <<<'XLIFF'
767
+ <?xml version="1.0" encoding="UTF-8"?>
768
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 http://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd">
769
+ <file original="" datatype="plaintext" xml:space="preserve" source-language="en" target-language="en-US">
770
+ <header>
771
+ <tool tool-id="lokalise.com" tool-name="Lokalise"/>
772
+ </header>
773
+ <body>
774
+ <trans-unit id="index.greetings" resname="index.greetings">
775
+ <source>index.greetings</source>
776
+ <target>Welcome, {firstname}!</target>
777
+ </trans-unit>
778
+ <trans-unit id="index.hello" resname="index.hello">
779
+ <source>index.hello</source>
780
+ <target>Hello</target>
781
+ </trans-unit>
782
+ </body>
783
+ </file>
784
+ </xliff>
785
+ XLIFF
786
+ ,
787
+ $ expectedTranslatorBagEnUS ,
788
+ ];
789
+
766
790
$ expectedTranslatorBagFr = new TranslatorBag ();
767
791
$ expectedTranslatorBagFr ->addCatalogue ($ arrayLoader ->load ([
768
792
'index.hello ' => 'Bonjour ' ,
0 commit comments