wowworks / translation-google-sheet
Tool for push/pull translation to google-sheets
Installs: 11 746
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- google/apiclient: ^2.0
- yiisoft/yii2: 2.*
This package is not auto-updated.
Last update: 2024-11-24 03:14:31 UTC
README
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);