Translate/Adapter.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Translate
- Subpackage
- Zend_Translate_Adapter
- Version
- $Id$
\Zend_Translate_Adapter
- Children
- \Zend_Translate_Adapter_Xliff
- \Zend_Translate_Adapter_Array
- \Zend_Translate_Adapter_XmlTm
- \Zend_Translate_Adapter_Tmx
- \Zend_Translate_Adapter_Qt
- \Zend_Translate_Adapter_Csv
- \Zend_Translate_Adapter_Ini
- \Zend_Translate_Adapter_Tbx
- \Zend_Translate_Adapter_Gettext
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties

boolean $_automatic = truetrueDetails- Type
- boolean

\Zend_Cache_Core $_cache = nullnullDetails- Type
- \Zend_Cache_Core

boolean $_cacheTags = falsefalseDetails- Type
- boolean

array $_options = array('clear' => false, 'content' => null, 'disableNotices' => false, 'ignore' => '.', 'locale' => 'auto', 'log' => null, 'logMessage' => "Untranslated message within '%locale%': %message%", 'logPriority' => 5, 'logUntranslated' => false, 'reload' => false, 'route' => null, 'scan' => null, 'tag' => 'Zend_Translate')array('clear' => false, 'content' => null, 'disableNotices' => false, 'ignore' => '.', 'locale' => 'auto', 'log' => null, 'logMessage' => "Untranslated message within '%locale%': %message%", 'logPriority' => 5, 'logUntranslated' => false, 'reload' => false, 'route' => null, 'scan' => null, 'tag' => 'Zend_Translate')Details- Type
- array

\array() $_routed = array()array()Details- Type
- \array()
Methods

_(string $messageId, string | \Zend_Locale $locale = null) : stringTranslates the given string returns the translation
| Name | Type | Description |
|---|---|---|
| $messageId | string | Translation string |
| $locale | string | \Zend_Locale | (optional) Locale/Language to use, identical with locale |
| Type | Description |
|---|---|
| string |

__construct(array | \Zend_Config $options = array()) : voidGenerates the adapter
| Name | Type | Description |
|---|---|---|
| $options | array | \Zend_Config | Translation options for this adapter |
| Exception | Description |
|---|---|
| \Zend_Translate_Exception |

_addTranslationData( $options = array()) : \Zend_Translate_AdapterInternal function for adding translation data
| Name | Type | Description |
|---|---|---|
| $options |
| Type | Description |
|---|---|
| \Zend_Translate_Adapter | Provides fluent interface |
| Exception | Description |
|---|---|
| \Zend_Translate_Exception |

_loadTranslationData(mixed $data, string | \Zend_Locale $locale, array $options = array()) : arrayLoad translation data
| Name | Type | Description |
|---|---|---|
| $data | mixed | |
| $locale | string | \Zend_Locale | |
| $options | array | (optional) |
| Type | Description |
|---|---|
| array |

_log(string $message, String $locale) : voidLogs a message when the log option is set
| Name | Type | Description |
|---|---|---|
| $message | string | Message to log |
| $locale | String | Locale to log |

addTranslation(array | \Zend_Config $options = array()) : \Zend_Translate_AdapterAdd translations
| Name | Type | Description |
|---|---|---|
| $options | array | \Zend_Config | Options and translations to be added |
| Type | Description |
|---|---|
| \Zend_Translate_Adapter | Provides fluent interface |
| Exception | Description |
|---|---|
| \Zend_Translate_Exception |

clearCache(string $tag = null) : voidClears all set cache data
| Name | Type | Description |
|---|---|---|
| $tag | string | Tag to clear when the default tag name is not used |

getCache() : \Zend_Cache_CoreReturns the set cache
| Type | Description |
|---|---|
| \Zend_Cache_Core | The set cache |

getList() : array | nullReturns the available languages from this adapter
| Type | Description |
|---|---|
| array | null |

