vendor/symfony/translation/MessageCatalogueInterface.php line 48

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.      * @return string
  24.      */
  25.     public function getLocale();
  26.     /**
  27.      * Gets the domains.
  28.      *
  29.      * @return array
  30.      */
  31.     public function getDomains();
  32.     /**
  33.      * Gets the messages within a given domain.
  34.      *
  35.      * If $domain is null, it returns all messages.
  36.      *
  37.      * @param string $domain The domain name
  38.      *
  39.      * @return array
  40.      */
  41.     public function all(string $domain null);
  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 $idstring $translationstring $domain 'messages');
  50.     /**
  51.      * Checks if a message has a translation.
  52.      *
  53.      * @param string $id     The message id
  54.      * @param string $domain The domain name
  55.      *
  56.      * @return bool
  57.      */
  58.     public function has(string $idstring $domain 'messages');
  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.      * @return bool
  66.      */
  67.     public function defines(string $idstring $domain 'messages');
  68.     /**
  69.      * Gets a message translation.
  70.      *
  71.      * @param string $id     The message id
  72.      * @param string $domain The domain name
  73.      *
  74.      * @return string
  75.      */
  76.     public function get(string $idstring $domain 'messages');
  77.     /**
  78.      * Sets translations for a given domain.
  79.      *
  80.      * @param array  $messages An array of translations
  81.      * @param string $domain   The domain name
  82.      */
  83.     public function replace(array $messagesstring $domain 'messages');
  84.     /**
  85.      * Adds translations for a given domain.
  86.      *
  87.      * @param array  $messages An array of translations
  88.      * @param string $domain   The domain name
  89.      */
  90.     public function add(array $messagesstring $domain 'messages');
  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);
  97.     /**
  98.      * Merges translations from the given Catalogue into the current one
  99.      * only when the translation does not exist.
  100.      *
  101.      * This is used to provide default translations when they do not exist for the current locale.
  102.      */
  103.     public function addFallbackCatalogue(self $catalogue);
  104.     /**
  105.      * Gets the fallback catalogue.
  106.      *
  107.      * @return self|null
  108.      */
  109.     public function getFallbackCatalogue();
  110.     /**
  111.      * Returns an array of resources loaded to build this collection.
  112.      *
  113.      * @return ResourceInterface[]
  114.      */
  115.     public function getResources();
  116.     /**
  117.      * Adds a resource for this collection.
  118.      */
  119.     public function addResource(ResourceInterface $resource);
  120. }