Skip to content

wowworks-team/wowworks-translation-google-sheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

translation-google-sheet-service

Integration with Google-Sheets API.

Installation

This extension is available at packagist.org and can be installed via composer by following command:

composer require wowworks/translation-google-sheet`

Configuration:

$client = new Google_Client();
$client->setApplicationName('Google Sheets API Wowworks');
$client->setScopes(Google_Service_Sheets::SPREADSHEETS);
$client->setAccessType('offline');
$client->setPrompt('select_account consent');

$pathToCredentialFile = 'pathToCredentialFile';
putenv("GOOGLE_APPLICATION_CREDENTIALS={$pathToCredentialFile}");
$client->useApplicationDefaultCredentials();
$serviceGoogleSheets = new Google_Service_Sheets($client);
$configurationService = new TranslationGoogleSheetConfigurationService(
    ['en_EN', 'ru_RU', 'de_DE'],
    ['ru_RU']
);

$service =  new TranslationGoogleSheetService(
            ['spreadSheetUrl1', 'spreadSheetUrl2'],
            $serviceGoogleSheets,
            $configurationService,
            new TranslationStringConverter()
);

Usage:

$allPathsToTranslations = $configurationService->getAllPathsToTranslations(Yii::$app->i18n->translations);
$service->pull($allPathsToTranslations);
$service->push($allPathsToTranslations);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages