Abstract Class Zend_Translate_Adapter

Description

Basic adapter class for each translation source adapter

  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • abstract:
  • license: New BSD License

Located in /Translate/Adapter.php (line 42)


	
			
Direct descendents
Class Constant Summary
 LOCALE_DIRECTORY = 'directory'
 LOCALE_FILENAME = 'filename'
Variable Summary
Method Summary
 static void clearCache ()
 static boolean hasCache ()
 static void removeCache ()
 static void setCache ( $cache)
 void __construct ([array|Zend_Config $options = array()])
 Zend_Translate_Adapter addTranslation ([array|Zend_Config $options = array()])
 array getList ()
 Zend_Locale|string|null getLocale ()
 string|array|false getMessageId (string $message, [string|Zend_Locale $locale = null])
 array getMessageIds ([string|Zend_Locale $locale = null])
 array getMessages ([string|Zend_Locale $locale = null])
 integer|string|array|null getOptions ([string|null $optionKey = null])
 boolean isAvailable (string|Zend_Locale $locale)
 boolean isTranslated (string $messageId, [boolean $original = false], [string|Zend_Locale $locale = null])
 string plural (string $singular, string $plural, integer $number, [string|Zend_Locale $locale = null])
 Zend_Translate_Adapter setOptions ([ $options = array()])
 string toString ()
 string translate (string|array $messageId, [string|Zend_Locale $locale = null])
 string _ (string $messageId, [string|Zend_Locale $locale = null])
 array _loadTranslationData (mixed $data, string|Zend_Locale $locale, [ $options = array()])
 void _log (string $message, String $locale)
Variables
static Zend_Cache_Core $_cache = null (line 59)

Internal cache for all adapters

  • access: protected
array $_options = array(
'clear' => false,
'content' => null,
'disableNotices' => false,
'ignore' => '.',
'locale' => 'auto',
'log' => null,
'logMessage' => "Untranslated message within '%locale%': %message%",
'logUntranslated' => false,
'reload' => false,
'route' => null,
'scan' => null
)
(line 88)

Array with all options, each adapter can have own additional options

'clear' => when true, clears already loaded translations when adding new files 'content' => content to translate or file or directory with content 'disableNotices' => when true, omits notices from being displayed 'ignore' => a prefix for files and directories which are not being added 'locale' => the actual set locale to use 'log' => a instance of Zend_Log where logs are written to 'logMessage' => message to be logged 'logUntranslated' => when true, untranslated messages are not logged 'reload' => reloads the cache by reading the content again 'scan' => searches for translation files using the LOCALE constants

  • access: protected
array $_translate = array() (line 106)

Translation table

  • access: protected
Methods
static clearCache (line 919)

Clears all set cache data

  • access: public
static void clearCache ()
static getCache (line 875)

Returns the set cache

  • return: The set cache
  • access: public
static Zend_Cache_Core getCache ()
static hasCache (line 895)

Returns true when a cache is set

  • access: public
static boolean hasCache ()
static removeCache (line 909)

Removes any set cache

  • access: public
static void removeCache ()
static setCache (line 885)

Sets a cache for all Zend_Translate_Adapters

  • access: public
static void setCache ( $cache)
Constructor __construct (line 115)

Generates the adapter

  • throws: Zend_Translate_Exception
  • access: public
void __construct ([array|Zend_Config $options = array()])
  • array|Zend_Config $options: Translation options for this adapter

Redefined in descendants as:
addTranslation (line 184)

Add translations

This may be a new language or additional content for an existing language If the key 'clear' is true, then translations for the specified language will be replaced and added otherwise

  • return: Provides fluent interface
  • throws: Zend_Translate_Exception
  • access: public
Zend_Translate_Adapter addTranslation ([array|Zend_Config $options = array()])
  • array|Zend_Config $options: Options and translations to be added
getList (line 450)

Returns the available languages from this adapter

  • access: public
array getList ()
getLocale (line 381)

Gets locale

  • access: public
Zend_Locale|string|null getLocale ()
getMessageId (line 470)

