PHP code example of melisplatform / melis-site-translation

1. Go to this page and download the library: Download melisplatform/melis-site-translation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

melisplatform / melis-site-translation example snippets


//Get the service
$melisSiteTranslationService = $this->getServiceLocator()->get('MelisSiteTranslationService');
//translate a certain text using translation key(eg. tr_translation_name)
//$langId - (optional) language id
$translatedText = $melisSiteTranslationService->getText($key, $langId);