diff options
Diffstat (limited to 'vendor/symfony/translation/Symfony/Component/Translation/MessageCatalogueInterface.php')
-rw-r--r-- | vendor/symfony/translation/Symfony/Component/Translation/MessageCatalogueInterface.php | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/MessageCatalogueInterface.php b/vendor/symfony/translation/Symfony/Component/Translation/MessageCatalogueInterface.php new file mode 100644 index 00000000..5e9be20c --- /dev/null +++ b/vendor/symfony/translation/Symfony/Component/Translation/MessageCatalogueInterface.php | |||
@@ -0,0 +1,172 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Translation; | ||
13 | |||
14 | use Symfony\Component\Config\Resource\ResourceInterface; | ||
15 | |||
16 | /** | ||
17 | * MessageCatalogueInterface. | ||
18 | * | ||
19 | * @author Fabien Potencier <fabien@symfony.com> | ||
20 | * | ||
21 | * @api | ||
22 | */ | ||
23 | interface MessageCatalogueInterface | ||
24 | { | ||
25 | /** | ||
26 | * Gets the catalogue locale. | ||
27 | * | ||
28 | * @return string The locale | ||
29 | * | ||
30 | * @api | ||
31 | */ | ||
32 | public function getLocale(); | ||
33 | |||
34 | /** | ||
35 | * Gets the domains. | ||
36 | * | ||
37 | * @return array An array of domains | ||
38 | * | ||
39 | * @api | ||
40 | */ | ||
41 | public function getDomains(); | ||
42 | |||
43 | /** | ||
44 | * Gets the messages within a given domain. | ||
45 | * | ||
46 | * If $domain is null, it returns all messages. | ||
47 | * | ||
48 | * @param string $domain The domain name | ||
49 | * | ||
50 | * @return array An array of messages | ||
51 | * | ||
52 | * @api | ||
53 | */ | ||
54 | public function all($domain = null); | ||
55 | |||
56 | /** | ||
57 | * Sets a message translation. | ||
58 | * | ||
59 | * @param string $id The message id | ||
60 | * @param string $translation The messages translation | ||
61 | * @param string $domain The domain name | ||
62 | * | ||
63 | * @api | ||
64 | */ | ||
65 | public function set($id, $translation, $domain = 'messages'); | ||
66 | |||
67 | /** | ||
68 | * Checks if a message has a translation. | ||
69 | * | ||
70 | * @param string $id The message id | ||
71 | * @param string $domain The domain name | ||
72 | * | ||
73 | * @return Boolean true if the message has a translation, false otherwise | ||
74 | * | ||
75 | * @api | ||
76 | */ | ||
77 | public function has($id, $domain = 'messages'); | ||
78 | |||
79 | /** | ||
80 | * Checks if a message has a translation (it does not take into account the fallback mechanism). | ||
81 | * | ||
82 | * @param string $id The message id | ||
83 | * @param string $domain The domain name | ||
84 | * | ||
85 | * @return Boolean true if the message has a translation, false otherwise | ||
86 | * | ||
87 | * @api | ||
88 | */ | ||
89 | public function defines($id, $domain = 'messages'); | ||
90 | |||
91 | /** | ||
92 | * Gets a message translation. | ||
93 | * | ||
94 | * @param string $id The message id | ||
95 | * @param string $domain The domain name | ||
96 | * | ||
97 | * @return string The message translation | ||
98 | * | ||
99 | * @api | ||
100 | */ | ||
101 | public function get($id, $domain = 'messages'); | ||
102 | |||
103 | /** | ||
104 | * Sets translations for a given domain. | ||
105 | * | ||
106 | * @param array $messages An array of translations | ||
107 | * @param string $domain The domain name | ||
108 | * | ||
109 | * @api | ||
110 | */ | ||
111 | public function replace($messages, $domain = 'messages'); | ||
112 | |||
113 | /** | ||
114 | * Adds translations for a given domain. | ||
115 | * | ||
116 | * @param array $messages An array of translations | ||
117 | * @param string $domain The domain name | ||
118 | * | ||
119 | * @api | ||
120 | */ | ||
121 | public function add($messages, $domain = 'messages'); | ||
122 | |||
123 | /** | ||
124 | * Merges translations from the given Catalogue into the current one. | ||
125 | * | ||
126 | * The two catalogues must have the same locale. | ||
127 | * | ||
128 | * @param MessageCatalogueInterface $catalogue A MessageCatalogueInterface instance | ||
129 | * | ||
130 | * @api | ||
131 | */ | ||
132 | public function addCatalogue(MessageCatalogueInterface $catalogue); | ||
133 | |||
134 | /** | ||
135 | * Merges translations from the given Catalogue into the current one | ||
136 | * only when the translation does not exist. | ||
137 | * | ||
138 | * This is used to provide default translations when they do not exist for the current locale. | ||
139 | * | ||
140 | * @param MessageCatalogueInterface $catalogue A MessageCatalogueInterface instance | ||
141 | * | ||
142 | * @api | ||
143 | */ | ||
144 | public function addFallbackCatalogue(MessageCatalogueInterface $catalogue); | ||
145 | |||
146 | /** | ||
147 | * Gets the fallback catalogue. | ||
148 | * | ||
149 | * @return MessageCatalogueInterface|null A MessageCatalogueInterface instance or null when no fallback has been set | ||
150 | * | ||
151 | * @api | ||
152 | */ | ||
153 | public function getFallbackCatalogue(); | ||
154 | |||
155 | /** | ||
156 | * Returns an array of resources loaded to build this collection. | ||
157 | * | ||
158 | * @return ResourceInterface[] An array of resources | ||
159 | * | ||
160 | * @api | ||
161 | */ | ||
162 | public function getResources(); | ||
163 | |||
164 | /** | ||
165 | * Adds a resource for this collection. | ||
166 | * | ||
167 | * @param ResourceInterface $resource A resource instance | ||
168 | * | ||
169 | * @api | ||
170 | */ | ||
171 | public function addResource(ResourceInterface $resource); | ||
172 | } | ||