tinyib/inc/gettext/src/TranslatorInterface.php
2020-08-31 20:52:57 -07:00

113 lines
2.5 KiB
PHP

<?php
namespace Gettext;
/**
* Interface used by all translators.
*/
interface TranslatorInterface
{
/**
* Register this translator as global, to use with the gettext functions __(), p__(), etc.
* Returns the previous translator if exists.
*
* @return TranslatorInterface|null
*/
public function register();
/**
* Noop, marks the string for translation but returns it unchanged.
*
* @param string $original
*
* @return string
*/
public function noop($original);
/**
* Gets a translation using the original string.
*
* @param string $original
*
* @return string
*/
public function gettext($original);
/**
* Gets a translation checking the plural form.
*
* @param string $original
* @param string $plural
* @param string $value
*
* @return string
*/
public function ngettext($original, $plural, $value);
/**
* Gets a translation checking the domain and the plural form.
*
* @param string $domain
* @param string $original
* @param string $plural
* @param string $value
*
* @return string
*/
public function dngettext($domain, $original, $plural, $value);
/**
* Gets a translation checking the context and the plural form.
*
* @param string $context
* @param string $original
* @param string $plural
* @param string $value
*
* @return string
*/
public function npgettext($context, $original, $plural, $value);
/**
* Gets a translation checking the context.
*
* @param string $context
* @param string $original
*
* @return string
*/
public function pgettext($context, $original);
/**
* Gets a translation checking the domain.
*
* @param string $domain
* @param string $original
*
* @return string
*/
public function dgettext($domain, $original);
/**
* Gets a translation checking the domain and context.
*
* @param string $domain
* @param string $context
* @param string $original
*
* @return string
*/
public function dpgettext($domain, $context, $original);
/**
* Gets a translation checking the domain, the context and the plural form.
*
* @param string $domain
* @param string $context
* @param string $original
* @param string $plural
* @param string $value
*/
public function dnpgettext($domain, $context, $original, $plural, $value);
}