@@ 165-187 (lines=23) @@ | ||
162 | /** |
|
163 | * {@inheritdoc} |
|
164 | */ |
|
165 | public function export(MessageCatalogueInterface $catalogue) |
|
166 | { |
|
167 | $locale = $catalogue->getLocale(); |
|
168 | foreach ($this->projects as $project) { |
|
169 | foreach ($project->getDomains() as $domain) { |
|
170 | try { |
|
171 | $params = [ |
|
172 | 'format' => 'symfony', |
|
173 | 'status' => 'translated', |
|
174 | 'index' => $project->getIndexParameter(), |
|
175 | ]; |
|
176 | ||
177 | if ($project->isMultiDomain()) { |
|
178 | $params['filter'] = $domain; |
|
179 | } |
|
180 | ||
181 | $data = $this->client->export()->locale($project->getApiKey(), $locale, 'xliff', $params); |
|
182 | $catalogue->addCatalogue(XliffConverter::contentToCatalogue($data, $locale, $domain)); |
|
183 | } catch (NotFoundException $e) { |
|
184 | } |
|
185 | } |
|
186 | } |
|
187 | } |
|
188 | ||
189 | /** |
|
190 | * {@inheritdoc} |
|
@@ 192-211 (lines=20) @@ | ||
189 | /** |
|
190 | * {@inheritdoc} |
|
191 | */ |
|
192 | public function import(MessageCatalogueInterface $catalogue) |
|
193 | { |
|
194 | $locale = $catalogue->getLocale(); |
|
195 | foreach ($this->projects as $project) { |
|
196 | foreach ($project->getDomains() as $domain) { |
|
197 | $data = XliffConverter::catalogueToContent($catalogue, $domain); |
|
198 | $params = [ |
|
199 | 'locale' => $locale, |
|
200 | 'async' => 1, |
|
201 | 'index' => $project->getIndexParameter(), |
|
202 | ]; |
|
203 | ||
204 | if ($project->isMultiDomain()) { |
|
205 | $params['tag-all'] = $domain; |
|
206 | } |
|
207 | ||
208 | $this->client->import()->import($project->getApiKey(), 'xliff', $data, $params); |
|
209 | } |
|
210 | } |
|
211 | } |
|
212 | ||
213 | private function getProject($domain): LocoProject |
|
214 | { |