getLocale() : \Zend_Locale | string | nullGets locale
| Type | Description |
|---|---|
| \Zend_Locale | string | null |

getMessageId(string $message, string | \Zend_Locale $locale = null) : string | array | falseReturns the message id for a given translation If no locale is given, the actual language will be used
| Name | Type | Description |
|---|---|---|
| $message | string | Message to get the key for |
| $locale | string | \Zend_Locale | (optional) Language to return the message ids from |
| Type | Description |
|---|---|
| string | array | false |

getMessageIds(string | \Zend_Locale $locale = null) : arrayReturns all available message ids from this adapter If no locale is given, the actual language will be used
| Name | Type | Description |
|---|---|---|
| $locale | string | \Zend_Locale | (optional) Language to return the message ids from |
| Type | Description |
|---|---|
| array |

getMessages(string | \Zend_Locale $locale = null) : arrayReturns all available translations from this adapter If no locale is given, the actual language will be used If 'all' is given the complete translation dictionary will be returned
| Name | Type | Description |
|---|---|---|
| $locale | string | \Zend_Locale | (optional) Language to return the messages from |
| Type | Description |
|---|---|
| array |

getOptions(string | null $optionKey = null) : integer | string | array | nullReturns the adapters name and it's options
| Name | Type | Description |
|---|---|---|
| $optionKey | string | null | String returns this option null returns all options |
| Type | Description |
|---|---|
| integer | string | array | null |

isAvailable(string | \Zend_Locale $locale) : booleanIs the wished language available ?
| Name | Type | Description |
|---|---|---|
| $locale | string | \Zend_Locale | Language to search for, identical with locale identifier, |
| Type | Description |
|---|---|
| boolean |

isTranslated(string $messageId, boolean $original = false, string | \Zend_Locale $locale = null) : booleanChecks if a string is translated within the source or not returns boolean
| Name | Type | Description |
|---|---|---|
| $messageId | string | Translation string |
| $original | boolean | (optional) Allow translation only for original language |
| $locale | string | \Zend_Locale | (optional) Locale/Language to use, identical with locale identifier, |
| Type | Description |
|---|---|
| boolean |

plural(string $singular, string $plural, integer $number, string | \Zend_Locale $locale = null) : stringTranslates the given string using plural notations Returns the translated string
| Name | Type | Description |
|---|---|---|
| $singular | string | Singular translation string |
| $plural | string | Plural translation string |
| $number | integer | Number for detecting the correct plural |
| $locale | string | \Zend_Locale | (Optional) Locale/Language to use, identical with |
| Type | Description |
|---|---|
| string |

setCache(\Zend_Cache_Core $cache) : voidSets a cache for all Zend_Translate_Adapters
| Name | Type | Description |
|---|---|---|
| $cache | \Zend_Cache_Core | Cache to store to |

setLocale(string | \Zend_Locale $locale) : \Zend_Translate_AdapterSets locale
| Name | Type | Description |
|---|---|---|
| $locale | string | \Zend_Locale | Locale to set |
| Type | Description |
|---|---|
| \Zend_Translate_Adapter | Provides fluent interface |
| Exception | Description |
|---|---|
| \Zend_Translate_Exception |

setOptions(array $options = array()) : \Zend_Translate_AdapterSets new adapter options
| Name | Type | Description |
|---|---|---|
| $options | array | Adapter options |
| Type | Description |
|---|---|
| \Zend_Translate_Adapter | Provides fluent interface |
| Exception | Description |
|---|---|
| \Zend_Translate_Exception |

translate(string | array $messageId, string | \Zend_Locale $locale = null) : stringTranslates the given string returns the translation
| Name | Type | Description |
|---|---|---|
| $messageId | string | array | Translation string, or Array for plural translations |
| $locale | string | \Zend_Locale | (optional) Locale/Language to use, identical with |
| Type | Description |
|---|---|
| string |