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