Skip to content

Commit 196e246

Browse files
authored
Merge pull request #139 from jtojnar/array-loader
Support array loader
2 parents 03890a1 + e978c3a commit 196e246

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/DI/config/loaders.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
array: Symfony\Component\Translation\Loader\ArrayLoader
12
php: Symfony\Component\Translation\Loader\PhpFileLoader
23
yml: Symfony\Component\Translation\Loader\YamlFileLoader
34
xlf: Symfony\Component\Translation\Loader\XliffFileLoader

src/Diagnostics/Panel.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ public function choiceError($e, $domain)
244244
*/
245245
public function addResource($format, $resource, $locale, $domain)
246246
{
247+
if (is_array($resource)) {
248+
$resource = 'array ' . md5(serialize($resource));
249+
}
250+
247251
$this->resources[$locale][$resource] = $domain;
248252
}
249253

@@ -260,6 +264,10 @@ public function setLocaleWhitelist($whitelist)
260264
*/
261265
public function addIgnoredResource($format, $resource, $locale, $domain)
262266
{
267+
if (is_array($resource)) {
268+
$resource = 'array ' . md5(serialize($resource));
269+
}
270+
263271
$this->ignoredResources[$locale][$resource] = $domain;
264272
}
265273

0 commit comments

Comments
 (0)