gowsram / g-translate
ZF2 Google Translate module
dev-master
2013-05-22 11:01 UTC
Requires
- php: >=5.3.3
- zendframework/zendframework: 2.*
This package is not auto-updated.
Last update: 2025-01-04 15:55:28 UTC
README
Google Translate - ZF2 Module
A Zend Framework 2 Module for Google Translate
Installation
Main Setup
By cloning project
-
This module is available on Packagist. In your project's
composer.json
use:{ "require": { "php": ">=5.3.3", "zendframework/zendframework": "*", "gowsram/g-translate": "dev-master" }
-
Or clone this project into your
./vendor/
directory.
Post installation
-
Enabling this module in your
application.config.php
file.return array( 'modules' => array( // ... 'GTranslate', // ... ), // ... );
Usage
-
In the controller
$gtranslate = $this->getServiceLocator()->get('GTranslate\Service\Translate'); $config = array( 'from' => 'en', //english 'to' => 'de', //deutsch ); $gtranslate->__initialize($config); $resultString = $gtranslate->translate('Hello World'); return new ViewModel(array('translatedString' => $resultString)); //passing it to the view
-
In the View
<?php echo $this->translatedString; ?>