PHP code example of nicmart / getlocalization

1. Go to this page and download the library: Download nicmart/getlocalization 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/ */

    

nicmart / getlocalization example snippets



GetLocalization\Client;


    $client = new GetLocalization\Client('username', 'password', 'projectname');

/**
 * @param string $format    The format of the master file
 * @param string $language  The language of the master file
 * @param string $filePath  The path of the local file to upload as master file
 */
$client->createMaster($format, $language, $filePath);

/**
 * @param string $filePath  The path of the local file to upload as master file
 */
$client->updateMaster($filePath);

/**
 * List master files
 *
 * @return array    A php array that is the json-decoded response of the get call
 */
$client->listMaster();

/**
 * @param string $masterfile    The name of the masterfile 
 * @param string $lang          The lang of the translation
 * @return string               The content of the translation
 */
$client->getTranslation($masterfile, $lang);

/**
 * @param string $masterfile    The name of the masterfile
 * @param string $lang          The lang of the translation being uploaded
 * @param string $filePath      The path of the local translation file
 * @return mixed
 */
$client->updateTranslation($masterfile, $lang, $filePath);

/**
 * Download all translations in zip format
 */
$client->getZippedTranslations();