Returns the message id for a given translation If no locale is given, the actual language will be used

  • access: public
string|array|false getMessageId (string $message, [string|Zend_Locale $locale = null])
  • string $message: Message to get the key for
  • string|Zend_Locale $locale: (optional) Language to return the message ids from
getMessageIds (line 486)

Returns all available message ids from this adapter If no locale is given, the actual language will be used

  • access: public
array getMessageIds ([string|Zend_Locale $locale = null])
  • string|Zend_Locale $locale: (optional) Language to return the message ids from
getMessages (line 503)

Returns 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

  • access: public
array getMessages ([string|Zend_Locale $locale = null])
  • string|Zend_Locale $locale: (optional) Language to return the messages from
getOptions (line 363)

Returns the adapters name and it's options

  • access: public
integer|string|array|null getOptions ([string|null $optionKey = null])
  • string|null $optionKey: String returns this option null returns all options
isAvailable (line 524)

Is the wished language available ?

  • see: Zend_Locale
  • see: Zend_Locale for more information
  • access: public
boolean isAvailable (string|Zend_Locale $locale)
  • string|Zend_Locale $locale: Language to search for, identical with locale identifier,
isTranslated (line 832)

Checks if a string is translated within the source or not returns boolean

  • access: public
boolean isTranslated (string $messageId, [boolean $original = false], [string|Zend_Locale $locale = null])
  • string $messageId: Translation string
  • boolean $original: (optional) Allow translation only for original language when true, a translation for 'en_US' would give false when it can be translated with 'en' only
  • string|Zend_Locale $locale: (optional) Locale/Language to use, identical with locale identifier, see Zend_Locale for more information
plural (line 783)

Translates the given string using plural notations Returns the translated string

string plural (string $singular, string $plural, integer $number, [string|Zend_Locale $locale = null])
  • string $singular: Singular translation string
  • string $plural: Plural translation string
  • integer $number: Number for detecting the correct plural
  • string|Zend_Locale $locale: (Optional) Locale/Language to use, identical with locale identifier, @see Zend_Locale for more information
setLocale (line 393)

Sets locale

  • return: Provides fluent interface
  • throws: Zend_Translate_Exception
  • access: public
Zend_Translate_Adapter setLocale (string|Zend_Locale $locale)
setOptions (line 320)

Sets new adapter options

  • return: Provides fluent interface
  • throws: Zend_Translate_Exception
  • access: public
Zend_Translate_Adapter setOptions ([ $options = array()])
  • array $options: Adapter options
toString (line 930)

Returns the adapter name

  • abstract:
  • access: public
string toString ()

Redefined in descendants as:
translate (line 663)

Translates the given string returns the translation

string translate (string|array $messageId, [string|Zend_Locale $locale = null])
  • string|array $messageId: Translation string, or Array for plural translations
  • string|Zend_Locale $locale: (optional) Locale/Language to use, identical with locale identifier, @see Zend_Locale for more information
_ (line 815)

Translates the given string returns the translation

  • access: public
string _ (string $messageId, [string|Zend_Locale $locale = null])
  • string $messageId: Translation string
  • string|Zend_Locale $locale: (optional) Locale/Language to use, identical with locale identifier, @see Zend_Locale for more information
_loadTranslationData (line 538)

Load translation data

  • abstract:
  • access: protected
array _loadTranslationData (mixed $data, string|Zend_Locale $locale, [ $options = array()])
  • mixed $data
  • string|Zend_Locale $locale
  • array $options: (optional)

Redefined in descendants as:
_log (line 794)

Logs a message when the log option is set

  • access: protected
void _log (string $message, String $locale)
  • string $message: Message to log
  • String $locale: Locale to log
Class Constants
LOCALE_DIRECTORY = 'directory' (line 65)

Scans for the locale within the name of the directory

LOCALE_FILENAME = 'filename' (line 71)

Scans for the locale within the name of the file

Documentation generated on Mon, 21 Jun 2010 15:06:38 -0400 by phpDocumentor 1.4.3