comparison vendor/symfony/translation/MessageCatalogueInterface.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c75dbcec494b
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 public function addCatalogue(self $catalogue);
109
110 /**
111 * Merges translations from the given Catalogue into the current one
112 * only when the translation does not exist.
113 *
114 * This is used to provide default translations when they do not exist for the current locale.
115 */
116 public function addFallbackCatalogue(self $catalogue);
117
118 /**
119 * Gets the fallback catalogue.
120 *
121 * @return self|null A MessageCatalogueInterface instance or null when no fallback has been set
122 */
123 public function getFallbackCatalogue();
124
125 /**
126 * Returns an array of resources loaded to build this collection.
127 *
128 * @return ResourceInterface[] An array of resources
129 */
130 public function getResources();
131
132 /**
133 * Adds a resource for this collection.
134 */
135 public function addResource(ResourceInterface $resource);
136 }