Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
Adapter Class Reference
Inheritance diagram for Adapter:
AbstractAdapter Zend_Translate_Adapter AdapterInterface

Public Member Functions

 translate ($messageId, $locale=null)
 
 __ ()
 
- Public Member Functions inherited from AbstractAdapter
 isTranslated ($messageId, $original=false, $locale=null)
 
 setLocale ($locale)
 
 toString ()
 
- Public Member Functions inherited from Zend_Translate_Adapter
 __construct ($options=array())
 
 addTranslation ($options=array())
 
 setOptions (array $options=array())
 
 getOptions ($optionKey=null)
 
 getLocale ()
 
 setLocale ($locale)
 
 getList ()
 
 getMessageId ($message, $locale=null)
 
 getMessageIds ($locale=null)
 
 getMessages ($locale=null)
 
 isAvailable ($locale)
 
 translate ($messageId, $locale=null)
 
 plural ($singular, $plural, $number, $locale=null)
 
 _ ($messageId, $locale=null)
 
 isTranslated ($messageId, $original=false, $locale=null)
 
 toString ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Zend_Translate_Adapter
static getCache ()
 
static setCache (Zend_Cache_Core $cache)
 
static hasCache ()
 
static removeCache ()
 
static clearCache ($tag=null)
 
- Data Fields inherited from Zend_Translate_Adapter
const LOCALE_DIRECTORY = 'directory'
 
const LOCALE_FILENAME = 'filename'
 
- Protected Member Functions inherited from AbstractAdapter
 _loadTranslationData ($data, $locale, array $options=[])
 
- Protected Member Functions inherited from Zend_Translate_Adapter
 _loadTranslationData ($data, $locale, array $options=array())
 
 _log ($message, $locale)
 
- Protected Attributes inherited from Zend_Translate_Adapter
 $_options
 
 $_translate = array()
 
- Static Protected Attributes inherited from Zend_Translate_Adapter
static $_cache = null
 

Detailed Description

Definition at line 12 of file Adapter.php.

Member Function Documentation

◆ __()

__ ( )

Translate message string.

@SuppressWarnings(PHPMD.ShortMethodName)

Returns
string

Implements AdapterInterface.

Definition at line 39 of file Adapter.php.

40  {
41  $args = func_get_args();
42  $messageId = array_shift($args);
43  $string = $this->translate($messageId);
44  if (count($args) > 0) {
45  $string = vsprintf($string, $args);
46  }
47  return $string;
48  }
translate($messageId, $locale=null)
Definition: Adapter.php:22

◆ translate()

translate (   $messageId,
  $locale = null 
)

Translate message string.

@SuppressWarnings(PHPMD.UnusedFormalParameter)

Parameters
array | string$messageId
null | string$locale
Returns
string

Implements AdapterInterface.

Definition at line 22 of file Adapter.php.

23  {
24  $translator = $this->getOptions('translator');
25  if (is_callable($translator)) {
26  return call_user_func($translator, $messageId);
27  } else {
28  return $messageId;
29  }
30  }
getOptions($optionKey=null)
Definition: Adapter.php:393

The documentation for this class was generated from the following file: