translateManager provides the main interface into the translation system. It is modelled after the Zend Framework package Zend_Translate but with modifications and simplifications for Scorpio. In theory, existing ZF translation data should work with Scorpio without modification.
Example:
$oManager = translateManager::getInstance(translateManager::ADAPTOR_CSV, '/path/to/lang.csv', 'en_GB', array());
$oManager->translate('string');
//or
$oManager->__('string');
Portions are: @ copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) @ version $Id: Date.php 2498 2006-12-23 22:13:38Z thomas $ @ license http://framework.zend.com/license/new-bsd New BSD License
public __construct($inAdaptor, $inData, [$inLocale = null], [$inOptions = array()])
Generates the standard translation object
$array = array( 'clear' => clears already loaded data when adding new files 'scan' => searches for translation files using the SEARCH_LOCALE constants 'locale' => the actual set locale to use 'ignore' => ignore files with 'disableNotices' => disable trigger notices if no translation found );
public static getInstance([$inAdaptor = null], [$inData = null], [$inLocale = null], [$inOptions = array()])
Returns a single instance of the translate manager
$array = array( 'clear' => clears already loaded data when adding new files 'scan' => searches for translation files using the SEARCH_LOCALE constants 'locale' => the actual set locale to use 'ignore' => ignore files with 'disableNotices' => disable trigger notices if no translation found );
public static isValidAdaptor($inAdaptor)
Returns true if $inAdaptor is a valid adaptor
public static addAdaptor($inAdaptor)
Add a new adaptor implementation to list of allowed adaptors
public static removeAdaptor($inAdaptor)
Remove an adaptor from list of allowed adaptors
public static getCache()
Returns the set cache
public static setCache($inCache)
Sets a cache for all instances of translateManager
public static hasCache()
Returns true when a cache is set
public static removeCache()
Removes any set cache
public static clearCache()
Clears all set cache data
public getAdaptor()
Returns the current translation adaptor
public setAdapter($inAdaptor, $inData, [$inLocale = null], [$inOptions = array()])
Sets a new translation adaptor
public __call($method, $options)
Sets a new translation adaptor
Tags: translate, translatemanager,
translate Articles