Abstract Class Zend_Translate_Adapter

Description

Basic adapter class for each translation source adapter

  • copyright: Copyright (c) 2005-2009 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 (string|array $data, [string|Zend_Locale $locale = null], [ $options = array()])
 Zend_Translate_Adapter addTranslation (array|string $data, [string|Zend_Locale $locale = null], [ $options = array()])
 array getList ()
 Zend_Locale|string|null getLocale ()
 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 53)

Internal cache for all adapters

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

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

'clear' => clears already loaded data when adding new files 'scan' => searches for translation files using the LOCALE constants 'locale' => the actual set locale to use

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

Translation table

  • access: protected
Methods
static clearCache (line 749)

Clears all set cache data

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

Returns the set cache

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

Returns true when a cache is set

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

Removes any set cache

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

Sets a cache for all Zend_Translate_Adapters

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

Generates the adapter

  • throws: Zend_Translate_Exception
  • access: public
void __construct (string|array $data, [string|Zend_Locale $locale = null], [ $options = array()])
  • string|array $data: Translation data or filename for this adapter
  • string|Zend_Locale $locale: (optional) Locale/Language to set, identical with Locale identifiers see Zend_Locale for more information
  • array $options: (optional) Options for the adaptor

Redefined in descendants as:
addTranslation (line 137)

Add translation data

It may be a new language or additional data for existing language If $clear parameter is true, then translation data for specified language is replaced and added otherwise

  • return: Provides fluent interface
  • throws: Zend_Translate_Exception
  • access: public
Zend_Translate_Adapter addTranslation (array|string $data, [string|Zend_Locale $locale = null], [ $options = array()])
  • array|string $data: Translation data
  • string|Zend_Locale $locale: (optional) Locale/Language to add data for, identical with locale identifier, see Zend_Locale for more information
  • array $options: (optional) Option for this Adapter
getList (line 357)

Returns the available languages from this adapter

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

Gets locale

  • access: public
Zend_Locale|string|null getLocale ()
getMessageIds (line 376)

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 393)

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 270)

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 414)

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 660)

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 611)

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 300)

Sets locale

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

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 760)

Returns the adapter name

  • abstract:
  • access: public
string toString ()

Redefined in descendants as:
translate (line 515)

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 643)

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 428)

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 622)

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 59)

Scans for the locale within the name of the directory

LOCALE_FILENAME = 'filename' (line 65)

Scans for the locale within the name of the file

Documentation generated on Thu, 01 Apr 2010 12:54:51 -0400 by phpDocumentor 1.4.3