1 |
cb15593b
|
Cajova-Houba
|
<?php
|
2 |
|
|
|
3 |
|
|
namespace Illuminate\Translation;
|
4 |
|
|
|
5 |
|
|
class ArrayLoader implements LoaderInterface
|
6 |
|
|
{
|
7 |
|
|
/**
|
8 |
|
|
* All of the translation messages.
|
9 |
|
|
*
|
10 |
|
|
* @var array
|
11 |
|
|
*/
|
12 |
|
|
protected $messages = [];
|
13 |
|
|
|
14 |
|
|
/**
|
15 |
|
|
* Load the messages for the given locale.
|
16 |
|
|
*
|
17 |
|
|
* @param string $locale
|
18 |
|
|
* @param string $group
|
19 |
|
|
* @param string $namespace
|
20 |
|
|
* @return array
|
21 |
|
|
*/
|
22 |
|
|
public function load($locale, $group, $namespace = null)
|
23 |
|
|
{
|
24 |
|
|
$namespace = $namespace ?: '*';
|
25 |
|
|
|
26 |
|
|
if (isset($this->messages[$namespace][$locale][$group])) {
|
27 |
|
|
return $this->messages[$namespace][$locale][$group];
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
return [];
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
/**
|
34 |
|
|
* Add a new namespace to the loader.
|
35 |
|
|
*
|
36 |
|
|
* @param string $namespace
|
37 |
|
|
* @param string $hint
|
38 |
|
|
* @return void
|
39 |
|
|
*/
|
40 |
|
|
public function addNamespace($namespace, $hint)
|
41 |
|
|
{
|
42 |
|
|
//
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
/**
|
46 |
|
|
* Add messages to the loader.
|
47 |
|
|
*
|
48 |
|
|
* @param string $locale
|
49 |
|
|
* @param string $group
|
50 |
|
|
* @param array $messages
|
51 |
|
|
* @param string|null $namespace
|
52 |
|
|
* @return $this
|
53 |
|
|
*/
|
54 |
|
|
public function addMessages($locale, $group, array $messages, $namespace = null)
|
55 |
|
|
{
|
56 |
|
|
$namespace = $namespace ?: '*';
|
57 |
|
|
|
58 |
|
|
$this->messages[$namespace][$locale][$group] = $messages;
|
59 |
|
|
|
60 |
|
|
return $this;
|
61 |
|
|
}
|
62 |
|
|
}
|