comparison vendor/symfony/translation/MessageCatalogueInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 1fec387a4317
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
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 interface MessageCatalogueInterface
22 {
23 /**
24 * Gets the catalogue locale.
25 *
26 * @return string The locale
27 */
28 public function getLocale();
29
30 /**
31 * Gets the domains.
32 *
33 * @return array An array of domains
34 */
35 public function getDomains();
36
37 /**
38 * Gets the messages within a given domain.
39 *
40 * If $domain is null, it returns all messages.
41 *
42 * @param string $domain The domain name
43 *
44 * @return array An array of messages
45 */
46 public function all($domain = null);
47
48 /**
49 * Sets a message translation.
50 *
51 * @param string $id The message id
52 * @param string $translation The messages translation
53 * @param string $domain The domain name
54 */
55 public function set($id, $translation, $domain = 'messages');
56
57 /**
58 * Checks if a message has a translation.
59 *
60 * @param string $id The message id
61 * @param string $domain The domain name
62 *
63 * @return bool true if the message has a translation, false otherwise
64 */
65 public function has($id, $domain = 'messages');
66
67 /**
68 * Checks if a message has a translation (it does not take into account the fallback mechanism).
69 *
70 * @param string $id The message id
71 * @param string $domain The domain name
72 *
73 * @return bool true if the message has a translation, false otherwise
74 */
75 public function defines($id, $domain = 'messages');
76
77 /**
78 * Gets a message translation.
79 *
80 * @param string $id The message id
81 * @param string $domain The domain name
82 *
83 * @return string The message translation
84 */
85 public function get($id, $domain = 'messages');
86
87 /**
88 * Sets translations for a given domain.
89 *
90 * @param array $messages An array of translations
91 * @param string $domain The domain name
92 */
93 public function replace($messages, $domain = 'messages');
94
95 /**
96 * Adds translations for a given domain.
97 *
98 * @param array $messages An array of translations
99 * @param string $domain The domain name
100 */
101 public function add($messages, $domain = 'messages');
102
103 /**
104 * Merges translations from the given Catalogue into the current one.
105 *
106 * The two catalogues must have the same locale.
107 *
108 * @param self $catalogue
109 */
110 public function addCatalogue(MessageCatalogueInterface $catalogue);
111
112 /**
113 * Merges translations from the given Catalogue into the current one
114 * only when the translation does not exist.
115 *
116 * This is used to provide default translations when they do not exist for the current locale.
117 *
118 * @param self $catalogue
119 */
120 public function addFallbackCatalogue(MessageCatalogueInterface $catalogue);
121
122 /**
123 * Gets the fallback catalogue.
124 *
125 * @return self|null A MessageCatalogueInterface instance or null when no fallback has been set
126 */
127 public function getFallbackCatalogue();
128
129 /**
130 * Returns an array of resources loaded to build this collection.
131 *
132 * @return ResourceInterface[] An array of resources
133 */
134 public function getResources();
135
136 /**
137 * Adds a resource for this collection.
138 *
139 * @param ResourceInterface $resource A resource instance
140 */
141 public function addResource(ResourceInterface $resource);
142 }