Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\Translation; Chris@0: Chris@0: use Symfony\Component\Config\Resource\ResourceInterface; Chris@0: Chris@0: /** Chris@0: * MessageCatalogueInterface. Chris@0: * Chris@0: * @author Fabien Potencier Chris@0: */ Chris@0: interface MessageCatalogueInterface Chris@0: { Chris@0: /** Chris@0: * Gets the catalogue locale. Chris@0: * Chris@0: * @return string The locale Chris@0: */ Chris@0: public function getLocale(); Chris@0: Chris@0: /** Chris@0: * Gets the domains. Chris@0: * Chris@0: * @return array An array of domains Chris@0: */ Chris@0: public function getDomains(); Chris@0: Chris@0: /** Chris@0: * Gets the messages within a given domain. Chris@0: * Chris@0: * If $domain is null, it returns all messages. Chris@0: * Chris@0: * @param string $domain The domain name Chris@0: * Chris@0: * @return array An array of messages Chris@0: */ Chris@0: public function all($domain = null); Chris@0: Chris@0: /** Chris@0: * Sets a message translation. Chris@0: * Chris@0: * @param string $id The message id Chris@0: * @param string $translation The messages translation Chris@0: * @param string $domain The domain name Chris@0: */ Chris@0: public function set($id, $translation, $domain = 'messages'); Chris@0: Chris@0: /** Chris@0: * Checks if a message has a translation. Chris@0: * Chris@0: * @param string $id The message id Chris@0: * @param string $domain The domain name Chris@0: * Chris@0: * @return bool true if the message has a translation, false otherwise Chris@0: */ Chris@0: public function has($id, $domain = 'messages'); Chris@0: Chris@0: /** Chris@0: * Checks if a message has a translation (it does not take into account the fallback mechanism). Chris@0: * Chris@0: * @param string $id The message id Chris@0: * @param string $domain The domain name Chris@0: * Chris@0: * @return bool true if the message has a translation, false otherwise Chris@0: */ Chris@0: public function defines($id, $domain = 'messages'); Chris@0: Chris@0: /** Chris@0: * Gets a message translation. Chris@0: * Chris@0: * @param string $id The message id Chris@0: * @param string $domain The domain name Chris@0: * Chris@0: * @return string The message translation Chris@0: */ Chris@0: public function get($id, $domain = 'messages'); Chris@0: Chris@0: /** Chris@0: * Sets translations for a given domain. Chris@0: * Chris@0: * @param array $messages An array of translations Chris@0: * @param string $domain The domain name Chris@0: */ Chris@0: public function replace($messages, $domain = 'messages'); Chris@0: Chris@0: /** Chris@0: * Adds translations for a given domain. Chris@0: * Chris@0: * @param array $messages An array of translations Chris@0: * @param string $domain The domain name Chris@0: */ Chris@0: public function add($messages, $domain = 'messages'); Chris@0: Chris@0: /** Chris@0: * Merges translations from the given Catalogue into the current one. Chris@0: * Chris@0: * The two catalogues must have the same locale. Chris@0: */ Chris@16: public function addCatalogue(self $catalogue); Chris@0: Chris@0: /** Chris@0: * Merges translations from the given Catalogue into the current one Chris@0: * only when the translation does not exist. Chris@0: * Chris@0: * This is used to provide default translations when they do not exist for the current locale. Chris@0: */ Chris@16: public function addFallbackCatalogue(self $catalogue); Chris@0: Chris@0: /** Chris@0: * Gets the fallback catalogue. Chris@0: * Chris@0: * @return self|null A MessageCatalogueInterface instance or null when no fallback has been set Chris@0: */ Chris@0: public function getFallbackCatalogue(); Chris@0: Chris@0: /** Chris@0: * Returns an array of resources loaded to build this collection. Chris@0: * Chris@0: * @return ResourceInterface[] An array of resources Chris@0: */ Chris@0: public function getResources(); Chris@0: Chris@0: /** Chris@0: * Adds a resource for this collection. Chris@0: */ Chris@0: public function addResource(ResourceInterface $resource); Chris@0: }