<?php
/**
 * @package		OpenCart
 * @author		Daniel Kerr
 * @copyright	Copyright (c) 2005 - 2017, OpenCart, Ltd. (https://www.opencart.com/)
 * @license		https://opensource.org/licenses/GPL-3.0
 * @link		https://www.opencart.com
 */

/**
 * @author：dc
 * @time 2022/4/12 15:28
 * Class Cache
 * @property Translater\Google $adaptor
 */
class Translater {
    private $adaptor;

    /**
     * Constructor
     *
     * @param	string	$adaptor	The type of storage for the cache.
     * @param	int		$expire		Optional parameters
     *
     */
    public function __construct($adaptor, $url) {
        $class = 'Translater\\' . $adaptor;

        if (class_exists($class)) {
            $this->adaptor = new $class($url);
        } else {
            throw new \Exception('Error: Could not load translater adaptor !');
        }
    }

    /**
     * Gets a key trans.
     *
     * @param	string $key	The key name
     *
     * @return	string
     */
    public function get($key,$from='en',$to) {
        return $this->adaptor->get($key,$from,$to);
    }

}
