Debian Codegraph @

lib/3rdParty/composer/symfony/translation/MessageCatalogueInterface.php

raw symbols SCIP
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
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 <[email protected]>
20 */
21 interface MessageCatalogueInterface
22 {
23 public const INTL_DOMAIN_SUFFIX = '+intl-icu';
24
25 /**
26 * Gets the catalogue locale.
27 */
28 public function getLocale(): string;
29
30 /**
31 * Gets the domains.
32 */
33 public function getDomains(): array;
34
35 /**
36 * Gets the messages within a given domain.
37 *
38 * If $domain is null, it returns all messages.
39 */
40 public function all(?string $domain = null): array;
41
42 /**
43 * Sets a message translation.
44 *
45 * @param string $id The message id
46 * @param string $translation The messages translation
47 * @param string $domain The domain name
48 */
49 public function set(string $id, string $translation, string $domain = 'messages'): void;
50
51 /**
52 * Checks if a message has a translation.
53 *
54 * @param string $id The message id
55 * @param string $domain The domain name
56 */
57 public function has(string $id, string $domain = 'messages'): bool;
58
59 /**
60 * Checks if a message has a translation (it does not take into account the fallback mechanism).
61 *
62 * @param string $id The message id
63 * @param string $domain The domain name
64 */
65 public function defines(string $id, string $domain = 'messages'): bool;
66
67 /**
68 * Gets a message translation.
69 *
70 * @param string $id The message id
71 * @param string $domain The domain name
72 */
73 public function get(string $id, string $domain = 'messages'): string;
74
75 /**
76 * Sets translations for a given domain.
77 *
78 * @param array $messages An array of translations
79 * @param string $domain The domain name
80 */
81 public function replace(array $messages, string $domain = 'messages'): void;
82
83 /**
84 * Adds translations for a given domain.
85 *
86 * @param array $messages An array of translations
87 * @param string $domain The domain name
88 */
89 public function add(array $messages, string $domain = 'messages'): void;
90
91 /**
92 * Merges translations from the given Catalogue into the current one.
93 *
94 * The two catalogues must have the same locale.
95 */
96 public function addCatalogue(self $catalogue): void;
97
98 /**
99 * Merges translations from the given Catalogue into the current one
100 * only when the translation does not exist.
101 *
102 * This is used to provide default translations when they do not exist for the current locale.
103 */
104 public function addFallbackCatalogue(self $catalogue): void;
105
106 /**
107 * Gets the fallback catalogue.
108 */
109 public function getFallbackCatalogue(): ?self;
110
111 /**
112 * Returns an array of resources loaded to build this collection.
113 *
114 * @return ResourceInterface[]
115 */
116 public function getResources(): array;
117
118 /**
119 * Adds a resource for this collection.
120 */
121 public function addResource(ResourceInterface $resource): void;
122 }