vendor/symfony/translation/MessageCatalogueInterface.php line 42

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Translation;
  11. use Symfony\Component\Config\Resource\ResourceInterface;
  12. /**
  13.  * MessageCatalogueInterface.
  14.  *
  15.  * @author Fabien Potencier <fabien@symfony.com>
  16.  */
  17. interface MessageCatalogueInterface
  18. {
  19.     public const INTL_DOMAIN_SUFFIX = '+intl-icu';
  20.     /**
  21.      * Gets the catalogue locale.
  22.      */
  23.     public function getLocale(): string;
  24.     /**
  25.      * Gets the domains.
  26.      */
  27.     public function getDomains(): array;
  28.     /**
  29.      * Gets the messages within a given domain.
  30.      *
  31.      * If $domain is null, it returns all messages.
  32.      *
  33.      * @param string $domain The domain name
  34.      */
  35.     public function all(string $domain = null): array;
  36.     /**
  37.      * Sets a message translation.
  38.      *
  39.      * @param string $id          The message id
  40.      * @param string $translation The messages translation
  41.      * @param string $domain      The domain name
  42.      */
  43.     public function set(string $id, string $translation, string $domain = 'messages');
  44.     /**
  45.      * Checks if a message has a translation.
  46.      *
  47.      * @param string $id     The message id
  48.      * @param string $domain The domain name
  49.      */
  50.     public function has(string $id, string $domain = 'messages'): bool;
  51.     /**
  52.      * Checks if a message has a translation (it does not take into account the fallback mechanism).
  53.      *
  54.      * @param string $id     The message id
  55.      * @param string $domain The domain name
  56.      */
  57.     public function defines(string $id, string $domain = 'messages'): bool;
  58.     /**
  59.      * Gets a message translation.
  60.      *
  61.      * @param string $id     The message id
  62.      * @param string $domain The domain name
  63.      */
  64.     public function get(string $id, string $domain = 'messages'): string;
  65.     /**
  66.      * Sets translations for a given domain.
  67.      *
  68.      * @param array  $messages An array of translations
  69.      * @param string $domain   The domain name
  70.      */
  71.     public function replace(array $messages, string $domain = 'messages');
  72.     /**
  73.      * Adds translations for a given domain.
  74.      *
  75.      * @param array  $messages An array of translations
  76.      * @param string $domain   The domain name
  77.      */
  78.     public function add(array $messages, string $domain = 'messages');
  79.     /**
  80.      * Merges translations from the given Catalogue into the current one.
  81.      *
  82.      * The two catalogues must have the same locale.
  83.      */
  84.     public function addCatalogue(self $catalogue);
  85.     /**
  86.      * Merges translations from the given Catalogue into the current one
  87.      * only when the translation does not exist.
  88.      *
  89.      * This is used to provide default translations when they do not exist for the current locale.
  90.      */
  91.     public function addFallbackCatalogue(self $catalogue);
  92.     /**
  93.      * Gets the fallback catalogue.
  94.      */
  95.     public function getFallbackCatalogue(): ?self;
  96.     /**
  97.      * Returns an array of resources loaded to build this collection.
  98.      *
  99.      * @return ResourceInterface[]
  100.      */
  101.     public function getResources(): array;
  102.     /**
  103.      * Adds a resource for this collection.
  104.      */
  105.     public function addResource(ResourceInterface $resource);
  106. }